gh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_zipimport.py` (GH-93236)

This commit is contained in:
jackh-ncl 2022-06-10 23:57:04 +01:00 committed by GitHub
parent 78f1a43694
commit 484a2357c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -654,7 +654,10 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
sys.path.insert(0, TEMP_ZIP)
mod = importlib.import_module(TESTMOD)
self.assertEqual(mod.test(1), 1)
self.assertRaises(AssertionError, mod.test, False)
if __debug__:
self.assertRaises(AssertionError, mod.test, False)
else:
self.assertEqual(mod.test(0), 0)
def testImport_WithStuff(self):
# try importing from a zipfile which contains additional

View File

@ -0,0 +1 @@
Fixing tests that fail when running with optimizations (``-O``) in ``test_zipimport.py``