From 96ef7c9cbbefbde9a6305368e368428d85e1b5a3 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Wed, 25 Mar 2020 14:04:47 -0400 Subject: [PATCH] test_config: Make update_environ more robust against failures. --- tests/test_config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index c771ac2..fbc0445 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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()