Mercurial > hgsubversion
comparison tests/comprehensive/test_verify.py @ 395:636e9bf5d49c
svncommands: add verify command
| author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
|---|---|
| date | Thu, 11 Jun 2009 19:14:05 +0200 |
| parents | |
| children | 72e63999722f |
comparison
equal
deleted
inserted
replaced
| 394:d70c8e45cb9e | 395:636e9bf5d49c |
|---|---|
| 1 import os | |
| 2 import pickle | |
| 3 import unittest | |
| 4 | |
| 5 import test_util | |
| 6 | |
| 7 from mercurial import hg | |
| 8 from mercurial import ui | |
| 9 | |
| 10 from hgsubversion import svncommands | |
| 11 | |
| 12 def _do_case(self, name, stupid): | |
| 13 subdir = test_util.subdir.get(name, '') | |
| 14 repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid) | |
| 15 assert len(self.repo) > 0 | |
| 16 for i in repo: | |
| 17 ctx = repo[i] | |
| 18 hg.clean(repo, ctx.node(), False) | |
| 19 self.assertEqual(svncommands.verify(repo.ui, repo), 0) | |
| 20 | |
| 21 def buildmethod(case, name, stupid): | |
| 22 m = lambda self: self._do_case(case, stupid) | |
| 23 m.__name__ = name | |
| 24 bits = case, stupid and 'stupid' or 'real' | |
| 25 m.__doc__ = 'Test verify on %s with %s replay.' % bits | |
| 26 return m | |
| 27 | |
| 28 attrs = {'_do_case': _do_case} | |
| 29 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] | |
| 30 for case in fixtures: | |
| 31 # this fixture results in an empty repository, don't use it | |
| 32 if case == 'project_root_not_repo_root.svndump': | |
| 33 continue | |
| 34 name = 'test_' + case[:-len('.svndump')] | |
| 35 attrs[name] = buildmethod(case, name, False) | |
| 36 name += '_stupid' | |
| 37 attrs[name] = buildmethod(case, name, True) | |
| 38 | |
| 39 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) | |
| 40 | |
| 41 def suite(): | |
| 42 all = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)] | |
| 43 return unittest.TestSuite(all) |
