summaryrefslogtreecommitdiff
path: root/git/test/test_git.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-22 16:22:15 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-22 16:22:21 +0100
commit2ce3fe7cef8910aadc2a2b39a3dab4242a751380 (patch)
treef7d25f8897aac64b434ad4282a917ed32ae34952 /git/test/test_git.py
parent6f038611ff120f8283f0f1a56962f95b66730c72 (diff)
downloadgitpython-2ce3fe7cef8910aadc2a2b39a3dab4242a751380.tar.gz
Intermediate commit on my way to get this finalized.
Renamed context manager 'with_environment' to 'custom_environment'. On my way to implement sshkey test.
Diffstat (limited to 'git/test/test_git.py')
-rw-r--r--git/test/test_git.py40
1 files changed, 28 insertions, 12 deletions
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 85ee56c6..990f4cd0 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -4,18 +4,24 @@
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-
import os
import mock
-from git.test.lib import (TestBase,
- patch,
- raises,
- assert_equal,
- assert_true,
- assert_match,
- fixture_path)
-from git import (Git,
- GitCommandError)
+
+from git.test.lib import (
+ TestBase,
+ patch,
+ raises,
+ assert_equal,
+ assert_true,
+ assert_match,
+ fixture_path
+)
+from git import (
+ Git,
+ GitCommandError,
+ Repo
+)
+from gitdb.test.lib import with_rw_directory
from git.compat import PY3
@@ -154,12 +160,13 @@ class TestGit(TestBase):
with mock.patch.dict('os.environ', {'GIT_EDITOR': editor}):
assert self.git.var("GIT_EDITOR") == editor
- def test_environment(self):
+ @with_rw_directory
+ def test_environment(self, rw_dir):
# sanity check
assert self.git.environment() == {}
# make sure the context manager works and cleans up after itself
- with self.git.with_environment(PWD='/tmp'):
+ with self.git.custom_environment(PWD='/tmp'):
assert self.git.environment() == {'PWD': '/tmp'}
assert self.git.environment() == {}
@@ -173,3 +180,12 @@ class TestGit(TestBase):
new_env = self.git.update_environment(**old_env)
assert new_env == {'VARKEY': 'VARVALUE'}
assert self.git.environment() == {}
+
+ rw_repo = Repo.init(os.path.join(rw_dir, 'repo'))
+ remote = rw_repo.create_remote('ssh-origin', "ssh://git@server/foo")
+
+ with rw_repo.git.sshkey('doesntexist.key'):
+ remote.fetch()
+ # end
+
+