| 1 | # -*- mode: python; coding: utf-8 -*- |
|---|
| 2 | # :Progetto: vcpx -- Operational tests |
|---|
| 3 | # :Creato: lun 08 ago 2005 22:17:10 CEST |
|---|
| 4 | # :Autore: Lele Gaifax <lele@nautilus.homeip.net> |
|---|
| 5 | # :Licenza: GNU General Public License |
|---|
| 6 | # |
|---|
| 7 | |
|---|
| 8 | """ |
|---|
| 9 | [DEFAULT] |
|---|
| 10 | dont-refill-changelogs = True |
|---|
| 11 | target-module = None |
|---|
| 12 | source-repository = ~/WiP/cvsync |
|---|
| 13 | encoding = None |
|---|
| 14 | target-repository = None |
|---|
| 15 | use-svn-propset = False |
|---|
| 16 | source-module = None |
|---|
| 17 | update = True |
|---|
| 18 | subdir = . |
|---|
| 19 | debug = True |
|---|
| 20 | remove-first-log-line = False |
|---|
| 21 | patch-name-format = None |
|---|
| 22 | verbose = True |
|---|
| 23 | state-file = tailor.state |
|---|
| 24 | start-revision = Almost arbitrarily tagging this as version 0.8 |
|---|
| 25 | |
|---|
| 26 | [darcs2bzr] |
|---|
| 27 | target = bzr:tailor |
|---|
| 28 | root-directory = /tmp/tailor-tests/darcs2bzr |
|---|
| 29 | source = darcs:tailor |
|---|
| 30 | |
|---|
| 31 | [darcs2cdv] |
|---|
| 32 | target = cdv:tailor |
|---|
| 33 | root-directory = /tmp/tailor-tests/darcs2cdv |
|---|
| 34 | source = darcs:tailor |
|---|
| 35 | |
|---|
| 36 | [darcs2hg] |
|---|
| 37 | target = hg:tailor |
|---|
| 38 | root-directory = /tmp/tailor-tests/darcs2hg |
|---|
| 39 | source = darcs:tailor |
|---|
| 40 | |
|---|
| 41 | [darcs2svn] |
|---|
| 42 | target = svn:tailor |
|---|
| 43 | root-directory = /tmp/tailor-tests/darcs2svn |
|---|
| 44 | source = darcs:tailor |
|---|
| 45 | start-revision = INITIAL |
|---|
| 46 | |
|---|
| 47 | [svn2darcs] |
|---|
| 48 | target = darcs:svntailor |
|---|
| 49 | root-directory = /tmp/tailor-tests/svn2darcs |
|---|
| 50 | source = svn:tailor |
|---|
| 51 | start-revision = 1 |
|---|
| 52 | |
|---|
| 53 | [darcs:tailor] |
|---|
| 54 | repository = ~/WiP/cvsync |
|---|
| 55 | |
|---|
| 56 | [bzr:tailor] |
|---|
| 57 | bzr-command = /opt/src/bzr.dev/bzr |
|---|
| 58 | |
|---|
| 59 | [cdv:tailor] |
|---|
| 60 | |
|---|
| 61 | [hg:tailor] |
|---|
| 62 | |
|---|
| 63 | [svn:tailor] |
|---|
| 64 | repository = file:///tmp/tailor-tests/svnrepo |
|---|
| 65 | module = tailor |
|---|
| 66 | """ |
|---|
| 67 | |
|---|
| 68 | from unittest import TestCase, TestSuite |
|---|
| 69 | from cStringIO import StringIO |
|---|
| 70 | from vcpx.config import Config |
|---|
| 71 | from vcpx.tailor import Tailorizer |
|---|
| 72 | |
|---|
| 73 | class TailorTest(TestCase): |
|---|
| 74 | |
|---|
| 75 | def setUp(self): |
|---|
| 76 | from os import mkdir |
|---|
| 77 | from os.path import exists |
|---|
| 78 | from atexit import register |
|---|
| 79 | from shutil import rmtree |
|---|
| 80 | |
|---|
| 81 | self.config = Config(StringIO(__doc__), {}) |
|---|
| 82 | if not exists('/tmp/tailor-tests'): |
|---|
| 83 | mkdir('/tmp/tailor-tests') |
|---|
| 84 | register(rmtree, '/tmp/tailor-tests') |
|---|
| 85 | |
|---|
| 86 | def testConfiguration(self): |
|---|
| 87 | "Test basic configuration" |
|---|
| 88 | |
|---|
| 89 | from os.path import expanduser |
|---|
| 90 | |
|---|
| 91 | p = Tailorizer('darcs2svn', self.config) |
|---|
| 92 | self.assertEqual(p.rootdir, '/tmp/tailor-tests/darcs2svn') |
|---|
| 93 | self.assertEqual(p.source.repository, expanduser('~/WiP/cvsync')) |
|---|
| 94 | self.assertEqual(p.target.repository, |
|---|
| 95 | 'file:///tmp/tailor-tests/svnrepo') |
|---|
| 96 | self.assertEqual(p.state_file.filename, |
|---|
| 97 | '/tmp/tailor-tests/darcs2svn/tailor.state') |
|---|
| 98 | |
|---|
| 99 | ## Beware: carefully selected docs, methods executed in alpha order! |
|---|
| 100 | |
|---|
| 101 | def testDarcsToBazaarngBootstrap(self): |
|---|
| 102 | "Test darcs to BazaarNG bootstrap" |
|---|
| 103 | |
|---|
| 104 | project = self.config['darcs2bzr'] |
|---|
| 105 | tailorizer = Tailorizer(project) |
|---|
| 106 | tailorizer() |
|---|
| 107 | |
|---|
| 108 | def testDarcsToBazaarngUpdate(self): |
|---|
| 109 | "Test darcs to BazaarNG update" |
|---|
| 110 | |
|---|
| 111 | project = self.config['darcs2bzr'] |
|---|
| 112 | tailorizer = Tailorizer(project) |
|---|
| 113 | tailorizer() |
|---|
| 114 | |
|---|
| 115 | def testDarcsToMercurialBootstrap(self): |
|---|
| 116 | "Test darcs to mercurial bootstrap" |
|---|
| 117 | |
|---|
| 118 | project = self.config['darcs2hg'] |
|---|
| 119 | tailorizer = Tailorizer(project) |
|---|
| 120 | tailorizer() |
|---|
| 121 | |
|---|
| 122 | def testDarcsToMercurialUpdate(self): |
|---|
| 123 | "Test darcs to mercurial update" |
|---|
| 124 | |
|---|
| 125 | project = self.config['darcs2hg'] |
|---|
| 126 | tailorizer = Tailorizer(project) |
|---|
| 127 | tailorizer() |
|---|
| 128 | |
|---|
| 129 | def testDarcsToCodevilleBootstrap(self): |
|---|
| 130 | "Test darcs to codeville bootstrap" |
|---|
| 131 | |
|---|
| 132 | project = self.config['darcs2cdv'] |
|---|
| 133 | tailorizer = Tailorizer(project) |
|---|
| 134 | tailorizer() |
|---|
| 135 | |
|---|
| 136 | def testDarcsToCodevilleUpdate(self): |
|---|
| 137 | "Test darcs to codeville update" |
|---|
| 138 | |
|---|
| 139 | project = self.config['darcs2cdv'] |
|---|
| 140 | tailorizer = Tailorizer(project) |
|---|
| 141 | tailorizer() |
|---|
| 142 | |
|---|
| 143 | def testDarcsToSubversionBootstrap(self): |
|---|
| 144 | "Test darcs to subversion bootstrap" |
|---|
| 145 | |
|---|
| 146 | project = self.config['darcs2svn'] |
|---|
| 147 | tailorizer = Tailorizer(project) |
|---|
| 148 | tailorizer() |
|---|
| 149 | |
|---|
| 150 | def testDarcsToSubversionUpdate(self): |
|---|
| 151 | "Test darcs to subversion update" |
|---|
| 152 | |
|---|
| 153 | project = self.config['darcs2svn'] |
|---|
| 154 | tailorizer = Tailorizer(project) |
|---|
| 155 | tailorizer() |
|---|
| 156 | |
|---|
| 157 | ## The other way |
|---|
| 158 | |
|---|
| 159 | def testSubversionToDarcsBootstrap(self): |
|---|
| 160 | "Test reversed darcs to subversion bootstrap" |
|---|
| 161 | |
|---|
| 162 | project = self.config['svn2darcs'] |
|---|
| 163 | tailorizer = Tailorizer(project) |
|---|
| 164 | tailorizer() |
|---|
| 165 | |
|---|
| 166 | def testSubversionToDarcsUpdate(self): |
|---|
| 167 | "Test reversed darcs to subversion update" |
|---|
| 168 | |
|---|
| 169 | project = self.config['svn2darcs'] |
|---|
| 170 | tailorizer = Tailorizer(project) |
|---|
| 171 | tailorizer() |
|---|