From e8b4f23115237047c907fca4565020f30ad35a7c Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Mon, 18 Jan 2021 12:50:51 +0100 Subject: [PATCH] Fixed isolation of test_check_errors_catches_all_exceptions. --- tests/utils_tests/test_autoreload.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index a43d7c2fde..64bbcda27a 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -98,8 +98,11 @@ class TestIterModulesAndFiles(SimpleTestCase): filename = self.temporary_file('test_exception.py') filename.write_text('raise Exception') with extend_sys_path(str(filename.parent)): - with self.assertRaises(Exception): - autoreload.check_errors(import_module)('test_exception') + try: + with self.assertRaises(Exception): + autoreload.check_errors(import_module)('test_exception') + finally: + autoreload._exception = None self.assertFileFound(filename) def test_zip_reload(self):