diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2011-05-04 19:33:36 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2011-05-04 19:33:36 +0200 |
| commit | d20dadfde5824dcabda351f75a6784d616b2fd23 (patch) | |
| tree | 8b75a3bab4a76d57cacb53b5cb54f20e23951a3a /gitdb/test | |
| parent | e24994109f01bd315fd6a2aaecbbfcdd05bd0586 (diff) | |
| download | gitdb-d20dadfde5824dcabda351f75a6784d616b2fd23.tar.gz | |
First rename session, db/test_base.py works, but there is much more work to do
Diffstat (limited to 'gitdb/test')
| -rw-r--r-- | gitdb/test/db/lib.py | 7 | ||||
| -rw-r--r-- | gitdb/test/db/test_loose.py | 4 | ||||
| -rw-r--r-- | gitdb/test/db/test_mem.py | 4 | ||||
| -rw-r--r-- | gitdb/test/lib.py | 13 | ||||
| -rw-r--r-- | gitdb/test/performance/test_stream.py | 2 | ||||
| -rw-r--r-- | gitdb/test/test_example.py | 4 | ||||
| -rw-r--r-- | gitdb/test/test_stream.py | 2 |
7 files changed, 21 insertions, 15 deletions
diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index 416c8c5..5f4f9c3 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -13,6 +13,10 @@ from gitdb.test.lib import ( from gitdb.stream import Sha1Writer +# import database types we want to support +# they will be set to None if the respective library could not be loaded +from gitdb.db.py import PureGitDB + from gitdb.base import ( IStream, OStream, @@ -36,6 +40,9 @@ class TestDBBase(TestBase): two_lines = "1234\nhello world" all_data = (two_lines, ) + # all supported database types. Add your own type + ref_db_types = (PureGitDB, ) + def _assert_object_writing_simple(self, db): # write a bunch of objects and query their streams and info null_objs = db.size() diff --git a/gitdb/test/db/test_loose.py b/gitdb/test/db/test_loose.py index ee2d78d..49353dc 100644 --- a/gitdb/test/db/test_loose.py +++ b/gitdb/test/db/test_loose.py @@ -3,7 +3,7 @@ # 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 gitdb.db import LooseObjectDB +from gitdb.db import PureLooseObjectODB from gitdb.exc import BadObject from gitdb.util import bin_to_hex @@ -11,7 +11,7 @@ class TestLooseDB(TestDBBase): @with_rw_directory def test_basics(self, path): - ldb = LooseObjectDB(path) + ldb = PureLooseObjectODB(path) # write data self._assert_object_writing(ldb) diff --git a/gitdb/test/db/test_mem.py b/gitdb/test/db/test_mem.py index 188cb0a..f88fca7 100644 --- a/gitdb/test/db/test_mem.py +++ b/gitdb/test/db/test_mem.py @@ -5,7 +5,7 @@ from lib import * from gitdb.db import ( MemoryDB, - LooseObjectDB + PureLooseObjectODB ) class TestMemoryDB(TestDBBase): @@ -18,7 +18,7 @@ class TestMemoryDB(TestDBBase): self._assert_object_writing_simple(mdb) # test stream copy - ldb = LooseObjectDB(path) + ldb = PureLooseObjectODB(path) assert ldb.size() == 0 num_streams_copied = mdb.stream_copy(mdb.sha_iter(), ldb) assert num_streams_copied == mdb.size() diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index cdadaa7..9224f5f 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -1,12 +1,10 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # -# This module is part of GitDB and is released under +# This module is part of PureGitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Utilities used in ODB testing""" -from gitdb import ( - OStream, - GitDB - ) +from gitdb import OStream +from gitdb.db.py import PureGitDB from gitdb.stream import ( Sha1Writer, ZippedStoreShaWriter @@ -72,7 +70,7 @@ def with_rw_repo(func): shutil.copytree(src_dir, path) target_gitdir = os.path.join(path, '.git') assert os.path.isdir(target_gitdir) - return func(self, GitDB(target_gitdir)) + return func(self, PureGitDB(target_gitdir)) #END wrapper wrapper.__name__ = func.__name__ return with_rw_directory(wrapper) @@ -195,7 +193,8 @@ class DeriveTest(OStream): class TestBase(unittest.TestCase): """Base class for all tests""" - rorepo = GitDB(repo_dir()) + # The non-database specific tests just provides a default pure git database + rorepo = PureGitDB(repo_dir()) #} END bases diff --git a/gitdb/test/performance/test_stream.py b/gitdb/test/performance/test_stream.py index f5f2e2e..0a5537c 100644 --- a/gitdb/test/performance/test_stream.py +++ b/gitdb/test/performance/test_stream.py @@ -65,7 +65,7 @@ class TestObjDBPerformance(TestBigRepoR): @with_rw_directory def test_large_data_streaming(self, path): - ldb = LooseObjectDB(path) + ldb = PureLooseObjectODB(path) string_ios = list() # list of streams we previously created # serial mode diff --git a/gitdb/test/test_example.py b/gitdb/test/test_example.py index 7531775..e1a489e 100644 --- a/gitdb/test/test_example.py +++ b/gitdb/test/test_example.py @@ -5,7 +5,7 @@ """Module with examples from the tutorial section of the docs""" from lib import * from gitdb import IStream -from gitdb.db import LooseObjectDB +from gitdb.db import PureLooseObjectODB from gitdb.util import pool from cStringIO import StringIO @@ -15,7 +15,7 @@ from async import IteratorReader class TestExamples(TestBase): def test_base(self): - ldb = LooseObjectDB(fixture_path("../../../.git/objects")) + ldb = PureLooseObjectODB(fixture_path("../../../.git/objects")) for sha1 in ldb.sha_iter(): oinfo = ldb.info(sha1) diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index 523f770..50534d0 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -145,7 +145,7 @@ class TestStream(TestBase): # END for each os def test_decompress_reader_special_case(self): - odb = LooseObjectDB(fixture_path('objects')) + odb = PureLooseObjectODB(fixture_path('objects')) ostream = odb.stream(hex_to_bin('7bb839852ed5e3a069966281bb08d50012fb309b')) # if there is a bug, we will be missing one byte exactly ! |
