changeset 1061:b8142bbf6656

test_fetch_branches: use stupid mode metaclass
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 09 Aug 2013 23:45:54 +0200
parents 7d82131e7801
children 36a5fa6420a0
files tests/test_fetch_branches.py
diffstat 1 files changed, 23 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -7,6 +7,8 @@ from mercurial import hg
 from mercurial import node
 
 class TestFetchBranches(test_util.TestBase):
+    stupid_mode_tests = True
+
     def _load_fixture_and_fetch_with_anchor(self, fixture_name, anchor):
         repo_path = self.load_svndump(fixture_name)
         source = '%s#%s' % (test_util.fileurl(repo_path), anchor)
@@ -24,43 +26,31 @@ class TestFetchBranches(test_util.TestBa
     def openbranches(self, repo):
         return self.branches(repo)[0]
 
-    def test_rename_branch_parent(self, stupid=False):
-        repo = self._load_fixture_and_fetch('rename_branch_parent_dir.svndump',
-                                            stupid=stupid)
+    def test_rename_branch_parent(self):
+        repo = self._load_fixture_and_fetch('rename_branch_parent_dir.svndump')
         heads = [repo[n] for n in repo.heads()]
         heads = dict([(ctx.branch(), ctx) for ctx in heads])
         # Let these tests disabled yet as the fix is not obvious
         self.assertEqual(['dev_branch'], self.openbranches(repo))
 
-    def test_rename_branch_parent_stupid(self):
-        self.test_rename_branch_parent(stupid=True)
-
-    def test_unrelatedbranch(self, stupid=False):
-        repo = self._load_fixture_and_fetch('unrelatedbranch.svndump',
-                                            stupid=stupid)
+    def test_unrelatedbranch(self):
+        repo = self._load_fixture_and_fetch('unrelatedbranch.svndump')
         heads = [repo[n] for n in repo.heads()]
         heads = dict([(ctx.branch(), ctx) for ctx in heads])
         # Let these tests disabled yet as the fix is not obvious
         self.assertEqual(heads['branch1'].manifest().keys(), ['b'])
         self.assertEqual(heads['branch2'].manifest().keys(), ['a', 'b'])
 
-    def test_unrelatedbranch_stupid(self):
-        self.test_unrelatedbranch(True)
-
-    def test_unorderedbranch(self, stupid=False):
-        repo = self._load_fixture_and_fetch('unorderedbranch.svndump',
-                                            stupid=stupid)
+    def test_unorderedbranch(self):
+        repo = self._load_fixture_and_fetch('unorderedbranch.svndump')
         r = repo['branch']
         self.assertEqual(0, r.parents()[0].rev())
         self.assertEqual(['a', 'c', 'z'], sorted(r.manifest()))
 
-    def test_unorderedbranch_stupid(self):
-        self.test_unorderedbranch(True)
-
-    def test_renamed_branch_to_trunk(self, stupid=False):
+    def test_renamed_branch_to_trunk(self):
         config = {'hgsubversion.failonmissing': 'true'}
         repo = self._load_fixture_and_fetch('branch_rename_to_trunk.svndump',
-                                            stupid=stupid, config=config)
+                                            config=config)
         self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch')
         self.assert_('iota' in repo['default'])
         self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default')
@@ -68,45 +58,30 @@ class TestFetchBranches(test_util.TestBa
         expected = ['default', 'old_trunk']
         self.assertEqual(self.openbranches(repo), expected)
 
-    def test_renamed_branch_to_trunk_stupid(self):
-        self.test_renamed_branch_to_trunk(stupid=True)
-
-    def test_replace_trunk_with_branch(self, stupid=False):
-        repo = self._load_fixture_and_fetch('replace_trunk_with_branch.svndump',
-                                            stupid=stupid)
+    def test_replace_trunk_with_branch(self):
+        repo = self._load_fixture_and_fetch('replace_trunk_with_branch.svndump')
         self.assertEqual(repo['default'].parents()[0].branch(), 'test')
         self.assertEqual(repo['tip'].branch(), 'default')
         self.assertEqual(repo['tip'].extra().get('close'), '1')
         self.assertEqual(self.openbranches(repo), ['default'])
 
-    def test_copybeforeclose(self, stupid=False):
-        repo = self._load_fixture_and_fetch('copybeforeclose.svndump',
-                                            stupid=stupid)
+    def test_copybeforeclose(self):
+        repo = self._load_fixture_and_fetch('copybeforeclose.svndump')
         self.assertEqual(repo['tip'].branch(), 'test')
         self.assertEqual(repo['test'].extra().get('close'), '1')
         self.assertEqual(repo['test']['b'].data(), 'a\n')
 
-    def test_copybeforeclose_stupid(self):
-        self.test_copybeforeclose(True)
-
-    def test_replace_trunk_with_branch_stupid(self):
-        self.test_replace_trunk_with_branch(stupid=True)
-
-    def test_branch_create_with_dir_delete_works(self, stupid=False):
-        repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump',
-                                            stupid=stupid)
+    def test_branch_create_with_dir_delete_works(self):
+        repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump')
         self.assertEqual(repo['tip'].manifest().keys(),
                          ['alpha', 'beta', 'iota', 'gamma', ])
 
-    def test_branch_tip_update_to_default(self, stupid=False):
+    def test_branch_tip_update_to_default(self):
         repo = self._load_fixture_and_fetch('unorderedbranch.svndump',
-                                            stupid=stupid, noupdate=False)
+                                            noupdate=False)
         self.assertEqual(repo[None].branch(), 'default')
         self.assertTrue('tip' not in repo[None].tags())
 
-    def test_branch_tip_update_to_default_stupid(self):
-        self.test_branch_tip_update_to_default(True)
-
     def test_branch_pull_anchor(self):
         self.assertRaises(error.RepoLookupError,
                           self._load_fixture_and_fetch_with_anchor,
@@ -115,9 +90,8 @@ class TestFetchBranches(test_util.TestBa
             'unorderedbranch.svndump', '4')
         self.assertTrue('c' not in repo.branchtags())
 
-    def test_branches_weird_moves(self, stupid=False):
+    def test_branches_weird_moves(self):
         repo = self._load_fixture_and_fetch('renamedproject.svndump',
-                                            stupid=stupid,
                                             subdir='project')
         heads = [repo[n] for n in repo.heads()]
         heads = dict((ctx.branch(), ctx) for ctx in heads)
@@ -126,20 +100,15 @@ class TestFetchBranches(test_util.TestBa
         self.assertEqual(mdefault, ['a', 'b', 'd/a'])
         self.assertEqual(mbranch, ['a'])
 
-    def test_branches_weird_moves_stupid(self):
-        self.test_branches_weird_moves(True)
-
-    def test_branch_delete_parent_dir(self, stupid=False):
-        repo = self._load_fixture_and_fetch('branch_delete_parent_dir.svndump',
-                                            stupid=stupid)
+    def test_branch_delete_parent_dir(self):
+        repo = self._load_fixture_and_fetch('branch_delete_parent_dir.svndump')
         openb, closedb = self.branches(repo)
         self.assertEqual(openb, [])
         self.assertEqual(closedb, ['dev_branch'])
         self.assertEqual(list(repo['dev_branch']), ['foo'])
 
-    def test_replace_branch_with_branch(self, stupid=False):
-        repo = self._load_fixture_and_fetch('replace_branch_with_branch.svndump',
-                                            stupid=stupid)
+    def test_replace_branch_with_branch(self):
+        repo = self._load_fixture_and_fetch('replace_branch_with_branch.svndump')
         self.assertEqual(7, test_util.repolen(repo))
         # tip is former topological branch1 being closed
         ctx = repo['tip']
@@ -159,5 +128,3 @@ class TestFetchBranches(test_util.TestBa
         for f in ctx:
             self.assertTrue(not ctx[f].renamed())
 
-    def test_replace_branch_with_branch_stupid(self, stupid=False):
-        self.test_replace_branch_with_branch(True)