瀏覽代碼

Drop support for testtools, instead depend on python >= 2.7 or unittest2.

Jelmer Vernooij 13 年之前
父節點
當前提交
bb2a51f74d

+ 0 - 5
HACKING

@@ -23,8 +23,3 @@ will run the tests using unittest on Python 2.7 and higher, and using
 unittest2 (which you will need to have installed) on older versions of Python.
 
  $ make check
-
-Alternatively, if you have testtools installed you can run the testsuite by
-overriding the test runner:
-
- $ make check TESTRUNNER=testtools.run

+ 5 - 0
NEWS

@@ -6,6 +6,11 @@
 
   * New ``Repo.clone`` method. (Jelmer Vernooij, #725369)
 
+ CHANGES
+
+  * unittest2 or python >= 2.7 is now required for the testsuite.
+    testtools is no longer supported. (Jelmer Vernooij, #830713)
+
 0.8.0	2011-08-07
 
  FEATURES

+ 3 - 11
dulwich/tests/__init__.py

@@ -30,18 +30,10 @@ import tempfile
 if sys.version_info >= (2, 7):
     # If Python itself provides an exception, use that
     import unittest
-    from unittest import SkipTest as TestSkipped
-    from unittest import TestCase
+    from unittest import SkipTest, TestCase
 else:
-    try:
-        import unittest2 as unittest
-        from unittest2 import SkipTest as TestSkipped
-        from unittest2 import TestCase
-    except ImportError:
-        import unittest
-        from testtools.testcase import TestSkipped
-        from testtools.testcase import TestCase
-        TestCase.skipException = TestSkipped
+    import unittest2 as unittest
+    from unittest2 import SkipTest, TestCase
 
 
 class BlackboxTestCase(TestCase):

+ 3 - 3
dulwich/tests/compat/test_client.py

@@ -35,7 +35,7 @@ from dulwich import (
     repo,
     )
 from dulwich.tests import (
-    TestSkipped,
+    SkipTest,
     )
 
 from dulwich.tests.compat.utils import (
@@ -175,7 +175,7 @@ class DulwichTCPClientTest(CompatTestCase, DulwichClientTestBase):
         CompatTestCase.setUp(self)
         DulwichClientTestBase.setUp(self)
         if check_for_daemon(limit=1):
-            raise TestSkipped('git-daemon was already running on port %s' %
+            raise SkipTest('git-daemon was already running on port %s' %
                               protocol.TCP_GIT_PORT)
         fd, self.pidfile = tempfile.mkstemp(prefix='dulwich-test-git-client',
                                             suffix=".pid")
@@ -186,7 +186,7 @@ class DulwichTCPClientTest(CompatTestCase, DulwichClientTestBase):
              '--detach', '--reuseaddr', '--enable=receive-pack',
              '--listen=localhost', self.gitroot], cwd=self.gitroot)
         if not check_for_daemon():
-            raise TestSkipped('git-daemon failed to start')
+            raise SkipTest('git-daemon failed to start')
 
     def tearDown(self):
         try:

+ 5 - 5
dulwich/tests/compat/test_utils.py

@@ -20,8 +20,8 @@
 """Tests for git compatibility utilities."""
 
 from dulwich.tests import (
+    SkipTest,
     TestCase,
-    TestSkipped,
     )
 from dulwich.tests.compat import utils
 
@@ -61,11 +61,11 @@ class GitVersionTests(TestCase):
     def assertRequireSucceeds(self, required_version):
         try:
             utils.require_git_version(required_version)
-        except TestSkipped:
+        except SkipTest:
             self.fail()
 
     def assertRequireFails(self, required_version):
-        self.assertRaises(TestSkipped, utils.require_git_version,
+        self.assertRaises(SkipTest, utils.require_git_version,
                           required_version)
 
     def test_require_git_version(self):
@@ -87,6 +87,6 @@ class GitVersionTests(TestCase):
             self.assertRequireSucceeds((1, 7, 0, 2))
             self.assertRequireFails((1, 7, 0, 3))
             self.assertRequireFails((1, 7, 1))
-        except TestSkipped, e:
-            # This test is designed to catch all TestSkipped exceptions.
+        except SkipTest, e:
+            # This test is designed to catch all SkipTest exceptions.
             self.fail('Test unexpectedly skipped: %s' % e)

+ 2 - 2
dulwich/tests/compat/test_web.py

@@ -31,7 +31,7 @@ from dulwich.server import (
     DictBackend,
     )
 from dulwich.tests import (
-    TestSkipped,
+    SkipTest,
     )
 from dulwich.web import (
     HTTPGitApplication,
@@ -144,4 +144,4 @@ class DumbWebTestCase(WebTests, CompatTestCase):
 
     def test_push_to_dulwich(self):
         # Note: remove this if dumb pushing is supported
-        raise TestSkipped('Dumb web pushing not supported.')
+        raise SkipTest('Dumb web pushing not supported.')

+ 6 - 6
dulwich/tests/compat/utils.py

@@ -30,8 +30,8 @@ from dulwich.repo import Repo
 from dulwich.protocol import TCP_GIT_PORT
 
 from dulwich.tests import (
+    SkipTest,
     TestCase,
-    TestSkipped,
     )
 
 _DEFAULT_GIT = 'git'
@@ -77,12 +77,12 @@ def require_git_version(required_version, git_path=_DEFAULT_GIT):
     :param git_path: Path to the git executable; defaults to the version in
         the system path.
     :raise ValueError: if the required version tuple has too many parts.
-    :raise TestSkipped: if no suitable git version was found at the given path.
+    :raise SkipTest: if no suitable git version was found at the given path.
     """
     found_version = git_version(git_path=git_path)
     if found_version is None:
-        raise TestSkipped('Test requires git >= %s, but c git not found' %
-                         (required_version, ))
+        raise SkipTest('Test requires git >= %s, but c git not found' %
+                       (required_version, ))
 
     if len(required_version) > _VERSION_LEN:
         raise ValueError('Invalid version tuple %s, expected %i parts' %
@@ -96,8 +96,8 @@ def require_git_version(required_version, git_path=_DEFAULT_GIT):
     if found_version < required_version:
         required_version = '.'.join(map(str, required_version))
         found_version = '.'.join(map(str, found_version))
-        raise TestSkipped('Test requires git >= %s, found %s' %
-                         (required_version, found_version))
+        raise SkipTest('Test requires git >= %s, found %s' %
+                       (required_version, found_version))
 
 
 def run_git(args, git_path=_DEFAULT_GIT, input=None, capture_stdout=False,

+ 3 - 3
dulwich/tests/test_fastexport.py

@@ -32,8 +32,8 @@ from dulwich.repo import (
     MemoryRepo,
     )
 from dulwich.tests import (
+    SkipTest,
     TestCase,
-    TestSkipped,
     )
 
 
@@ -47,7 +47,7 @@ class GitFastExporterTests(TestCase):
         try:
             from dulwich.fastexport import GitFastExporter
         except ImportError:
-            raise TestSkipped("python-fastimport not available")
+            raise SkipTest("python-fastimport not available")
         self.fastexporter = GitFastExporter(self.stream, self.store)
 
     def test_emit_blob(self):
@@ -93,7 +93,7 @@ class GitImportProcessorTests(TestCase):
         try:
             from dulwich.fastexport import GitImportProcessor
         except ImportError:
-            raise TestSkipped("python-fastimport not available")
+            raise SkipTest("python-fastimport not available")
         self.processor = GitImportProcessor(self.repo)
 
     def test_commit_handler(self):

+ 2 - 2
dulwich/tests/test_file.py

@@ -24,8 +24,8 @@ import tempfile
 
 from dulwich.file import GitFile, fancy_rename
 from dulwich.tests import (
+    SkipTest,
     TestCase,
-    TestSkipped,
     )
 
 
@@ -70,7 +70,7 @@ class FancyRenameTests(TestCase):
 
     def test_dest_opened(self):
         if sys.platform != "win32":
-            raise TestSkipped("platform allows overwriting open files")
+            raise SkipTest("platform allows overwriting open files")
         self.create(self.bar, 'bar contents')
         dest_f = open(self.bar, 'rb')
         self.assertRaises(OSError, fancy_rename, self.foo, self.bar)

+ 2 - 2
dulwich/tests/test_patch.py

@@ -37,8 +37,8 @@ from dulwich.patch import (
     write_tree_diff,
     )
 from dulwich.tests import (
+    SkipTest,
     TestCase,
-    TestSkipped,
     )
 
 
@@ -164,7 +164,7 @@ From: Jelmer Vernooy <jelmer@debian.org>
         self.assertEquals(None, version)
 
     def test_extract_mercurial(self):
-        raise TestSkipped("git_am_patch_split doesn't handle Mercurial patches properly yet")
+        raise SkipTest("git_am_patch_split doesn't handle Mercurial patches properly yet")
         expected_diff = """diff --git a/dulwich/tests/test_patch.py b/dulwich/tests/test_patch.py
 --- a/dulwich/tests/test_patch.py
 +++ b/dulwich/tests/test_patch.py

+ 3 - 3
dulwich/tests/utils.py

@@ -47,7 +47,7 @@ from dulwich.pack import (
     )
 from dulwich.repo import Repo
 from dulwich.tests import (
-    TestSkipped,
+    SkipTest,
     )
 
 # Plain files are very frequently used in tests, so let the mode be very short.
@@ -142,7 +142,7 @@ def ext_functest_builder(method, func):
 
     This is intended to generate test methods that test both a pure-Python
     version and an extension version using common test code. The extension test
-    will raise TestSkipped if the extension is not found.
+    will raise SkipTest if the extension is not found.
 
     Sample usage:
 
@@ -160,7 +160,7 @@ def ext_functest_builder(method, func):
 
     def do_test(self):
         if not isinstance(func, types.BuiltinFunctionType):
-            raise TestSkipped("%s extension not found", func.func_name)
+            raise SkipTest("%s extension not found", func.func_name)
         method(self, func)
 
     return do_test