comparison tests/comprehensive/test_verify_and_startrev.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 cd0d14e25757
comparison
equal deleted inserted replaced
1056:0932bb4d8870 1057:cd256960b622
35 'correct.svndump', 35 'correct.svndump',
36 'corrupt.svndump', 36 'corrupt.svndump',
37 'emptyrepo2.svndump', 37 'emptyrepo2.svndump',
38 ]) 38 ])
39 39
40 def _do_case(self, name, stupid, layout): 40 def _do_case(self, name, layout):
41 subdir = test_util.subdir.get(name, '') 41 subdir = test_util.subdir.get(name, '')
42 repo, svnpath = self.load_and_fetch(name, subdir=subdir, stupid=stupid, 42 repo, svnpath = self.load_and_fetch(name, subdir=subdir, layout=layout)
43 layout=layout)
44 assert test_util.repolen(self.repo) > 0 43 assert test_util.repolen(self.repo) > 0
45 for i in repo: 44 for i in repo:
46 ctx = repo[i] 45 ctx = repo[i]
47 self.assertEqual(verify.verify(repo.ui, repo, rev=ctx.node(), 46 self.assertEqual(verify.verify(repo.ui, repo, rev=ctx.node(),
48 stupid=True), 0) 47 stupid=True), 0)
50 stupid=False), 0) 49 stupid=False), 0)
51 50
52 # check a startrev clone 51 # check a startrev clone
53 if layout == 'single' and name not in _skipshallow: 52 if layout == 'single' and name not in _skipshallow:
54 self.wc_path += '_shallow' 53 self.wc_path += '_shallow'
55 shallowrepo = self.fetch(svnpath, subdir=subdir, stupid=stupid, 54 shallowrepo = self.fetch(svnpath, subdir=subdir,
56 layout='single', startrev='HEAD') 55 layout='single', startrev='HEAD')
57 56
58 self.assertEqual(test_util.repolen(shallowrepo), 1, 57 self.assertEqual(test_util.repolen(shallowrepo), 1,
59 "shallow clone should have just one revision, not %d" 58 "shallow clone should have just one revision, not %d"
60 % test_util.repolen(shallowrepo)) 59 % test_util.repolen(shallowrepo))
83 82
84 for f in fulltip: 83 for f in fulltip:
85 self.assertMultiLineEqual(fulltip[f].data(), shallowtip[f].data()) 84 self.assertMultiLineEqual(fulltip[f].data(), shallowtip[f].data())
86 85
87 86
88 def buildmethod(case, name, stupid, layout): 87 def buildmethod(case, name, layout):
89 m = lambda self: self._do_case(case, stupid, layout) 88 m = lambda self: self._do_case(case, layout)
90 m.__name__ = name 89 m.__name__ = name
91 bits = case, stupid and 'stupid' or 'real', layout 90 m.__doc__ = 'Test verify on %s (%s)' % (case, layout)
92 m.__doc__ = 'Test verify on %s with %s replay. (%s)' % bits
93 return m 91 return m
94 92
95 attrs = {'_do_case': _do_case} 93 attrs = {'_do_case': _do_case, 'stupid_mode_tests': True}
96 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] 94 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]
97 for case in fixtures: 95 for case in fixtures:
98 if case in _skipall: 96 if case in _skipall:
99 continue 97 continue
100 bname = 'test_' + case[:-len('.svndump')] 98 bname = 'test_' + case[:-len('.svndump')]
101 if case not in _skipstandard: 99 if case not in _skipstandard:
102 attrs[bname] = buildmethod(case, bname, False, 'standard') 100 attrs[bname] = buildmethod(case, bname, 'standard')
103 name = bname + '_stupid'
104 attrs[name] = buildmethod(case, name, True, 'standard')
105 name = bname + '_single' 101 name = bname + '_single'
106 attrs[name] = buildmethod(case, name, False, 'single') 102 attrs[name] = buildmethod(case, name, 'single')
107 name = bname + '_single_stupid'
108 attrs[name] = buildmethod(case, name, True, 'single')
109 103
110 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) 104 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs)