Skip to content

Commit 690828c

Browse files
committed
Added basis for initial dulwich integration. Many basic issues should surface while integrating this
1 parent 2baf8a4 commit 690828c

File tree

6 files changed

+52
-2
lines changed

6 files changed

+52
-2
lines changed

git/db/dulwich/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Dulwich module initialization"""
2+
3+
def init_dulwich():
4+
""":raise ImportError: if dulwich is not present"""
5+
try:
6+
import dulwich
7+
except ImportError:
8+
raise ImportError("Could not find 'dulwich' in the PYTHONPATH - dulwich functionality is not available")
9+
#END handle dulwich import
10+
11+
12+
13+
init_dulwich()

git/db/dulwich/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Module with some basic database implementations"""
2+
3+
4+
__all__ = []
5+
6+

git/test/db/dulwich/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
2+
#
3+
# This module is part of GitDB and is released under
4+
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php

git/test/db/dulwich/test_base.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
2+
#
3+
# This module is part of GitDB and is released under
4+
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
5+
from git.test.db.base import RepoBase
6+
from git.db.complex import PureCompatibilityGitDB
7+
8+
try:
9+
import git.db.dulwich # import test
10+
11+
class TestPyDBBase(RepoBase):
12+
13+
RepoCls = PureCompatibilityGitDB
14+
15+
# def test_basics(self):
16+
# pass
17+
18+
except ImportError:
19+
del(RepoBase)
20+
import warnings
21+
warnings.warn("Skipped all dulwich tests as they are not in the path")
22+
#END handle import

git/test/db/lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def setUpAll(cls):
7070
each test type has its own repository
7171
"""
7272
if cls.needs_ro_repo:
73-
assert cls.RepoCls is not None, "RepoCls class member must be set"
73+
if cls is not TestDBBase:
74+
assert cls.RepoCls is not None, "RepoCls class member must be set in %s" % cls
7475
cls.rorepo = cls.RepoCls(rorepo_dir())
7576
#END handle rorepo
7677

git/test/lib/helper.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ def __new__(metacls, name, bases, clsdict):
207207
new_type = super(GlobalsItemDeletorMetaCls, metacls).__new__(metacls, name, bases, clsdict)
208208
if name != metacls.ModuleToDelete:
209209
mod = __import__(new_type.__module__, globals(), locals(), new_type.__module__)
210-
delattr(mod, metacls.ModuleToDelete)
210+
try:
211+
delattr(mod, metacls.ModuleToDelete)
212+
except AttributeError:
213+
pass
214+
#END skip case that people import our base without actually using it
211215
#END handle deletion
212216
return new_type
213217

0 commit comments

Comments
 (0)