Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6f03861

Browse files
committed
Add a few tests
1 parent98a17a2 commit6f03861

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎git/test/test_git.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,23 @@ def test_env_vars_passed_to_git(self):
153153
editor='non_existant_editor'
154154
withmock.patch.dict('os.environ', {'GIT_EDITOR':editor}):
155155
assertself.git.var("GIT_EDITOR")==editor
156+
157+
deftest_environment(self):
158+
# sanity check
159+
assertself.git.environment()== {}
160+
161+
# make sure the context manager works and cleans up after itself
162+
withself.git.with_environment(PWD='/tmp'):
163+
assertself.git.environment()== {'PWD':'/tmp'}
164+
165+
assertself.git.environment()== {}
166+
167+
old_env=self.git.update_environment(VARKEY='VARVALUE')
168+
# The returned dict can be used to revert the change, hence why it has
169+
# an entry with value 'None'.
170+
assertold_env== {'VARKEY':None}
171+
assertself.git.environment()== {'VARKEY':'VARVALUE'}
172+
173+
new_env=self.git.update_environment(**old_env)
174+
assertnew_env== {'VARKEY':'VARVALUE'}
175+
assertself.git.environment()== {}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp