Skip to content

Commit

Permalink
gh-92886: Fix tests that fail when running with optimizations (-O) …
Browse files Browse the repository at this point in the history
…in `test_zipimport.py` (GH-93236)

(cherry picked from commit 484a235)

Co-authored-by: jackh-ncl <1750152+jackh-ncl@users.noreply.github.com>
  • Loading branch information
miss-islington and jackh-ncl authored Jun 10, 2022
1 parent 3a202de commit 0aa9ec9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Lib/test/test_zipimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,10 @@ def test(val):
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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixing tests that fail when running with optimizations (``-O``) in ``test_zipimport.py``

0 comments on commit 0aa9ec9

Please sign in to comment.