test_config: Make update_environ more robust against failures.

This commit is contained in:
Brett Smith 2020-03-25 14:04:47 -04:00
parent d8b0a56fb4
commit 96ef7c9cbb

View file

@ -69,8 +69,10 @@ def _update_environ(updates):
def update_environ(**kwargs):
revert = {key: os.environ.get(key) for key in kwargs}
_update_environ(kwargs)
yield
_update_environ(revert)
try:
yield
finally:
_update_environ(revert)
def test_repository_from_environment():
config = config_mod.Config()