comparison tests/test_startrev.py @ 653:ab454ee515d4

test_startrev: new tests inspired by test_rebuildmeta The tests for start revision support are inspired by the rebuildmeta tests; for every single fixture, a full and a shallow clone is performed, and the two are then compared.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 20 Jul 2010 12:53:47 +0200
parents
children 9cf547fc36e8
comparison
equal deleted inserted replaced
652:c3900ad3bf69 653:ab454ee515d4
1 import test_util
2
3 import os
4 import unittest
5
6 def _do_case(self, name, subdir, stupid):
7 wc_base = self.wc_path
8 self.wc_path = wc_base + '_full'
9 headclone = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid,
10 layout='single', startrev='HEAD')
11 self.wc_path = wc_base + '_head'
12 fullclone = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid,
13 layout='single')
14
15 fulltip = fullclone['tip']
16 headtip = headclone['tip']
17 # viewing diff's of lists of files is easier on the eyes
18 self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(headtip))
19
20 for f in fulltip:
21 self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())
22
23 def buildmethod(case, name, subdir, stupid):
24 m = lambda self: self._do_case(case, subdir, stupid)
25 m.__name__ = name
26 m.__doc__ = ('Test clone with startrev on %s%s with %s replay.' %
27 (case, subdir, (stupid and 'stupid') or 'real'))
28 return m
29
30
31 attrs = {'_do_case': _do_case,
32 }
33 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
34 # this fixture results in an empty repository, don't use it
35 if case == 'project_root_not_repo_root.svndump':
36 continue
37 subdir = test_util.subdir.get(case, '')
38
39 bname = 'test_' + case[:-len('.svndump')]
40 attrs[bname] = buildmethod(case, bname, subdir, False)
41 name = bname + '_stupid'
42 attrs[name] = buildmethod(case, name, subdir, True)
43
44 StartRevTests = type('StartRevTests', (test_util.TestBase, ), attrs)
45
46
47 def suite():
48 all = [unittest.TestLoader().loadTestsFromTestCase(StartRevTests),
49 ]
50 return unittest.TestSuite(all)