annotate tests/comprehensive/test_sqlite_revmap.py @ 1506:332e803044e5

commands: fix registrar check 'util' in hgsubversion is a different type from hgutil, which is the one from core hg. This was hidden by the fallback logic, but I'm not sure why it didn't cause errors in the tests. Maybe I ran the original tests against an older hg. This time I've ensured the tests pass against the latest version of hg.
author Durham Goode <durham@fb.com>
date Tue, 23 May 2017 11:08:42 -0700
parents f21605bcda24
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1474
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
1 import os
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
2 import unittest
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
3 import sys
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
4
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
5 # wrapped in a try/except because of weirdness in how
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
6 # run.py works as compared to nose.
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
7 try:
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
8 import test_util
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
9 except ImportError:
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
10 sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
11 import test_util
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
12
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
13 # interesting and fast tests
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
14 import test_fetch_mappings
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
15 import test_fetch_renames
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
16 import test_pull
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
17 import test_template_keywords
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
18 import test_utility_commands
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
19
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
20 # comprehensive tests
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
21 try:
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
22 import test_custom_layout
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
23 except ImportError:
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
24 sys.path.insert(0, os.path.dirname(__file__))
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
25 import test_custom_layout
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
26
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
27 import test_rebuildmeta
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
28 import test_updatemeta
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
29
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
30 from hgsubversion import svnmeta, maps
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
31
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
32
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
33 class SqliteRevMapMixIn(object):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
34 # do not double the test size by being wrapped again
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
35 obsolete_mode_tests = False
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
36 stupid_mode_tests = False
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
37
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
38 def setUp(self):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
39 assert svnmeta.SVNMeta._defaultrevmapclass is maps.RevMap
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
40 svnmeta.SVNMeta._defaultrevmapclass = maps.SqliteRevMap
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
41 super(SqliteRevMapMixIn, self).setUp()
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
42
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
43 def tearDown(self):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
44 assert svnmeta.SVNMeta._defaultrevmapclass is maps.SqliteRevMap
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
45 svnmeta.SVNMeta._defaultrevmapclass = maps.RevMap
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
46 super(SqliteRevMapMixIn, self).tearDown()
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
47
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
48 def shortDescription(self):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
49 text = super(SqliteRevMapMixIn, self).shortDescription()
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
50 if text:
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
51 text += ' (sqlite revmap)'
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
52 return text
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
53
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
54 def buildtestclass(cls, selector=None):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
55 name = 'SqliteRevMap%s' % cls.__name__
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
56 newcls = type(name, (SqliteRevMapMixIn, cls,), {})
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
57
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
58 # remove test cases not selected by selector
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
59 if selector:
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
60 for name in dir(newcls):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
61 if name.startswith('test_') and not selector(name[5:]):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
62 setattr(newcls, name, None)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
63
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
64 globals()[name] = newcls
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
65
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
66 def svndumpselector(name):
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
67 return name in ['branch_rename_to_trunk',
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
68 'tag_name_same_as_branch']
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
69
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
70 buildtestclass(test_fetch_mappings.MapTests)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
71 buildtestclass(test_fetch_renames.TestFetchRenames)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
72 buildtestclass(test_pull.TestPull)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
73 buildtestclass(test_template_keywords.TestLogKeywords)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
74 buildtestclass(test_utility_commands.UtilityTests)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
75
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
76 buildtestclass(test_rebuildmeta.RebuildMetaTests, svndumpselector)
f21605bcda24 tests: add the sqlite revmap test
Jun Wu <quark@fb.com>
parents:
diff changeset
77 buildtestclass(test_updatemeta.UpdateMetaTests, svndumpselector)