comparison tests/comprehensive/test_verify.py @ 499:1fd3cfa47c5e

Support for single-directory clones.
author Augie Fackler <durin42@gmail.com>
date Fri, 16 Oct 2009 23:33:41 -0400
parents de085126dbd4
children 124cd25de4ef
comparison
equal deleted inserted replaced
498:990e07054f29 499:1fd3cfa47c5e
12 from mercurial import hg 12 from mercurial import hg
13 from mercurial import ui 13 from mercurial import ui
14 14
15 from hgsubversion import svncommands 15 from hgsubversion import svncommands
16 16
17 def _do_case(self, name, stupid): 17 def _do_case(self, name, stupid, layout):
18 subdir = test_util.subdir.get(name, '') 18 subdir = test_util.subdir.get(name, '')
19 repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid) 19 repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid, layout=layout)
20 assert len(self.repo) > 0 20 assert len(self.repo) > 0
21 for i in repo: 21 for i in repo:
22 ctx = repo[i] 22 ctx = repo[i]
23 self.assertEqual(svncommands.verify(repo.ui, repo, rev=ctx.node()), 0) 23 self.assertEqual(svncommands.verify(repo.ui, repo, rev=ctx.node()), 0)
24 24
25 def buildmethod(case, name, stupid): 25 def buildmethod(case, name, stupid, layout):
26 m = lambda self: self._do_case(case, stupid) 26 m = lambda self: self._do_case(case, stupid, layout)
27 m.__name__ = name 27 m.__name__ = name
28 bits = case, stupid and 'stupid' or 'real' 28 bits = case, stupid and 'stupid' or 'real', layout
29 m.__doc__ = 'Test verify on %s with %s replay.' % bits 29 m.__doc__ = 'Test verify on %s with %s replay. (%s)' % bits
30 return m 30 return m
31 31
32 attrs = {'_do_case': _do_case} 32 attrs = {'_do_case': _do_case}
33 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] 33 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]
34 for case in fixtures: 34 for case in fixtures:
35 # this fixture results in an empty repository, don't use it 35 # this fixture results in an empty repository, don't use it
36 if case == 'project_root_not_repo_root.svndump': 36 if case == 'project_root_not_repo_root.svndump':
37 continue 37 continue
38 name = 'test_' + case[:-len('.svndump')] 38 bname = 'test_' + case[:-len('.svndump')]
39 attrs[name] = buildmethod(case, name, False) 39 attrs[bname] = buildmethod(case, bname, False, 'standard')
40 name += '_stupid' 40 name = bname + '_stupid'
41 attrs[name] = buildmethod(case, name, True) 41 attrs[name] = buildmethod(case, name, True, 'standard')
42 name = bname + '_single'
43 attrs[name] = buildmethod(case, name, False, 'single')
44 # Disabled because the "stupid and real are the same" tests
45 # verify this plus even more.
46 # name = bname + '_single_stupid'
47 # attrs[name] = buildmethod(case, name, True, 'single')
42 48
43 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) 49 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs)
44 50
45 def suite(): 51 def suite():
46 all = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)] 52 all = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)]