summaryrefslogtreecommitdiff
path: root/git/test/db
diff options
context:
space:
mode:
Diffstat (limited to 'git/test/db')
-rw-r--r--git/test/db/dulwich/lib.py18
-rw-r--r--git/test/db/dulwich/test_base.py25
2 files changed, 31 insertions, 12 deletions
diff --git a/git/test/db/dulwich/lib.py b/git/test/db/dulwich/lib.py
new file mode 100644
index 00000000..a1110ffa
--- /dev/null
+++ b/git/test/db/dulwich/lib.py
@@ -0,0 +1,18 @@
+"""dulwich specific utilities, as well as all the default ones"""
+
+from git.test.lib import *
+
+#{ Decoorators
+
+def needs_dulwich_or_skip(func):
+ """Skip this test if we have no dulwich - print warning"""
+ return needs_module_or_skip('dulwich')(func)
+
+#}END decorators
+
+#{ MetaClasses
+
+class DulwichRequiredMetaMixin(InheritedTestMethodsOverrideWrapperMetaClsAutoMixin):
+ decorator = [needs_dulwich_or_skip]
+
+#} END metaclasses
diff --git a/git/test/db/dulwich/test_base.py b/git/test/db/dulwich/test_base.py
index f3489014..9bc9c394 100644
--- a/git/test/db/dulwich/test_base.py
+++ b/git/test/db/dulwich/test_base.py
@@ -2,21 +2,22 @@
#
# This module is part of GitDB and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
+from lib import *
from git.test.db.base import RepoBase
from git.db.complex import PureCompatibilityGitDB
try:
- import git.db.dulwich # import test
+ import dulwich
+except ImportError:
+ # om this case, all other dulwich tests will be skipped
+ pass
- class TestPyDBBase(RepoBase):
-
- RepoCls = PureCompatibilityGitDB
+class TestPyDBBase(RepoBase):
+ __metaclass__ = DulwichRequiredMetaMixin
+ RepoCls = PureCompatibilityGitDB
+
+ @needs_dulwich_or_skip
+ def test_basics(self):
+ import dulwich
+ pass
- # def test_basics(self):
- # pass
-
-except ImportError:
- del(RepoBase)
- import warnings
- warnings.warn("Skipped all dulwich tests as they are not in the path")
-#END handle import