Fixed isolation of test_check_errors_catches_all_exceptions.

This commit is contained in:
Mariusz Felisiak 2021-01-18 12:50:51 +01:00
parent bef6f75842
commit e8b4f23115
1 changed files with 5 additions and 2 deletions

View File

@ -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):