Changeset 882 in tailor
- Timestamp:
- 10/06/05 01:20:46 (8 years ago)
- Hash name:
- 20051005232046-97f81-a428e84c397d7e458a784e40f3316a2c2c070055
- Files:
-
- 12 edited
-
tailor (modified) (1 diff)
-
vcpx/tests/__init__.py (modified) (2 diffs)
-
vcpx/tests/shwrap.py (modified) (1 diff)
-
vcpx/tests/cvsps.py (modified) (1 diff)
-
vcpx/tests/cvs.py (modified) (2 diffs)
-
vcpx/tests/darcs.py (modified) (2 diffs)
-
vcpx/tests/svn.py (modified) (1 diff)
-
README (modified) (1 diff)
-
vcpx/tests/config.py (modified) (1 diff)
-
vcpx/tests/tailor.py (modified) (17 diffs)
-
vcpx/tests/statefile.py (modified) (1 diff)
-
vcpx/tests/svndump.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tailor
r850 r882 22 22 locale.setlocale(locale.LC_CTYPE, '') 23 23 if len(sys.argv)>1 and sys.argv[1] == 'test': 24 del sys.argv[1] 25 from unittest import main 26 main(module='vcpx.tests', argv=sys.argv) 24 from vcpx.tests import main 25 main() 27 26 else: 28 27 from vcpx import * -
vcpx/tests/__init__.py
r729 r882 5 5 # :Licenza: GNU General Public License 6 6 # 7 8 import sys 9 from unittest import TestProgram, TestSuite 7 10 8 11 from shwrap import * … … 17 20 18 21 ExternalCommand.VERBOSE = False 22 23 class TailorTest(TestProgram): 24 """A command-line program that runs a set of tests; this is primarily 25 for making test modules conveniently executable. 26 """ 27 USAGE = """\ 28 Usage: %(progName)s [options] [test] [...] 29 30 Options: 31 -h, --help Show this message 32 -v, --verbose Verbose output 33 -q, --quiet Minimal output 34 -l, --list List available tests without running them 35 36 Examples: 37 %(progName)s - run default set of tests 38 %(progName)s MyTestSuite - run suite 'MyTestSuite' 39 %(progName)s MyTestCase.testSomething - run MyTestCase.testSomething 40 %(progName)s MyTestCase - run all 'test*' test methods 41 in MyTestCase 42 """ 43 44 def __init__(self): 45 del sys.argv[1] 46 TestProgram.__init__(self, module='vcpx.tests', argv=sys.argv) 47 48 def parseArgs(self, argv): 49 import getopt 50 try: 51 options, args = getopt.getopt(argv[1:], 'hHvql', 52 ['help','verbose','quiet','list']) 53 listonly = False 54 for opt, value in options: 55 if opt in ('-h','-H','--help'): 56 self.usageExit() 57 if opt in ('-q','--quiet'): 58 self.verbosity = 0 59 if opt in ('-v','--verbose'): 60 self.verbosity = 2 61 if opt in ('-l','--list'): 62 listonly = True 63 if len(args) == 0 and self.defaultTest is None: 64 self.test = self.testLoader.loadTestsFromModule(self.module) 65 else: 66 if len(args) > 0: 67 self.testNames = args 68 else: 69 self.testNames = (self.defaultTest,) 70 self.createTests() 71 if listonly: 72 def listsuite(suite): 73 tcount = 0 74 scount = 0 75 tclass = None 76 for t in suite._tests: 77 if isinstance(t, TestSuite): 78 tc,sc = listsuite(t) 79 tcount += tc 80 scount += sc + 1 81 else: 82 tcount += 1 83 if tclass <> t.__class__: 84 tclass = t.__class__ 85 title = tclass.__name__ 86 if tclass.__doc__: 87 title += ': ' + tclass.__doc__.strip() 88 print 89 print title 90 print '='*len(title) 91 print t._TestCase__testMethodName, '--', 92 print t.shortDescription() 93 return tcount, scount 94 tcount, scount = listsuite(self.test) 95 print 96 print "%d tests in %d suites" % (tcount,scount) 97 sys.exit(0) 98 except getopt.error, msg: 99 self.usageExit(msg) 100 101 main = TailorTest -
vcpx/tests/shwrap.py
r594 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from vcpx.shwrap import ExternalCommand, PIPE, STDOUT 10 10 11 class SystemCommandTest(TestCase): 12 """Perform some basic tests of the wrapper. 13 """ 11 class SystemCommand(TestCase): 12 """Perform some basic tests of the wrapper""" 14 13 15 14 def testExitStatusForTrue(self): -
vcpx/tests/cvsps.py
r670 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from datetime import datetime 10 10 from StringIO import StringIO 11 11 from vcpx.cvsps import changesets_from_cvsps 12 12 13 class CvspsParser Test(TestCase):14 """Ensure the cvsps parser does its job ."""13 class CvspsParser(TestCase): 14 """Ensure the cvsps parser does its job""" 15 15 16 16 SIMPLE_TEST = """\ -
vcpx/tests/cvs.py
r866 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from datetime import datetime 10 10 from StringIO import StringIO 11 11 from vcpx.cvs import changesets_from_cvslog, CvsEntry 12 12 13 class CvsEntry Test(TestCase):13 class CvsEntry(TestCase): 14 14 """Tests for the CvsEntry class""" 15 15 … … 41 41 42 42 43 class CvsLogParser Test(TestCase):44 """Ensure the cvs log parser does its job ."""43 class CvsLogParser(TestCase): 44 """Ensure the cvs log parser does its job""" 45 45 46 46 SIMPLE_TEST = u"""\ -
vcpx/tests/darcs.py
r594 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from datetime import datetime 10 10 from StringIO import StringIO … … 12 12 from shwrap import ExternalCommand, PIPE 13 13 14 class DarcsChangesParser Test(TestCase):14 class DarcsChangesParser(TestCase): 15 15 """Tests for the parser of darcs changes""" 16 16 -
vcpx/tests/svn.py
r840 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from datetime import datetime 10 10 from StringIO import StringIO 11 11 from vcpx.svn import changesets_from_svnlog 12 12 13 class SvnLogParser Test(TestCase):14 """Ensure the svn log parser does its job ."""13 class SvnLogParser(TestCase): 14 """Ensure the svn log parser does its job""" 15 15 16 16 SIMPLE_RENAME_TEST = """\ -
README
r879 r882 95 95 ======= 96 96 97 You can run the test suite with the following command line:: 97 Tailor has more than 50 unit and operational tests, that you can 98 run with the following command line:: 98 99 99 100 $ tailor test -v 100 101 101 that runs all the tests in sequence, or:: 102 103 $ tailor test -v TailorTest 104 105 to trigger just a subset of them. 102 Since some tests take very long to complete, in particular the 103 operational tests, you may prefer the execution of a single suite:: 104 105 $ tailor test -v Darcs 106 107 or even a single test within a suite:: 108 109 $ tailor test StateFile.testJournal 110 111 To obtain a list of the test, use ``--list`` option. As usual with:: 112 113 $ tailor test --help 114 115 you will get some more details. 106 116 107 117 -
vcpx/tests/config.py
r831 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from cStringIO import StringIO 10 10 from vcpx.config import Config, ConfigurationError 11 11 from vcpx.project import Project 12 12 13 class ConfigTest(TestCase): 13 class Config(TestCase): 14 "Test the configuration system" 14 15 15 16 def setUp(self): -
vcpx/tests/tailor.py
r806 r882 23 23 verbose = True 24 24 state-file = tailor.state 25 start-revision = Version 0.9. 725 start-revision = Version 0.9.16 26 26 27 27 [darcs2bzr] … … 29 29 root-directory = /tmp/tailor-tests/darcs2bzr 30 30 source = darcs:tailor 31 32 [darcs2bzrng]33 target = bzrng:tailor34 root-directory = /tmp/tailor-tests/darcs2bzrng35 source = darcs:tailor36 31 patch-name-format = %(revision)s 32 33 [bzr2darcs] 34 source = bzr:tailor 35 root-directory = /tmp/tailor-tests/bzr2darcs 36 target = darcs:bzrtailor 37 patch-name-format = %(revision)s 38 39 [darcs:tailor] 40 41 [bzr:tailor] 42 python-path = /opt/src/bzr.dev 43 37 44 38 45 [darcs2cdv] … … 41 48 source = darcs:tailor 42 49 50 [cdv:tailor] 51 52 43 53 [darcs2hg] 44 54 target = hg:tailor 45 55 root-directory = /tmp/tailor-tests/darcs2hg 46 56 source = darcs:tailor 57 58 [hg:tailor] 59 47 60 48 61 [darcs2svn] … … 58 71 start-revision = 1 59 72 73 [svn:tailor] 74 repository = file:///tmp/tailor-tests/svnrepo 75 module = tailor 76 subdir = svnside 77 use-propset = True 78 79 [darcs:svntailor] 80 subdir = darcside 81 82 60 83 [darcs2monotone] 61 84 target = monotone:tailor … … 68 91 target = darcs:mtntailor 69 92 start-revision = INITIAL 70 71 [darcs:tailor]72 73 [bzr:tailor]74 bzr-command = /opt/src/bzr.dev/bzr75 76 [bzrng:tailor]77 python-path = /opt/src/bzr.dev78 79 [cdv:tailor]80 81 [hg:tailor]82 93 83 94 [monotone:tailor] … … 90 101 subdir = darcside 91 102 92 [svn:tailor]93 repository = file:///tmp/tailor-tests/svnrepo94 module = tailor95 subdir = svnside96 use-propset = True97 98 [darcs:svntailor]99 subdir = darcside100 103 101 104 [cvs2darcs] … … 113 116 encoding = iso-8859-1 114 117 118 115 119 [cvs2hglib] 116 120 root-directory = /tmp/tailor-tests/cvs2hglib … … 126 130 127 131 [hglib:cmsmini] 132 128 133 129 134 [cvs2bzr] … … 139 144 140 145 [bzr:atse] 141 bzr-command = /opt/src/bzr.dev/bzr 146 python-path = /opt/src/bzr.dev 147 142 148 143 149 [svndump2darcs] … … 155 161 subdir = . 156 162 163 157 164 [svndump2hg] 158 165 source = svndump:pyobjc … … 167 174 [hg:pyobjc] 168 175 subdir = hg 176 169 177 170 178 [svndump2hg-partial] … … 183 191 subdir = hg 184 192 193 185 194 [cvs2svn] 186 195 source = cvs:cmfeditions-houston-sprint … … 206 215 """ 207 216 208 from unittest import TestCase , TestSuite217 from unittest import TestCase 209 218 from cStringIO import StringIO 210 219 from vcpx.config import Config … … 212 221 from vcpx.shwrap import ExternalCommand, PIPE 213 222 214 class TailorTest(TestCase):223 class OperationalTest(TestCase): 215 224 216 225 def setUp(self): … … 228 237 if not exists('/tmp/tailor-tests'): 229 238 mkdir('/tmp/tailor-tests') 230 register(rmtree, '/tmp/tailor-tests')239 #register(rmtree, '/tmp/tailor-tests') 231 240 232 241 def diffWhenPossible(self, tailorizer): … … 247 256 return "" 248 257 258 def tailorize(self, project): 259 "The actual test" 260 261 tailorizer = Tailorizer(project, self.config) 262 self.assert_(not tailorizer.exists()) 263 tailorizer() 264 self.assertEqual(self.diffWhenPossible(tailorizer), "") 265 266 class Darcs(OperationalTest): 267 "Test darcs backend" 268 249 269 def testConfiguration(self): 250 270 "Test basic configuration" … … 265 285 self.assertEqual(tailorizer.source.subdir, 'pxlib') 266 286 267 def testDarcsToBazaarng(self): 268 "Test darcs to BazaarNG" 269 270 tailorizer = Tailorizer('darcs2bzr', self.config) 271 self.assert_(not tailorizer.exists()) 272 tailorizer() 273 self.assertEqual(self.diffWhenPossible(tailorizer), "") 274 275 def testDarcsToBazaarngNative(self): 276 "Test darcs to BazaarNG (native)" 277 278 tailorizer = Tailorizer('darcs2bzrng', self.config) 279 self.assert_(not tailorizer.exists()) 280 tailorizer() 281 self.assertEqual(self.diffWhenPossible(tailorizer), "") 287 def testDarcsAndBazaarng(self): 288 "Test darcs to bazaar-ng and the other way around" 289 290 self.tailorize('darcs2bzr') 291 self.tailorize('bzr2darcs') 282 292 283 293 def testDarcsToMercurial(self): 284 294 "Test darcs to mercurial" 285 295 286 tailorizer = Tailorizer('darcs2hg', self.config) 287 self.assert_(not tailorizer.exists()) 288 tailorizer() 289 self.assertEqual(self.diffWhenPossible(tailorizer), "") 296 self.tailorize('darcs2hg') 290 297 291 298 def testDarcsToCodeville(self): 292 299 "Test darcs to codeville" 293 300 294 tailorizer = Tailorizer('darcs2cdv', self.config) 295 self.assert_(not tailorizer.exists()) 296 tailorizer() 297 self.assertEqual(self.diffWhenPossible(tailorizer), "") 298 299 def testDarcsToSubversion(self): 300 "Test darcs to subversion" 301 302 tailorizer = Tailorizer('darcs2svn', self.config) 303 self.assert_(not tailorizer.exists()) 304 tailorizer() 305 self.assertEqual(self.diffWhenPossible(tailorizer), "") 306 307 def testDarcsToMonotone(self): 308 "Test darcs to monotone" 309 310 tailorizer = Tailorizer('darcs2monotone', self.config) 311 self.assert_(not tailorizer.exists()) 312 tailorizer() 313 self.assertEqual(self.diffWhenPossible(tailorizer), "") 314 315 ## The other way 316 317 def testSubversionToDarcs(self): 318 "Test subversion to darcs" 319 320 tailorizer = Tailorizer('svn2darcs', self.config) 321 self.assert_(not tailorizer.exists()) 322 tailorizer() 323 self.assertEqual(self.diffWhenPossible(tailorizer), "") 301 self.tailorize('darcs2cdv') 302 303 def testDarcsAndSubversion(self): 304 "Test darcs to subversion and the other way around" 305 306 self.tailorize('darcs2svn') 307 self.tailorize('svn2darcs') 308 309 def testDarcsAndMonotone(self): 310 "Test darcs to monotone and the other way around" 311 312 self.tailorize('darcs2monotone') 313 self.tailorize('monotone2darcs') 314 315 316 class Cvs(OperationalTest): 317 "Test the CVS source backend" 324 318 325 319 def testCvsToDarcs(self): 326 320 "Test CVS to darcs" 327 321 328 tailorizer = Tailorizer('cvs2darcs', self.config) 329 self.assert_(not tailorizer.exists()) 330 tailorizer() 331 self.assertEqual(self.diffWhenPossible(tailorizer), "") 322 self.tailorize('cvs2darcs') 332 323 333 324 def testCvsToMercurial(self): 334 "Test CVS to Mercurial" 335 336 tailorizer = Tailorizer('cvs2hglib', self.config) 337 self.assert_(not tailorizer.exists()) 338 tailorizer() 339 self.assertEqual(self.diffWhenPossible(tailorizer), "") 325 "Test CVS to mercurial" 326 327 self.tailorize('cvs2hglib') 340 328 341 329 def testCvsToBazaarng(self): 342 "Test CVS to Bazaar-NG" 343 344 tailorizer = Tailorizer('cvs2bzr', self.config) 345 self.assert_(not tailorizer.exists()) 346 tailorizer() 347 self.assertEqual(self.diffWhenPossible(tailorizer), "") 330 "Test CVS to bazaar-ng" 331 332 self.tailorize('cvs2bzr') 348 333 349 334 def testCvsToSubversion(self): 350 335 "Test CVS branch to Subversion" 351 336 352 tailorizer = Tailorizer('cvs2svn', self.config) 353 self.assert_(not tailorizer.exists()) 354 tailorizer() 355 self.assertEqual(self.diffWhenPossible(tailorizer), "") 337 self.tailorize('cvs2svn') 338 339 340 class Svndump(OperationalTest): 341 "Test the svndump source backend (deprecated)" 356 342 357 343 def testSvndumpToDarcs(self): 358 344 "Test subversion dump to darcs" 359 345 360 tailorizer = Tailorizer('svndump2darcs', self.config) 361 self.assert_(not tailorizer.exists()) 362 tailorizer() 363 self.assertEqual(self.diffWhenPossible(tailorizer), "") 346 self.tailorize('svndump2darcs') 364 347 365 348 def testSvndumpToMercurial(self): 366 349 "Test subversion dump to mercurial" 367 350 368 tailorizer = Tailorizer('svndump2hg', self.config) 369 self.assert_(not tailorizer.exists()) 370 tailorizer() 371 self.assertEqual(self.diffWhenPossible(tailorizer), "") 351 self.tailorize('svndump2hg') 372 352 373 353 def testPartialSvndumpToMercurial(self): 374 354 "Test partial subversion dump to mercurial" 375 355 376 tailorizer = Tailorizer('svndump2hg-partial', self.config) 377 self.assert_(not tailorizer.exists()) 378 tailorizer() 379 self.assertEqual(self.diffWhenPossible(tailorizer), "") 356 self.tailorize('svndump2hg-partial') -
vcpx/tests/statefile.py
r679 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from cStringIO import StringIO 10 10 from vcpx.statefile import StateFile 11 11 from vcpx.shwrap import ReopenableNamedTemporaryFile 12 12 13 class StateFileTest(TestCase): 13 class Statefile(TestCase): 14 "Exercise the state file machinery" 14 15 15 16 def testStateFile(self): -
vcpx/tests/svndump.py
r755 r882 6 6 # 7 7 8 from unittest import TestCase , TestSuite8 from unittest import TestCase 9 9 from datetime import datetime 10 10 from StringIO import StringIO 11 11 from vcpx.svndump import changesets_from_svndump 12 12 13 class SvndumpParser Test(TestCase):14 """Ensure the svndump parser does its job ."""13 class SvndumpParser(TestCase): 14 """Ensure the svndump parser does its job""" 15 15 16 16 def setUp(self):
Note: See TracChangeset
for help on using the changeset viewer.
