Skip to content

Commit 0aa9ec9

Browse files
gh-92886: Fix tests that fail when running with optimizations (-O) in test_zipimport.py (GH-93236)
(cherry picked from commit 484a235) Co-authored-by: jackh-ncl <1750152+jackh-ncl@users.noreply.github.com>
1 parent 3a202de commit 0aa9ec9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/test/test_zipimport.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,10 @@ def test(val):
654654
sys.path.insert(0, TEMP_ZIP)
655655
mod = importlib.import_module(TESTMOD)
656656
self.assertEqual(mod.test(1), 1)
657-
self.assertRaises(AssertionError, mod.test, False)
657+
if __debug__:
658+
self.assertRaises(AssertionError, mod.test, False)
659+
else:
660+
self.assertEqual(mod.test(0), 0)
658661

659662
def testImport_WithStuff(self):
660663
# try importing from a zipfile which contains additional
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixing tests that fail when running with optimizations (``-O``) in ``test_zipimport.py``

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy