We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent98a17a2 commit6f03861Copy full SHA for 6f03861
git/test/test_git.py
@@ -153,3 +153,23 @@ def test_env_vars_passed_to_git(self):
153
editor='non_existant_editor'
154
withmock.patch.dict('os.environ', {'GIT_EDITOR':editor}):
155
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
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