From c890573ac4cd8cdfd28a6477d92117b95bc67aed Mon Sep 17 00:00:00 2001 From: mbaret <55580676+mbaret@users.noreply.github.com> Date: Fri, 19 Jun 2020 15:35:05 +0100 Subject: [PATCH] [FIX] Recover global state after test_util.py (#5824) In test_util.py, a program exit is simulated to test that the error throwing behaviour is accurate. Unforunately, this also deletes necessary global state and so all subsequent tests that run and use tempdir throw the same error. This patch is a simple fix to restore the global state at the end of the test. Change-Id: I62fef46167e47f6af43271e2ce1db30f54857647 --- tests/python/contrib/test_util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/python/contrib/test_util.py b/tests/python/contrib/test_util.py index 55a2b7616e84..816e651da51a 100644 --- a/tests/python/contrib/test_util.py +++ b/tests/python/contrib/test_util.py @@ -39,6 +39,7 @@ def test_tempdir(): assert os.path.exists(temp_dir.temp_dir) old_debug_mode = util.TempDirectory._KEEP_FOR_DEBUG + old_tempdirs = util.TempDirectory.TEMPDIRS try: for temp_dir_number in range(0, 3): with util.TempDirectory.set_keep_for_debug(): @@ -80,6 +81,7 @@ def test_tempdir(): finally: util.TempDirectory.DEBUG_MODE = old_debug_mode + util.TempDirectory.TEMPDIRS = old_tempdirs if __name__ == '__main__':