Mercurial > hgsubversion
comparison tests/comprehensive/test_updatemeta.py @ 1057:cd256960b622
comprehensive tests: consolidate stupidity into test_util
In other words, remove explicit 'stupid' arguments, set the
'stupid_mode_tests' class variable, and have the metaclass generate
non-replay tests.
author | Dan Villiom Podlaski Christiansen <dan@cabo.dk> |
---|---|
date | Wed, 07 Aug 2013 23:31:57 +0200 |
parents | 903c9c9dfe6a |
children | 48379ebd2763 |
comparison
equal
deleted
inserted
replaced
1056:0932bb4d8870 | 1057:cd256960b622 |
---|---|
20 from hgsubversion import svncommands | 20 from hgsubversion import svncommands |
21 from hgsubversion import svnmeta | 21 from hgsubversion import svnmeta |
22 | 22 |
23 | 23 |
24 | 24 |
25 def _do_case(self, name, stupid, single): | 25 def _do_case(self, name, single): |
26 subdir = test_util.subdir.get(name, '') | 26 subdir = test_util.subdir.get(name, '') |
27 layout = 'auto' | 27 layout = 'auto' |
28 if single: | 28 if single: |
29 layout = 'single' | 29 layout = 'single' |
30 repo, repo_path = self.load_and_fetch(name, subdir=subdir, stupid=stupid, | 30 repo, repo_path = self.load_and_fetch(name, subdir=subdir, layout=layout) |
31 layout=layout) | |
32 assert test_util.repolen(self.repo) > 0 | 31 assert test_util.repolen(self.repo) > 0 |
33 wc2_path = self.wc_path + '_clone' | 32 wc2_path = self.wc_path + '_clone' |
34 u = ui.ui() | 33 u = ui.ui() |
35 src, dest = test_util.hgclone(u, self.wc_path, wc2_path, update=False) | 34 src, dest = test_util.hgclone(u, self.wc_path, wc2_path, update=False) |
36 src = test_util.getlocalpeer(src) | 35 src = test_util.getlocalpeer(src) |
51 subdir), ]) | 50 subdir), ]) |
52 finally: | 51 finally: |
53 # remove the wrapper | 52 # remove the wrapper |
54 context.changectx.children = origchildren | 53 context.changectx.children = origchildren |
55 | 54 |
56 self._run_assertions(name, stupid, single, src, dest, u) | 55 self._run_assertions(name, single, src, dest, u) |
57 | 56 |
58 | 57 |
59 def _run_assertions(self, name, stupid, single, src, dest, u): | 58 def _run_assertions(self, name, single, src, dest, u): |
60 test_rebuildmeta._run_assertions(self, name, stupid, single, src, dest, u) | 59 test_rebuildmeta._run_assertions(self, name, single, src, dest, u) |
61 | 60 |
62 | 61 |
63 skip = set([ | 62 skip = set([ |
64 'project_root_not_repo_root.svndump', | 63 'project_root_not_repo_root.svndump', |
65 'corrupt.svndump', | 64 'corrupt.svndump', |
66 ]) | 65 ]) |
67 | 66 |
68 attrs = {'_do_case': _do_case, | 67 attrs = {'_do_case': _do_case, |
69 '_run_assertions': _run_assertions, | 68 '_run_assertions': _run_assertions, |
69 'stupid_mode_tests': True, | |
70 } | 70 } |
71 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]: | 71 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]: |
72 # this fixture results in an empty repository, don't use it | 72 # this fixture results in an empty repository, don't use it |
73 if case in skip: | 73 if case in skip: |
74 continue | 74 continue |
75 bname = 'test_' + case[:-len('.svndump')] | 75 bname = 'test_' + case[:-len('.svndump')] |
76 attrs[bname] = test_rebuildmeta.buildmethod(case, bname, False, False) | 76 attrs[bname] = test_rebuildmeta.buildmethod(case, bname, False) |
77 name = bname + '_stupid' | |
78 attrs[name] = test_rebuildmeta.buildmethod(case, name, True, False) | |
79 name = bname + '_single' | 77 name = bname + '_single' |
80 attrs[name] = test_rebuildmeta.buildmethod(case, name, False, True) | 78 attrs[name] = test_rebuildmeta.buildmethod(case, name, True) |
81 | 79 |
82 UpdateMetaTests = type('UpdateMetaTests', (test_util.TestBase,), attrs) | 80 UpdateMetaTests = type('UpdateMetaTests', (test_util.TestBase,), attrs) |