Skip to content

Commit 133988a

Browse files
committed
update db test to allow testing of individual database types, giving more fine-grained control over testing the db packge
1 parent 97a17dc commit 133988a

3 files changed

Lines changed: 27 additions & 17 deletions

File tree

test/db/__init__.py

Whitespace-only changes.

test/test_db.py renamed to test/db/lib.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1-
"""Test for object db"""
2-
from lib import (
1+
"""Base classes for object db testing"""
2+
from gitdb.test.lib import (
33
with_rw_directory,
44
ZippedStoreShaWriter,
55
TestBase
66
)
77

8-
from gitdb import *
9-
from gitdb.stream import Sha1Writer
8+
from gitdb.stream import (
9+
Sha1Writer,
10+
IStream,
11+
OStream,
12+
OInfo
13+
)
14+
1015
from gitdb.exc import BadObject
1116
from gitdb.typ import str_blob_type
1217

1318
from async import IteratorReader
1419

1520
from cStringIO import StringIO
16-
import os
21+
22+
23+
__all__ = ('TestDBBase', 'with_rw_directory' )
1724

18-
class TestDB(TestBase):
19-
"""Test the different db class implementations"""
25+
class TestDBBase(TestBase):
26+
"""Base class providing testing routines on databases"""
2027

2128
# data
2229
two_lines = "1234\nhello world"
@@ -166,13 +173,3 @@ def istream_generator(offset=0, ni=ni):
166173
assert count == nni
167174

168175

169-
170-
171-
@with_rw_directory
172-
def test_writing(self, path):
173-
ldb = LooseObjectDB(path)
174-
175-
# write data
176-
self._assert_object_writing(ldb)
177-
self._assert_object_writing_async(ldb)
178-

test/db/test_loose.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from lib import *
2+
from gitdb.db import LooseObjectDB
3+
4+
class TestLooseDB(TestDBBase):
5+
6+
@with_rw_directory
7+
def test_writing(self, path):
8+
ldb = LooseObjectDB(path)
9+
10+
# write data
11+
self._assert_object_writing(ldb)
12+
self._assert_object_writing_async(ldb)
13+

0 commit comments

Comments
 (0)