diff options
Diffstat (limited to 'test/git')
| -rw-r--r-- | test/git/test_base.py | 18 | ||||
| -rw-r--r-- | test/git/test_diff.py | 3 | ||||
| -rw-r--r-- | test/git/test_remote.py | 7 | ||||
| -rw-r--r-- | test/git/test_repo.py | 5 |
4 files changed, 29 insertions, 4 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py index 71576048..b93e61c1 100644 --- a/test/git/test_base.py +++ b/test/git/test_base.py @@ -4,12 +4,15 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from test.testlib import * -from git import * import git.objects.base as base import git.refs as refs +import os + +from test.testlib import * +from git import * from itertools import chain from git.objects.utils import get_object_type_by_name +import tempfile class TestBase(object): @@ -48,6 +51,17 @@ class TestBase(object): assert not item.path.startswith("/") # must be relative assert isinstance(item.mode, int) # END index object check + + # read from stream + data_stream = item.data_stream + data = data_stream.read() + assert data + + tmpfile = os.tmpfile() + assert item == item.stream_data(tmpfile) + tmpfile.seek(0) + assert tmpfile.read() == data + # END stream to file directly # END for each object type to create # each has a unique sha diff --git a/test/git/test_diff.py b/test/git/test_diff.py index deae7cfc..501d937d 100644 --- a/test/git/test_diff.py +++ b/test/git/test_diff.py @@ -74,3 +74,6 @@ class TestDiff(TestCase): assert value, "Did not find diff for %s" % key # END for each iteration type + def test_diff_index_working_tree(self): + self.fail("""Find a good way to diff an index against the working tree +which is not possible with the current interface""") diff --git a/test/git/test_remote.py b/test/git/test_remote.py index 4cbb0b7b..aeb6b4af 100644 --- a/test/git/test_remote.py +++ b/test/git/test_remote.py @@ -32,7 +32,8 @@ class TestRemote(TestCase): # END for each ref # OPTIONS - for opt in ("url", "fetch"): + # cannot use 'fetch' key anymore as it is now a method + for opt in ("url", ): val = getattr(remote, opt) reader = remote.config_reader assert reader.get(opt) == val @@ -61,8 +62,10 @@ class TestRemote(TestCase): assert remote.rename(prev_name).name == prev_name # END for each rename ( back to prev_name ) + remote.fetch() + self.failUnlessRaises(GitCommandError, remote.pull) remote.update() - + self.fail("test push once there is a test-repo") # END for each remote assert num_remotes assert num_remotes == len(remote_set) diff --git a/test/git/test_repo.py b/test/git/test_repo.py index bc2c7094..ff10f6a6 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -184,6 +184,11 @@ class TestRepo(TestCase): def test_tag(self): assert self.repo.tag('0.1.5').commit + def test_archive(self): + tmpfile = os.tmpfile() + self.repo.archive(tmpfile, '0.1.5') + assert tmpfile.tell() + @patch_object(Git, '_call_process') def test_should_display_blame_information(self, git): git.return_value = fixture('blame') |
