Define common TestSkipped exception so it's easier to swap out later for
authorJelmer Vernooij <jelmer@samba.org>
Mon, 5 Apr 2010 19:52:49 +0000 (21:52 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 5 Apr 2010 19:52:49 +0000 (21:52 +0200)
something nose-specific.

dulwich/tests/__init__.py
dulwich/tests/compat/test_server.py
dulwich/tests/compat/test_web.py
dulwich/tests/compat/utils.py
dulwich/tests/test_objects.py

index e3330d6b9b5994381edfbcc2d02c12d3977373a3..4dadce411ed16725bd0e541ec67d19513a712d19 100644 (file)
 
 import unittest
 
+# XXX: Ideally we should allow other test runners as well, 
+# but unfortunately unittest doesn't have a SkipTest/TestSkipped
+# exception.
+from nose import SkipTest as TestSkipped
 
 def test_suite():
     names = [
index 1d2847ebf46aaee06614a2591a9f1efeb1b3cba0..2f58a9c95c08c52f1fc56aca73d46c16848b78be 100644 (file)
@@ -30,13 +30,15 @@ from dulwich.server import (
     DictBackend,
     TCPGitServer,
     )
+from dulwich.tests import (
+    TestSkipped,
+    )
 from server_utils import (
     ServerTests,
     ShutdownServerMixIn,
     )
 from utils import (
     CompatTestCase,
-    SkipTest,
     )
 
 
@@ -76,4 +78,4 @@ class GitServerTestCase(ServerTests, CompatTestCase):
         return port
 
     def test_push_to_dulwich(self):
-        raise SkipTest('Skipping push test due to known deadlock bug.')
+        raise TestSkipped('Skipping push test due to known deadlock bug.')
index 5a1c038c3a26bb1c8f6bbacdc17fc3853e074c5e..39c5dac77ea55d12eef22a86db3b48acb5c7737d 100644 (file)
@@ -30,6 +30,9 @@ from wsgiref import simple_server
 from dulwich.server import (
     DictBackend,
     )
+from dulwich.tests import (
+    TestSkipped,
+    )
 from dulwich.web import (
     HTTPGitApplication,
     )
@@ -40,7 +43,6 @@ from server_utils import (
     )
 from utils import (
     CompatTestCase,
-    SkipTest,
     )
 
 
@@ -96,7 +98,7 @@ class SmartWebTestCase(WebTests, CompatTestCase):
 
     def test_push_to_dulwich(self):
         # TODO(dborowitz): enable after merging thin pack fixes.
-        raise SkipTest('Skipping push test due to known pack bug.')
+        raise TestSkipped('Skipping push test due to known pack bug.')
 
 
 class DumbWebTestCase(WebTests, CompatTestCase):
@@ -115,4 +117,4 @@ class DumbWebTestCase(WebTests, CompatTestCase):
 
     def test_push_to_dulwich(self):
         # Note: remove this if dumb pushing is supported
-        raise SkipTest('Dumb web pushing not supported.')
+        raise TestSkipped('Dumb web pushing not supported.')
index baf4ec0fd095c824198e4cc6cfd2b7aec3b6d80a..8af6452d58d09f3bd897180ca53ac1740a9f86d3 100644 (file)
@@ -24,11 +24,11 @@ import subprocess
 import tempfile
 import unittest
 
-# XXX: Ideally we shouldn't depend on nose but allow other testrunners as well.
-from nose import SkipTest
-
 from dulwich.repo import Repo
 
+from dulwich.tests import (
+    TestSkipped,
+    )
 
 _DEFAULT_GIT = 'git'
 
@@ -67,8 +67,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 SkipTest('Test requires git >= %s, found %s' %
-                            (required_version, found_version))
+        raise TestSkipped('Test requires git >= %s, found %s' %
+                         (required_version, found_version))
 
 
 def run_git(args, git_path=_DEFAULT_GIT, input=None, capture_stdout=False,
index 17a40df8f79af39cd02404ff8166203159753877..63b7d7ee37544654a6a8a639056a4e0e02478b1f 100644 (file)
@@ -27,8 +27,6 @@ import os
 import stat
 import unittest
 
-import nose
-
 from dulwich.objects import (
     Blob,
     Tree,
@@ -40,6 +38,9 @@ from dulwich.objects import (
     parse_tree,
     _parse_tree_py,
     )
+from dulwich.tests import (
+    TestSkipped,
+    )
 
 a_sha = '6f670c0fb53f9463760b7295fbb814e965fb20c8'
 b_sha = '2969be3e8ee1c0222396a5611407e4769f14e54b'
@@ -287,7 +288,7 @@ class TreeTests(unittest.TestCase):
 
     def test_parse_tree_extension(self):
         if parse_tree is _parse_tree_py:
-            raise nose.SkipTest('parse_tree extension not found')
+            raise TestSkipped('parse_tree extension not found')
         self._do_test_parse_tree(parse_tree)