diff tests/test_fetch_command.py @ 1106:5cb6c95e0283 stable

Merge default and stable so I can do stable releases again.
author Augie Fackler <raf@durin42.com>
date Tue, 11 Feb 2014 12:48:49 -0500
parents ca36d5915dc7
children 86ae03f889a4
line wrap: on
line diff
--- a/tests/test_fetch_command.py
+++ b/tests/test_fetch_command.py
@@ -11,6 +11,7 @@ from mercurial import ui
 from mercurial import encoding
 
 class TestBasicRepoLayout(test_util.TestBase):
+    stupid_mode_tests = True
 
     def test_no_dates(self):
         repo = self._load_fixture_and_fetch('test_no_dates.svndump')
@@ -62,17 +63,9 @@ class TestBasicRepoLayout(test_util.Test
         self.assertEqual(repo['tip'], repo['default'])
         self.assertEqual(len(repo.heads()), 2)
 
-    def test_many_special_cases_replay(self):
+    def test_many_special_cases(self):
         repo = self._load_fixture_and_fetch('many_special_cases.svndump')
-        self._many_special_cases_checks(repo)
 
-
-    def test_many_special_cases_diff(self):
-        repo = self._load_fixture_and_fetch('many_special_cases.svndump',
-                                            stupid=True)
-        self._many_special_cases_checks(repo)
-
-    def _many_special_cases_checks(self, repo):
         self.assertEquals(node.hex(repo[0].node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
         # two possible hashes for bw compat to hg < 1.5, since hg 1.5
@@ -95,15 +88,12 @@ class TestBasicRepoLayout(test_util.Test
         assert 'README' not in repo
         assert '../branches' not in repo
 
-    def test_files_copied_from_outside_btt(self, stupid=False):
+    def test_files_copied_from_outside_btt(self):
         repo = self._load_fixture_and_fetch(
-            'test_files_copied_from_outside_btt.svndump', stupid=stupid)
+            'test_files_copied_from_outside_btt.svndump')
         self.assertEqual(node.hex(repo['tip'].node()),
                          '3c78170e30ddd35f2c32faa0d8646ab75bba4f73')
-        self.assertEqual(len(repo.changelog), 2)
-
-    def test_files_copied_from_outside_btt_stupid(self):
-        self.test_files_copied_from_outside_btt(stupid=True)
+        self.assertEqual(test_util.repolen(repo.changelog), 2)
 
     def test_file_renamed_in_from_outside_btt(self):
         repo = self._load_fixture_and_fetch(
@@ -130,32 +120,21 @@ class TestBasicRepoLayout(test_util.Test
         self.assertEqual(node.hex(repo['tip'].node()),
                          '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
 
-    def test_propedit_with_nothing_else(self, stupid=False):
-        repo = self._load_fixture_and_fetch('branch_prop_edit.svndump',
-                                            stupid=stupid)
+    def test_propedit_with_nothing_else(self):
+        repo = self._load_fixture_and_fetch('branch_prop_edit.svndump')
         self.assertEqual(repo['tip'].description(), 'Commit bogus propchange.')
         self.assertEqual(repo['tip'].branch(), 'dev_branch')
 
-    def test_propedit_with_nothing_else_stupid(self):
-        self.test_propedit_with_nothing_else(stupid=True)
-
-    def test_entry_deletion(self, stupid=False):
-        repo = self._load_fixture_and_fetch('delentries.svndump',
-                                            stupid=stupid)
+    def test_entry_deletion(self):
+        repo = self._load_fixture_and_fetch('delentries.svndump')
         files = list(sorted(repo['tip'].manifest()))
         self.assertEqual(['aa', 'd1/c', 'd1/d2prefix'], files)
 
-    def test_entry_deletion_stupid(self):
-        self.test_entry_deletion(stupid=True)
-
-    def test_fetch_when_trunk_has_no_files(self, stupid=False):
-        repo = self._load_fixture_and_fetch('file_not_in_trunk_root.svndump', stupid=stupid)
+    def test_fetch_when_trunk_has_no_files(self):
+        repo = self._load_fixture_and_fetch('file_not_in_trunk_root.svndump')
         self.assertEqual(repo['tip'].branch(), 'default')
 
-    def test_fetch_when_trunk_has_no_files_stupid(self):
-        self.test_fetch_when_trunk_has_no_files(stupid=True)
-
-    def test_path_quoting(self, stupid=False):
+    def test_path_quoting(self):
         repo_path = self.load_svndump('non_ascii_path_1.svndump')
         subdir = '/b\xC3\xB8b'
         quoted_subdir = urllib.quote(subdir)
@@ -164,7 +143,7 @@ class TestBasicRepoLayout(test_util.Test
         wc_path = self.wc_path
         wc2_path = wc_path + '-2'
 
-        ui = self.ui(stupid=stupid)
+        ui = self.ui()
 
         commands.clone(ui, repo_url + subdir, wc_path)
         commands.clone(ui, repo_url + quoted_subdir, wc2_path)
@@ -173,15 +152,11 @@ class TestBasicRepoLayout(test_util.Test
 
         self.assertEqual(repo['tip'].extra()['convert_revision'],
                          repo2['tip'].extra()['convert_revision'])
-        self.assertEqual(len(repo), len(repo2))
+        self.assertEqual(test_util.repolen(repo), test_util.repolen(repo2))
 
         for r in repo:
             self.assertEqual(repo[r].hex(), repo2[r].hex())
 
-    def test_path_quoting_stupid(self):
-        repo = self.test_path_quoting(True)
-
-
     def test_identical_fixtures(self):
         '''ensure that the non_ascii_path_N fixtures are identical'''
         fixturepaths = [
@@ -200,8 +175,10 @@ class TestBasicRepoLayout(test_util.Test
 
 
 class TestStupidPull(test_util.TestBase):
+    stupid_mode_tests = True
+
     def test_stupid(self):
-        repo = self._load_fixture_and_fetch('two_heads.svndump', stupid=True)
+        repo = self._load_fixture_and_fetch('two_heads.svndump')
         self.assertEqual(node.hex(repo[0].node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
         self.assertEqual(node.hex(repo['tip'].node()),
@@ -220,8 +197,7 @@ class TestStupidPull(test_util.TestBase)
 
     def test_oldest_not_trunk_and_tag_vendor_branch(self):
         repo = self._load_fixture_and_fetch(
-            'tagged_vendor_and_oldest_not_trunk.svndump',
-            stupid=True)
+            'tagged_vendor_and_oldest_not_trunk.svndump')
         self.assertEqual(node.hex(repo['oldest'].node()),
                          '926671740dec045077ab20f110c1595f935334fa')
         self.assertEqual(repo['tip'].parents()[0].parents()[0],
@@ -229,65 +205,53 @@ class TestStupidPull(test_util.TestBase)
         self.assertEqual(node.hex(repo['tip'].node()),
                          '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
 
-    def test_empty_repo(self, stupid=False):
+    def test_empty_repo(self):
         # This used to crash HgEditor because it could be closed without
         # having been initialized again.
-        self._load_fixture_and_fetch('emptyrepo2.svndump', stupid=stupid)
-
-    def test_empty_repo_stupid(self):
-        self.test_empty_repo(stupid=True)
+        self._load_fixture_and_fetch('emptyrepo2.svndump')
 
-    def test_fetch_revert(self, stupid=False):
-        repo = self._load_fixture_and_fetch('revert.svndump', stupid=stupid)
+    def test_fetch_revert(self):
+        repo = self._load_fixture_and_fetch('revert.svndump')
         graph = self.getgraph(repo)
         refgraph = """\
-o  changeset: 3:937dcd1206d4
+o  changeset: 3:937dcd1206d4 (r4)
 |  branch:
 |  tags:      tip
 |  summary:   revert2
 |  files:     a dir/b
 |
-o  changeset: 2:9317a748b7c3
+o  changeset: 2:9317a748b7c3 (r3)
 |  branch:
 |  tags:
 |  summary:   revert
 |  files:     a dir/b
 |
-o  changeset: 1:243259a4138a
+o  changeset: 1:243259a4138a (r2)
 |  branch:
 |  tags:
 |  summary:   changefiles
 |  files:     a dir/b
 |
-o  changeset: 0:ab86791fc857
+o  changeset: 0:ab86791fc857 (r1)
    branch:
    tags:
    summary:   init
    files:     a dir/b
-"""
-        self.assertEqual(refgraph.strip(), graph.strip())
 
-    def test_fetch_revert_stupid(self):
-        self.test_fetch_revert(stupid=True)
+"""
+        self.assertMultiLineEqual(refgraph, graph)
 
-    def test_fetch_movetotrunk(self, stupid=False):
+    def test_fetch_movetotrunk(self):
         repo = self._load_fixture_and_fetch('movetotrunk.svndump',
-                stupid=stupid, subdir='sub1/sub2')
+                subdir='sub1/sub2')
         graph = self.getgraph(repo)
         refgraph = """\
-o  changeset: 0:02996a5980ba
+o  changeset: 0:02996a5980ba (r3)
    branch:
    tags:      tip
    summary:   move to trunk
    files:     a dir/b
-"""
-        self.assertEqual(refgraph.strip(), graph.strip())
 
-    def test_fetch_movetotrunk_stupid(self):
-        self.test_fetch_movetotrunk(stupid=True)
+"""
+        self.assertMultiLineEqual(refgraph, graph)
 
-def suite():
-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout),
-           unittest.TestLoader().loadTestsFromTestCase(TestStupidPull),
-          ]
-    return unittest.TestSuite(all_tests)