Mercurial > hgsubversion
annotate tests/comprehensive/test_verify.py @ 646:f12257bf8b91
README: document single-directory clones a little.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 16 Jul 2010 16:50:08 -0500 |
parents | 1fd3cfa47c5e |
children | 124cd25de4ef |
rev | line source |
---|---|
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
1 import os |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
2 import pickle |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
3 import unittest |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
426
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
5 # wrapped in a try/except because of weirdness in how |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
6 # run.py works as compared to nose. |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
7 try: |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
8 import test_util |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
9 except ImportError: |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
10 from tests import test_util |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
11 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
12 from mercurial import hg |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
13 from mercurial import ui |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
14 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
15 from hgsubversion import svncommands |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
16 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
17 def _do_case(self, name, stupid, layout): |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
18 subdir = test_util.subdir.get(name, '') |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
19 repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid, layout=layout) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
20 assert len(self.repo) > 0 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
21 for i in repo: |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 ctx = repo[i] |
441
de085126dbd4
svncommands: use rev instead of verifynode -- should not have to be a node
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
427
diff
changeset
|
23 self.assertEqual(svncommands.verify(repo.ui, repo, rev=ctx.node()), 0) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
24 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
25 def buildmethod(case, name, stupid, layout): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
26 m = lambda self: self._do_case(case, stupid, layout) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
27 m.__name__ = name |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
28 bits = case, stupid and 'stupid' or 'real', layout |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
29 m.__doc__ = 'Test verify on %s with %s replay. (%s)' % bits |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
30 return m |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
31 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
32 attrs = {'_do_case': _do_case} |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
33 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
34 for case in fixtures: |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
35 # this fixture results in an empty repository, don't use it |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
36 if case == 'project_root_not_repo_root.svndump': |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
37 continue |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
38 bname = 'test_' + case[:-len('.svndump')] |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
39 attrs[bname] = buildmethod(case, bname, False, 'standard') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
40 name = bname + '_stupid' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
41 attrs[name] = buildmethod(case, name, True, 'standard') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
42 name = bname + '_single' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
43 attrs[name] = buildmethod(case, name, False, 'single') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
44 # Disabled because the "stupid and real are the same" tests |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
45 # verify this plus even more. |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
46 # name = bname + '_single_stupid' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
441
diff
changeset
|
47 # attrs[name] = buildmethod(case, name, True, 'single') |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
48 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
49 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
50 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
51 def suite(): |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
52 all = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)] |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
53 return unittest.TestSuite(all) |