Fix test error.

This commit is contained in:
Dave Shawley 2021-03-24 06:30:26 -04:00
parent 9a8f23c614
commit 7ee536e99f
No known key found for this signature in database
GPG key ID: 44A9C9992CCFAB82

View file

@ -41,6 +41,14 @@ class ApplicationTests(AsyncTestCaseWithTimeout):
super().setUp() super().setUp()
self._environ = {} self._environ = {}
def tearDown(self):
super().tearDown()
for name, value in self._environ.items():
if value is not None:
os.environ[name] = value
else:
os.environ.pop(name, None)
def setenv(self, name, value): def setenv(self, name, value):
self._environ.setdefault(name, os.environ.pop(name, None)) self._environ.setdefault(name, os.environ.pop(name, None))
os.environ[name] = value os.environ[name] = value