diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2011-05-30 16:32:56 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2011-05-30 16:32:56 +0200 |
| commit | 1f71ed94578799ee1667ba54b66a369e307f415b (patch) | |
| tree | f8e1c3a8507b5306a6a04efa94ffec3c22731bcc /git/test/db | |
| parent | 024adf37acddd6a5d8293b6b5d15795c59a142c0 (diff) | |
| download | GitPython-1f71ed94578799ee1667ba54b66a369e307f415b.tar.gz GitPython-1f71ed94578799ee1667ba54b66a369e307f415b.zip | |
git cmd implementation of repository appears to work, at least this is what the test suggests. Pure python implementation still has some trouble, but this should be very fixable
Diffstat (limited to 'git/test/db')
| -rw-r--r-- | git/test/db/base.py | 32 | ||||
| -rw-r--r-- | git/test/db/cmd/test_base.py | 23 | ||||
| -rw-r--r-- | git/test/db/py/test_base.py | 21 | ||||
| -rw-r--r-- | git/test/db/py/test_git.py (renamed from git/test/db/test_git.py) | 0 | ||||
| -rw-r--r-- | git/test/db/py/test_loose.py (renamed from git/test/db/test_loose.py) | 0 | ||||
| -rw-r--r-- | git/test/db/py/test_mem.py (renamed from git/test/db/test_mem.py) | 0 | ||||
| -rw-r--r-- | git/test/db/py/test_pack.py (renamed from git/test/db/test_pack.py) | 0 | ||||
| -rw-r--r-- | git/test/db/py/test_ref.py (renamed from git/test/db/test_ref.py) | 0 |
8 files changed, 46 insertions, 30 deletions
diff --git a/git/test/db/base.py b/git/test/db/base.py index 470565b9..b0bc76f9 100644 --- a/git/test/db/base.py +++ b/git/test/db/base.py @@ -5,7 +5,11 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php from lib import TestDBBase from git.test.lib import * -from git import * +from git.cmd import Git +from git.objects import * +from git.exc import * +from git.index import * +from git.refs import * from git.util import join_path_native from git.exc import BadObject from git.util import hex_to_bin, bin_to_hex @@ -15,6 +19,8 @@ import tempfile import shutil from cStringIO import StringIO +from git.db.compat import RepoCompatibilityInterface + class RepoGlobalsItemDeletorMetaCls(GlobalsItemDeletorMetaCls): ModuleToDelete = 'RepoBase' @@ -138,8 +144,8 @@ class RepoBase(TestDBBase): try: # with specific path for path in (git_dir_rela, git_dir_abs): - r = Repo.init(path=path, bare=True) - assert isinstance(r, Repo) + r = self.RepoCls.init(path=path, bare=True) + assert isinstance(r, self.RepoCls) assert r.bare == True assert os.path.isdir(r.git_dir) @@ -160,7 +166,7 @@ class RepoBase(TestDBBase): # END exception handling # try again, this time with the absolute version - rc = Repo.clone_from(r.git_dir, clone_path) + rc = self.RepoCls.clone_from(r.git_dir, clone_path) self._assert_empty_repo(rc) shutil.rmtree(git_dir_abs) @@ -176,7 +182,7 @@ class RepoBase(TestDBBase): os.makedirs(git_dir_rela) os.chdir(git_dir_rela) - r = Repo.init(bare=False) + r = self.RepoCls.init(bare=False) r.bare == False self._assert_empty_repo(r) @@ -212,8 +218,7 @@ class RepoBase(TestDBBase): self.rorepo.alternates = cur_alternates def test_repr(self): - path = os.path.join(os.path.abspath(rorepo_dir()), '.git') - assert_equal('<git.Repo "%s">' % path, repr(self.rorepo)) + assert_equal('<git.Repo "%s">' % rorepo_dir(), repr(self.rorepo)) def test_is_dirty_with_bare_repository(self): orig_value = self.rorepo._bare @@ -243,6 +248,7 @@ class RepoBase(TestDBBase): assert isinstance(index, IndexFile) def test_tag(self): + assert self.rorepo.tag('0.1.5').commit assert self.rorepo.tag('refs/tags/0.1.5').commit def test_archive(self): @@ -587,17 +593,13 @@ class RepoBase(TestDBBase): # currently, nothing more is supported self.failUnlessRaises(NotImplementedError, rev_parse, "@{1 week ago}") - def test_repo_odbtype(self): - target_type = GitDB - if sys.version_info[1] < 5: - target_type = CmdGitDB - assert isinstance(self.rorepo.odb, target_type) - def test_submodules(self): assert len(self.rorepo.submodules) == 1 # non-recursive - assert len(list(self.rorepo.iter_submodules())) == 2 + # in previous configurations, we had recursive repositories so this would compare to 2 + # now there is only one left, as gitdb was merged + assert len(list(self.rorepo.iter_submodules())) == 1 - assert isinstance(self.rorepo.submodule("git"), Submodule) + assert isinstance(self.rorepo.submodule("git/ext/async"), Submodule) self.failUnlessRaises(ValueError, self.rorepo.submodule, "doesn't exist") @with_rw_repo('HEAD', bare=False) diff --git a/git/test/db/cmd/test_base.py b/git/test/db/cmd/test_base.py index 1404eca0..8d00f57f 100644 --- a/git/test/db/cmd/test_base.py +++ b/git/test/db/cmd/test_base.py @@ -2,12 +2,17 @@ # # 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.lib import * -from git.db import RefSpec - -class TestBase(TestDBBase): - - @with_rw_directory - def test_basics(self, path): - assert False - +from git.test.lib import rorepo_dir +from git.test.db.base import RepoBase + +# immport test +from git.db.cmd.base import * +from git.db.cmd.complex import * + +from git.db.complex import CmdCompatibilityGitDB + +class TestBase(RepoBase): + RepoCls = CmdCompatibilityGitDB + + def test_basics(self): + pass diff --git a/git/test/db/py/test_base.py b/git/test/db/py/test_base.py index 84899651..ade05c8d 100644 --- a/git/test/db/py/test_base.py +++ b/git/test/db/py/test_base.py @@ -2,17 +2,26 @@ # # 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.lib import * +from git.test.lib import rorepo_dir from git.test.db.base import RepoBase + +# import test +from git.db.py.base import * +from git.db.py.loose import * +from git.db.py.mem import * +from git.db.py.pack import * +from git.db.py.ref import * +from git.db.py.resolve import * +from git.db.py.submodule import * +from git.db.py.transport import * from git.db.py.complex import * -from git.db.complex import PureCmdGitDB +from git.db.complex import PureCompatibilityGitDB class TestPyDBBase(RepoBase): - RepoCls = PureCmdGitDB + RepoCls = PureCompatibilityGitDB - def test_instantiation(self): - db = PureGitDB(rorepo_dir()) - cdb = PureCompatibilityGitDB(rorepo_dir()) + def test_basics(self): + pass diff --git a/git/test/db/test_git.py b/git/test/db/py/test_git.py index 46a2d24f..46a2d24f 100644 --- a/git/test/db/test_git.py +++ b/git/test/db/py/test_git.py diff --git a/git/test/db/test_loose.py b/git/test/db/py/test_loose.py index 16c12d8e..16c12d8e 100644 --- a/git/test/db/test_loose.py +++ b/git/test/db/py/test_loose.py diff --git a/git/test/db/test_mem.py b/git/test/db/py/test_mem.py index ed14cc21..ed14cc21 100644 --- a/git/test/db/test_mem.py +++ b/git/test/db/py/test_mem.py diff --git a/git/test/db/test_pack.py b/git/test/db/py/test_pack.py index 4854c4e7..4854c4e7 100644 --- a/git/test/db/test_pack.py +++ b/git/test/db/py/test_pack.py diff --git a/git/test/db/test_ref.py b/git/test/db/py/test_ref.py index 43fbb48f..43fbb48f 100644 --- a/git/test/db/test_ref.py +++ b/git/test/db/py/test_ref.py |
