remove monkeypatch

it's interacting strangely with our os.environ stuff and not restoring
nicely, probably due to fixture order which is hard to visualise and
control.
This commit is contained in:
Leo Hemsted
2020-01-06 17:07:06 +00:00
parent d244146638
commit eb72a0279f
3 changed files with 15 additions and 19 deletions

View File

@@ -130,14 +130,12 @@ def os_environ():
"""
# for use whenever you expect code to edit environment variables
old_env = os.environ.copy()
class EnvironDict(dict):
def __setitem__(self, key, value):
assert type(value) == str
super().__setitem__(key, value)
os.environ.clear()
yield
# clear afterwards in case anything extra was added to the environment during the test
os.environ.clear()
for k, v in old_env.items():
os.environ[k] = v