changeset 1044:d741f536f23a

tests: remove old test-loading infrastructure (for those in the know, this is known as a suitectomy)
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 07 Aug 2013 16:00:52 +0200
parents 69a9fb45cad5
children 67e11b650e94
files tests/comprehensive/test_rebuildmeta.py tests/comprehensive/test_stupid_pull.py tests/comprehensive/test_updatemeta.py tests/comprehensive/test_verify_and_startrev.py tests/test_binaryfiles.py tests/test_diff.py tests/test_externals.py tests/test_fetch_branches.py tests/test_fetch_command.py tests/test_fetch_command_regexes.py tests/test_fetch_exec.py tests/test_fetch_mappings.py tests/test_fetch_renames.py tests/test_fetch_symlinks.py tests/test_fetch_truncated.py tests/test_helpers.py tests/test_hooks.py tests/test_pull.py tests/test_pull_fallback.py tests/test_push_autoprops.py tests/test_push_command.py tests/test_push_dirs.py tests/test_push_eol.py tests/test_push_renames.py tests/test_single_dir_clone.py tests/test_svn_pre_commit_hooks.py tests/test_svnwrap.py tests/test_tags.py tests/test_template_keywords.py tests/test_unaffected_core.py tests/test_urls.py tests/test_utility_commands.py
diffstat 32 files changed, 2 insertions(+), 161 deletions(-) [+]
line wrap: on
line diff
--- a/tests/comprehensive/test_rebuildmeta.py
+++ b/tests/comprehensive/test_rebuildmeta.py
@@ -169,9 +169,3 @@ for case in [f for f in os.listdir(test_
     attrs[name] = buildmethod(case, name, False, True)
 
 RebuildMetaTests = type('RebuildMetaTests', (test_util.TestBase,), attrs)
-
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(RebuildMetaTests),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/comprehensive/test_stupid_pull.py
+++ b/tests/comprehensive/test_stupid_pull.py
@@ -56,9 +56,3 @@ for case in (f for f in os.listdir(test_
     attrs[name] = buildmethod(case, name, 'single')
 
 StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs)
-
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(StupidPullTests),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/comprehensive/test_updatemeta.py
+++ b/tests/comprehensive/test_updatemeta.py
@@ -80,9 +80,3 @@ for case in [f for f in os.listdir(test_
     attrs[name] = test_rebuildmeta.buildmethod(case, name, False, True)
 
 UpdateMetaTests = type('UpdateMetaTests', (test_util.TestBase,), attrs)
-
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(UpdateMetaTests),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/comprehensive/test_verify_and_startrev.py
+++ b/tests/comprehensive/test_verify_and_startrev.py
@@ -110,7 +110,3 @@ for case in fixtures:
     # attrs[name] = buildmethod(case, name, True, 'single')
 
 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_binaryfiles.py
+++ b/tests/test_binaryfiles.py
@@ -9,8 +9,3 @@ class TestFetchBinaryFiles(test_util.Tes
 
     def test_binaryfiles_stupid(self):
         self.test_binaryfiles(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBinaryFiles),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_diff.py
+++ b/tests/test_diff.py
@@ -35,9 +35,3 @@ class DiffTests(test_util.TestBase):
         u.pushbuffer()
         wrappers.diff(lambda x, y, z: None, u, self.repo, svn=True)
         self.assertEqual(u.popbuffer(), expected_diff_output)
-
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(DiffTests),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_externals.py
+++ b/tests/test_externals.py
@@ -402,9 +402,3 @@ HEAD subdir1/deps/project1
         self.commitchanges(changes)
         self.pushrevisions(stupid)
         self.assertchanges(changes, self.repo['tip'])
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals),
-           unittest.TestLoader().loadTestsFromTestCase(TestPushExternals),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -161,8 +161,3 @@ class TestFetchBranches(test_util.TestBa
 
     def test_replace_branch_with_branch_stupid(self, stupid=False):
         self.test_replace_branch_with_branch(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_fetch_command.py
+++ b/tests/test_fetch_command.py
@@ -285,9 +285,3 @@ o  changeset: 0:02996a5980ba
 
     def test_fetch_movetotrunk_stupid(self):
         self.test_fetch_movetotrunk(stupid=True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout),
-           unittest.TestLoader().loadTestsFromTestCase(TestStupidPull),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_fetch_command_regexes.py
+++ b/tests/test_fetch_command_regexes.py
@@ -1,5 +1,7 @@
 import unittest
 
+import test_util
+
 from hgsubversion import stupid
 
 
@@ -141,6 +143,3 @@ Added: svn:executable
         changed = stupid.parsediff(data)
         self.assertEqual(['empty1', 'empty2', 'binary1', 'text1', 'binary2', 'text2'],
                          [f.name for f in changed])
-
-def suite():
-    return unittest.TestLoader().loadTestsFromTestCase(RegexTests)
--- a/tests/test_fetch_exec.py
+++ b/tests/test_fetch_exec.py
@@ -28,8 +28,3 @@ class TestFetchExec(test_util.TestBase):
 
     def test_empty_prop_val_executable_stupid(self):
         self.test_empty_prop_val_executable(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExec),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_fetch_mappings.py
+++ b/tests/test_fetch_mappings.py
@@ -368,6 +368,3 @@ class MapTests(test_util.TestBase):
 
     def test_empty_log_message_stupid(self):
         self.test_empty_log_message(True)
-
-def suite():
-    return unittest.TestLoader().loadTestsFromTestCase(MapTests)
--- a/tests/test_fetch_renames.py
+++ b/tests/test_fetch_renames.py
@@ -76,8 +76,3 @@ class TestFetchRenames(test_util.TestBas
 
     def test_case_stupid(self):
         self._test_case(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchRenames),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_fetch_symlinks.py
+++ b/tests/test_fetch_symlinks.py
@@ -57,10 +57,3 @@ class TestMergeSpecial(test_util.TestBas
         ctx = repo['tip']
         self.assertEqual(ctx['fnord'].flags(), 'l')
         self.assertEqual(ctx['exe'].flags(), 'x')
-
-def suite():
-    all_tests = [
-        unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks),
-        unittest.TestLoader().loadTestsFromTestCase(TestMergeSpecial),
-        ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_fetch_truncated.py
+++ b/tests/test_fetch_truncated.py
@@ -29,8 +29,3 @@ class TestFetchTruncatedHistory(test_uti
 
     def test_truncated_history_stupid(self):
         self.test_truncated_history(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchTruncatedHistory),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -30,8 +30,3 @@ class TestHelpers(unittest.TestCase):
         fs.popfile('bb')
         self.assertEqual([], os.listdir(fs._tempdir))
         self.assertRaises(editor.EditingError, lambda: fs.getfile('bb'))
-
-def suite():
-    return unittest.TestSuite([
-        unittest.TestLoader().loadTestsFromTestCase(TestHelpers),
-        ])
--- a/tests/test_hooks.py
+++ b/tests/test_hooks.py
@@ -43,6 +43,3 @@ class TestHooks(test_util.TestBase):
         commands.pull(newrepo.ui, newrepo)
         hgsubversion.svncommands.updatemeta = oldupdatemeta
         self.assertTrue(self.called)
-
-def suite():
-    return unittest.findTestCases(sys.modules[__name__])
--- a/tests/test_pull.py
+++ b/tests/test_pull.py
@@ -79,7 +79,3 @@ class TestPull(test_util.TestBase):
         tip = repo['tip'].rev()
         self.assertEqual(tip, 1)
         self.assertEquals(verify.verify(repo.ui, repo, rev=tip), 0)
-
-def suite():
-    import unittest, sys
-    return unittest.findTestCases(sys.modules[__name__])
--- a/tests/test_pull_fallback.py
+++ b/tests/test_pull_fallback.py
@@ -100,7 +100,3 @@ def _monkey_unpatch(to_patch, start=None
 
 def _patchbackend_raise(*p, **kw):
     raise mercurial.patch.PatchError("patch failed")
-
-def suite():
-    import unittest, sys
-    return unittest.findTestCases(sys.modules[__name__])
--- a/tests/test_push_autoprops.py
+++ b/tests/test_push_autoprops.py
@@ -100,8 +100,3 @@ class ParseAutoPropsTests(test_util.Test
             'svn:eol-style': 'native',
             'svn:executable': 'true'},
             props)
-
-
-def suite():
-    return unittest.findTestCases(sys.modules[__name__])
-
--- a/tests/test_push_command.py
+++ b/tests/test_push_command.py
@@ -679,16 +679,3 @@ class PushTests(test_util.TestBase):
         self.assertEqual(tip['adding_file'].data(), 'fooFirstFile')
         self.assertEqual(tip['newdir/new_file'].data(), 'fooNewFile')
         self.assertEqual(tip.branch(), 'default')
-
-
-def suite():
-    test_classes = [PushTests, ]
-    all_tests = []
-    # This is the quickest hack I could come up with to load all the tests from
-    # both classes. Would love a patch that simplifies this without adding
-    # dependencies.
-    for tc in test_classes:
-        for attr in dir(tc):
-            if attr.startswith('test_'):
-                all_tests.append(tc(attr))
-    return unittest.TestSuite(all_tests)
--- a/tests/test_push_dirs.py
+++ b/tests/test_push_dirs.py
@@ -103,8 +103,3 @@ class TestPushDirectories(test_util.Test
                           'tag_r3/alpha',
                           'tag_r3/beta',
                           'tag_r3/new'])
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_push_eol.py
+++ b/tests/test_push_eol.py
@@ -33,8 +33,3 @@ class TestPushEol(test_util.TestBase):
 
     def test_push_dirs_stupid(self):
         self._test_push_dirs(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestPushEol),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_push_renames.py
+++ b/tests/test_push_renames.py
@@ -113,9 +113,3 @@ class TestPushRenames(test_util.TestBase
             'This failure means rename of an entire tree is broken.'
             ' There is a print on the preceding line commented out '
             'that should help you.')
-
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestPushRenames),
-          ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_single_dir_clone.py
+++ b/tests/test_single_dir_clone.py
@@ -274,7 +274,3 @@ class TestSingleDir(test_util.TestBase):
     @test_util.requiresoption('branch')
     def test_push_single_dir_renamed_branch_stupid(self):
         self.test_push_single_dir_renamed_branch(True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestSingleDir)]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_svn_pre_commit_hooks.py
+++ b/tests/test_svn_pre_commit_hooks.py
@@ -29,6 +29,3 @@ class TestSvnPreCommitHooks(test_util.Te
                    ]
         self.commitchanges(changes)
         self.assertRaises(util.Abort, self.pushrevisions)
-
-def suite():
-    return unittest.findTestCases(sys.modules[__name__])
--- a/tests/test_svnwrap.py
+++ b/tests/test_svnwrap.py
@@ -57,8 +57,3 @@ class TestRootAsSubdirOfRepo(TestBasicRe
         self.repo = svnwrap.SubversionRepo(test_util.fileurl(
             self.repo_path + '/dummyproj'
         ))
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout),
-           unittest.TestLoader().loadTestsFromTestCase(TestRootAsSubdirOfRepo)]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -275,7 +275,3 @@ Fix tag pt 2.
 
     def test_tagging_into_tag_stupid(self):
         self.test_tagging_into_tag(True)
-
-
-def suite():
-    return unittest.TestLoader().loadTestsFromTestCase(TestTags)
--- a/tests/test_template_keywords.py
+++ b/tests/test_template_keywords.py
@@ -80,7 +80,3 @@ class TestLogKeywords(test_util.TestBase
         self.assertRaises(error.ParseError,
                           commands.log, self.ui(), repo,
                           template='{rev}:{svnrev} ', **defaults)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords), ]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_unaffected_core.py
+++ b/tests/test_unaffected_core.py
@@ -86,7 +86,3 @@ class TestMercurialCore(test_util.TestBa
         repo2 = hg.repository(ui, self.wc_path + '2')
 
         self.assertEqual(repo[branch].hex(), repo2['.'].hex())
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestMercurialCore)]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_urls.py
+++ b/tests/test_urls.py
@@ -72,7 +72,3 @@ class TestSubversionUrls(test_util.TestB
         repo1 = svnrepo.svnremoterepo(ui, repo_url + subdir)
         repo2 = svnrepo.svnremoterepo(ui, repo_url + quoted_subdir)
         self.assertEqual(repo1.svnurl, repo2.svnurl)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestSubversionUrls)]
-    return unittest.TestSuite(all_tests)
--- a/tests/test_utility_commands.py
+++ b/tests/test_utility_commands.py
@@ -341,8 +341,3 @@ missing file: binary3
         # rebuildmeta --unsafe-skip-uuid-check with unrelated repo
         svncommands.rebuildmeta(self.ui(), repo=self.repo, args=[otherurl],
                                 unsafe_skip_uuid_check=True)
-
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),
-          ]
-    return unittest.TestSuite(all_tests)