diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/git/test_base.py | 4 | ||||
-rw-r--r-- | test/git/test_blob.py | 8 | ||||
-rw-r--r-- | test/git/test_remote.py | 2 | ||||
-rw-r--r-- | test/git/test_repo.py | 55 | ||||
-rw-r--r-- | test/git/test_util.py (renamed from test/git/test_utils.py) | 4 |
5 files changed, 18 insertions, 55 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py index 1b01cda3..db13feae 100644 --- a/test/git/test_base.py +++ b/test/git/test_base.py @@ -11,7 +11,7 @@ import os from test.testlib import * from git import * from itertools import chain -from git.objects.utils import get_object_type_by_name +from git.objects.util import get_object_type_by_name from gitdb.util import hex_to_bin import tempfile @@ -42,8 +42,6 @@ class TestBase(TestBase): assert item.hexsha == hexsha assert item.type == typename assert item.size - if isinstance(item, Blob): - assert item.data assert item == item assert not item != item assert str(item) == item.hexsha diff --git a/test/git/test_blob.py b/test/git/test_blob.py index e5fca0a6..623ed179 100644 --- a/test/git/test_blob.py +++ b/test/git/test_blob.py @@ -10,14 +10,6 @@ from gitdb.util import hex_to_bin class TestBlob(TestBase): - def test_should_cache_data(self): - bid = 'a802c139d4767c89dcad79d836d05f7004d39aac' - blob = Blob(self.rorepo, hex_to_bin(bid)) - blob.data - assert blob.data - blob.size - blob.size - def test_mime_type_should_return_mime_type_for_known_types(self): blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'}) assert_equal("image/png", blob.mime_type) diff --git a/test/git/test_remote.py b/test/git/test_remote.py index 9d4da034..f609b683 100644 --- a/test/git/test_remote.py +++ b/test/git/test_remote.py @@ -6,7 +6,7 @@ from test.testlib import * from git import * -from git.utils import IterableList +from git.util import IterableList import tempfile import shutil import os diff --git a/test/git/test_repo.py b/test/git/test_repo.py index a3ff564d..551140a1 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -7,7 +7,7 @@ import os, sys from test.testlib import * from git import * -from git.utils import join_path_native +from git.util import join_path_native import tempfile import shutil from cStringIO import StringIO @@ -131,7 +131,20 @@ class TestRepo(TestBase): assert os.path.isdir(r.git_dir) self._test_empty_repo(r) + + # test clone + clone_path = path + "_clone" + rc = r.clone(clone_path) + self._test_empty_repo(rc) + shutil.rmtree(git_dir_abs) + try: + shutil.rmtree(clone_path) + except OSError: + # when relative paths are used, the clone may actually be inside + # of the parent directory + pass + # END exception handling # END for each path os.makedirs(git_dir_rela) @@ -151,46 +164,6 @@ class TestRepo(TestBase): def test_bare_property(self): self.rorepo.bare - @patch_object(Repo, '__init__') - @patch_object(Git, '_call_process') - def test_init_with_options(self, git, repo): - git.return_value = True - repo.return_value = None - - r = Repo.init("repos/foo/bar.git", **{'bare' : True,'template': "/baz/sweet"}) - assert isinstance(r, Repo) - - assert_true(git.called) - assert_true(repo.called) - - @patch_object(Repo, '__init__') - @patch_object(Git, '_call_process') - def test_clone(self, git, repo): - git.return_value = None - repo.return_value = None - - self.rorepo.clone("repos/foo/bar.git") - - assert_true(git.called) - path = os.path.join(absolute_project_path(), '.git') - assert_equal(git.call_args, (('clone', path, 'repos/foo/bar.git'), {})) - assert_true(repo.called) - - @patch_object(Repo, '__init__') - @patch_object(Git, '_call_process') - def test_clone_with_options(self, git, repo): - git.return_value = None - repo.return_value = None - - self.rorepo.clone("repos/foo/bar.git", **{'template': '/awesome'}) - - assert_true(git.called) - path = os.path.join(absolute_project_path(), '.git') - assert_equal(git.call_args, (('clone', path, 'repos/foo/bar.git'), - { 'template': '/awesome'})) - assert_true(repo.called) - - def test_daemon_export(self): orig_val = self.rorepo.daemon_export self.rorepo.daemon_export = not orig_val diff --git a/test/git/test_utils.py b/test/git/test_util.py index 963e2b55..6453bc19 100644 --- a/test/git/test_utils.py +++ b/test/git/test_util.py @@ -8,8 +8,8 @@ import os import tempfile from test.testlib import * -from git.utils import * -from git.objects.utils import * +from git.util import * +from git.objects.util import * from git import * from git.cmd import dashify |