diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-06-10 23:32:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-10 23:32:27 (GMT) |
commit | 65e2a940fa90e95bcfccd9f90d0d10e78cc3b3d7 (patch) | |
tree | 1682b053cc9b981f00f8e39b4ef343f5f8cf0130 | |
parent | 9fafc0acf7a3bbd52d6867f15425783859cc3cbe (diff) | |
download | cpython-65e2a940fa90e95bcfccd9f90d0d10e78cc3b3d7.zip cpython-65e2a940fa90e95bcfccd9f90d0d10e78cc3b3d7.tar.gz cpython-65e2a940fa90e95bcfccd9f90d0d10e78cc3b3d7.tar.bz2 |
gh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_zipimport.py` (GH-93236)
(cherry picked from commit 484a2357c8385694a077cf2ce0517f327fb0b172)
Co-authored-by: jackh-ncl <1750152+jackh-ncl@users.noreply.github.com>
-rw-r--r-- | Lib/test/test_zipimport.py | 5 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2022-05-25-23-00-35.gh-issue-92886.Y-vrWj.rst | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index b291d53..da66dad 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -653,7 +653,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 diff --git a/Misc/NEWS.d/next/Tests/2022-05-25-23-00-35.gh-issue-92886.Y-vrWj.rst b/Misc/NEWS.d/next/Tests/2022-05-25-23-00-35.gh-issue-92886.Y-vrWj.rst new file mode 100644 index 0000000..93c1ffe --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-05-25-23-00-35.gh-issue-92886.Y-vrWj.rst @@ -0,0 +1 @@ +Fixing tests that fail when running with optimizations (``-O``) in ``test_zipimport.py`` |