Skip to content

Commit 5d6a1b0

Browse files
authored
Fix test compatibility with Python < 3.8 (#731)
This is a simple compatibility fix for Python versions prior to 3.8, where `patch.dict()` did not return the patched instance of the object. Since it has just been patched, we can refer to it directly.
1 parent aee8364 commit 5d6a1b0

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/test_shell_sh.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ def _test_extension(prefix_path):
102102
subdirectory_path = str(prefix_path / 'subdirectory')
103103

104104
# validate appending/prepending without existing values
105-
with patch.dict(os.environ) as env_patch:
106-
env_patch.pop('APPEND_NAME', None)
107-
env_patch.pop('PREPEND_NAME', None)
105+
with patch.dict(os.environ):
106+
os.environ.pop('APPEND_NAME', None)
107+
os.environ.pop('PREPEND_NAME', None)
108108
coroutine = extension.generate_command_environment(
109109
'task_name', prefix_path, {'pkg_name': str(prefix_path)})
110110
env = run_until_complete(coroutine)
@@ -210,9 +210,9 @@ def _test_prefix_script(prefix_path):
210210
subdirectory_path = str(prefix_path / 'subdirectory')
211211

212212
# validate appending/prepending without existing values
213-
with patch.dict(os.environ) as env_patch:
214-
env_patch.pop('APPEND_NAME', None)
215-
env_patch.pop('PREPEND_NAME', None)
213+
with patch.dict(os.environ):
214+
os.environ.pop('APPEND_NAME', None)
215+
os.environ.pop('PREPEND_NAME', None)
216216

217217
coroutine = _run_prefix_script(prefix_script)
218218
env = run_until_complete(coroutine)

0 commit comments

Comments
 (0)