summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-07-06 22:11:48 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-07-06 22:11:48 +0200
commit690828ce2e03ce32c5a66186c543d7c5050287e4 (patch)
tree219b433c182db92d7c62c78bbca5253883be10b8
parent2baf8a493618463d2bb41b8e96c8304bf48e2c8a (diff)
downloadgitpython-690828ce2e03ce32c5a66186c543d7c5050287e4.tar.gz
Added basis for initial dulwich integration. Many basic issues should surface while integrating this
-rw-r--r--git/db/dulwich/__init__.py13
-rw-r--r--git/db/dulwich/base.py6
-rw-r--r--git/test/db/dulwich/__init__.py4
-rw-r--r--git/test/db/dulwich/test_base.py22
-rw-r--r--git/test/db/lib.py3
-rw-r--r--git/test/lib/helper.py6
6 files changed, 52 insertions, 2 deletions
diff --git a/git/db/dulwich/__init__.py b/git/db/dulwich/__init__.py
new file mode 100644
index 00000000..92d30941
--- /dev/null
+++ b/git/db/dulwich/__init__.py
@@ -0,0 +1,13 @@
+"""Dulwich module initialization"""
+
+def init_dulwich():
+ """:raise ImportError: if dulwich is not present"""
+ try:
+ import dulwich
+ except ImportError:
+ raise ImportError("Could not find 'dulwich' in the PYTHONPATH - dulwich functionality is not available")
+ #END handle dulwich import
+
+
+
+init_dulwich()
diff --git a/git/db/dulwich/base.py b/git/db/dulwich/base.py
new file mode 100644
index 00000000..cd1d71c8
--- /dev/null
+++ b/git/db/dulwich/base.py
@@ -0,0 +1,6 @@
+"""Module with some basic database implementations"""
+
+
+__all__ = []
+
+
diff --git a/git/test/db/dulwich/__init__.py b/git/test/db/dulwich/__init__.py
new file mode 100644
index 00000000..8a681e42
--- /dev/null
+++ b/git/test/db/dulwich/__init__.py
@@ -0,0 +1,4 @@
+# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
+#
+# This module is part of GitDB and is released under
+# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
diff --git a/git/test/db/dulwich/test_base.py b/git/test/db/dulwich/test_base.py
new file mode 100644
index 00000000..f3489014
--- /dev/null
+++ b/git/test/db/dulwich/test_base.py
@@ -0,0 +1,22 @@
+# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
+#
+# This module is part of GitDB and is released under
+# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
+from git.test.db.base import RepoBase
+from git.db.complex import PureCompatibilityGitDB
+
+try:
+ import git.db.dulwich # import test
+
+ class TestPyDBBase(RepoBase):
+
+ RepoCls = PureCompatibilityGitDB
+
+ # 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
diff --git a/git/test/db/lib.py b/git/test/db/lib.py
index 499ca252..2b3ddde5 100644
--- a/git/test/db/lib.py
+++ b/git/test/db/lib.py
@@ -70,7 +70,8 @@ class TestDBBase(TestBase):
each test type has its own repository
"""
if cls.needs_ro_repo:
- assert cls.RepoCls is not None, "RepoCls class member must be set"
+ if cls is not TestDBBase:
+ assert cls.RepoCls is not None, "RepoCls class member must be set in %s" % cls
cls.rorepo = cls.RepoCls(rorepo_dir())
#END handle rorepo
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index d9a92a52..ef2d3280 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -207,7 +207,11 @@ class GlobalsItemDeletorMetaCls(type):
new_type = super(GlobalsItemDeletorMetaCls, metacls).__new__(metacls, name, bases, clsdict)
if name != metacls.ModuleToDelete:
mod = __import__(new_type.__module__, globals(), locals(), new_type.__module__)
- delattr(mod, metacls.ModuleToDelete)
+ try:
+ delattr(mod, metacls.ModuleToDelete)
+ except AttributeError:
+ pass
+ #END skip case that people import our base without actually using it
#END handle deletion
return new_type