comparison tests/test_startrev.py @ 658:d101b39f6c51

test_startrev: add a few assertions about clone lengths A few tweaks are added to the test to ensure that all tests pass these assertions: Some fixtures fail them by resulting in empty clones. Explicitly blacklisting such fixtures allows as to ensure that the other fixtures continue to work as expected. Other fixtures contain no files in trunk at HEAD, so we test them with other subdirectories instead.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 11 Aug 2010 19:57:34 +0200
parents 9cf547fc36e8
children e9af7eba88db
comparison
equal deleted inserted replaced
657:9cf547fc36e8 658:d101b39f6c51
18 self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(headtip)) 18 self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(headtip))
19 19
20 for f in fulltip: 20 for f in fulltip:
21 self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data()) 21 self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())
22 22
23 self.assertNotEqual(len(fullclone), 0, "full clone shouldn't be empty")
24 self.assertEqual(len(headclone), 1,
25 "shallow clone should have just one revision, not %d"
26 % len(headclone))
27
23 def buildmethod(case, name, subdir, stupid): 28 def buildmethod(case, name, subdir, stupid):
24 m = lambda self: self._do_case(case, subdir.strip('/'), stupid) 29 m = lambda self: self._do_case(case, subdir.strip('/'), stupid)
25 m.__name__ = name 30 m.__name__ = name
26 m.__doc__ = ('Test clone with startrev on %s%s with %s replay.' % 31 m.__doc__ = ('Test clone with startrev on %s%s with %s replay.' %
27 (case, subdir, (stupid and 'stupid') or 'real')) 32 (case, subdir, (stupid and 'stupid') or 'real'))
28 return m 33 return m
29 34
30 35
36 # these fixtures contain no files at HEAD and would result in empty clones
37 nofiles = set([
38 'binaryfiles.svndump',
39 'emptyrepo.svndump',
40 ])
41
42 # these fixtures contain no files in trunk at HEAD and would result in an empty
43 # shallow clone if cloning trunk, so we use another subdirectory
44 subdirmap = {
45 'commit-to-tag.svndump': '/branches/magic',
46 'pushexternals.svndump': '',
47 'tag_name_same_as_branch.svndump': '/branches/magic',
48 }
49
31 attrs = {'_do_case': _do_case, 50 attrs = {'_do_case': _do_case,
32 } 51 }
52
33 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]: 53 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
34 subdir = test_util.subdir.get(case, '') + '/trunk' 54 if case in nofiles:
55 continue
56
57 subdir = test_util.subdir.get(case, '') + subdirmap.get(case, '/trunk')
35 58
36 bname = 'test_' + case[:-len('.svndump')] 59 bname = 'test_' + case[:-len('.svndump')]
37 attrs[bname] = buildmethod(case, bname, subdir, False) 60 attrs[bname] = buildmethod(case, bname, subdir, False)
38 name = bname + '_stupid' 61 name = bname + '_stupid'
39 attrs[name] = buildmethod(case, name, subdir, True) 62 attrs[name] = buildmethod(case, name, subdir, True)