Dan Villiom Podlaski Christiansen avatar Dan Villiom Podlaski Christiansen committed 7d82131

test_externals: use stupid mode metaclass

Comments (0)

Files changed (1)

tests/test_externals.py

 from hgsubversion import svnexternals
 
 class TestFetchExternals(test_util.TestBase):
+    stupid_mode_tests = True
+
     def test_externalsfile(self):
         f = svnexternals.externalsfile()
         f['t1'] = 'dir1 -r10 svn://foobar'
         for line, expected in samples:
             self.assertEqual(expected, svnexternals.parsedefinition(line))
 
-    def test_externals(self, stupid=False):
-        repo = self._load_fixture_and_fetch('externals.svndump', stupid=stupid)
+    def test_externals(self):
+        repo = self._load_fixture_and_fetch('externals.svndump')
 
         ref0 = """[.]
  ^/externals/project1 deps/project1
 """
         self.assertEqual(ref6, repo[6]['.hgsvnexternals'].data())
 
-    def test_externals_stupid(self):
-        self.test_externals(True)
-
     def test_updateexternals(self):
         def checkdeps(deps, nodeps, repo, rev=None):
             svnexternals.updateexternals(ui, [rev], repo)
                                 'unexpected: %s@%r' % (d, rev))
 
         ui = self.ui()
-        repo = self._load_fixture_and_fetch('externals.svndump', stupid=0)
+        repo = self._load_fixture_and_fetch('externals.svndump')
         commands.update(ui, repo)
         checkdeps(['deps/project1'], [], repo, 0)
         checkdeps(['deps/project1', 'deps/project2'], [], repo, 1)
                   ['subdir2/deps/project1'], repo, 3)
         checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4)
 
-    def test_hgsub(self, stupid=False):
+    def test_hgsub(self):
         if subrepo is None:
             return
         repo = self._load_fixture_and_fetch('externals.svndump',
-                                            externals='subrepos',
-                                            stupid=stupid)
+                                            externals='subrepos')
         self.assertEqual("""\
 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
 """, repo[0]['.hgsub'].data())
 2 deps/project2
 """, repo[6]['.hgsubstate'].data())
 
-    def test_hgsub_stupid(self):
-        self.test_hgsub(True)
-
     def test_ignore(self):
         repo = self._load_fixture_and_fetch('externals.svndump',
                                             externals='ignore')
 
         ui = self.ui()
         repo = self._load_fixture_and_fetch('externals.svndump',
-                                            stupid=0, externals='subrepos')
+                                            externals='subrepos')
         checkdeps(ui, repo, 0, ['deps/project1'], [])
         checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], [])
         checkdeps(ui, repo, 2, ['subdir/deps/project1', 'subdir2/deps/project1',
         repo.wwrite('subdir/deps/project1/a', 'foobar', '')
         commands.update(ui, repo, node='4', clean=True)
 
-    def test_mergeexternals(self, stupid=False):
+    def test_mergeexternals(self):
         if subrepo is None:
             return
         repo = self._load_fixture_and_fetch('mergeexternals.svndump',
-                                            externals='subrepos',
-                                            stupid=stupid)
+                                            externals='subrepos')
         # Check merged directories externals are fine
         self.assertEqual("""\
 d1/ext = [hgsubversion] d1:^/trunk/common/ext ext
 d3/ext3 = [hgsubversion] d3:^/trunk/common/ext ext3
 """, repo['tip']['.hgsub'].data())
 
-    def test_mergeexternals_stupid(self):
-        self.test_mergeexternals(True)
-
 class TestPushExternals(test_util.TestBase):
+    stupid_mode_tests = True
     obsolete_mode_tests = True
 
-    def test_push_externals(self, stupid=False):
+    def test_push_externals(self):
         repo = self._load_fixture_and_fetch('pushexternals.svndump')
         # Add a new reference on an existing and non-existing directory
         changes = [
             ('subdir2/a', 'subdir2/a', 'a'),
             ]
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
 
         # Remove all references from one directory, add a new one
             ('subdir1/a', None, None),
             ]
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
         # Check subdir2/a is still there even if the externals were removed
         self.assertTrue('subdir2/a' in self.repo['tip'])
             ('.hgsvnexternals', None, None),
             ]
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
 
-    def test_push_externals_stupid(self):
-        self.test_push_externals(True)
-
-    def test_push_hgsub(self, stupid=False):
+    def test_push_hgsub(self):
         if subrepo is None:
             return
 
         self.svnco(repo_path, 'externals/project1', '2', 'subdir1/deps/project1')
         self.svnco(repo_path, 'externals/project2', '2', 'subdir2/deps/project2')
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
 
         # Check .hgsub and .hgsubstate were not pushed
         self.svnco(repo_path, 'externals/project1', '2', 'subdir1/deps/project1')
         self.svnco(repo_path, 'externals/project2', '2', 'subdir1/deps/project2')
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
         # Check subdir2/a is still there even if the externals were removed
         self.assertTrue('subdir2/a' in self.repo['tip'])
 """),
             ]
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
 
         # Test externals removal
             ('.hgsubstate', None, None),
             ]
         self.commitchanges(changes)
-        self.pushrevisions(stupid)
+        self.pushrevisions()
         self.assertchanges(changes, self.repo['tip'])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.