diff options
| author | Brett Cannon <brett@python.org> | 2015-04-13 18:21:02 (GMT) |
|---|---|---|
| committer | Brett Cannon <brett@python.org> | 2015-04-13 18:21:02 (GMT) |
| commit | f299abdafa0f2b6eb7abae274861b19b361c96bc (patch) | |
| tree | afc3a2bf560e30c7725510eda3b57d71ceddba00 /Lib/test/test_zipfile.py | |
| parent | a63cc212348e276c8ede32773313c60ff7fda651 (diff) | |
| download | cpython-f299abdafa0f2b6eb7abae274861b19b361c96bc.zip cpython-f299abdafa0f2b6eb7abae274861b19b361c96bc.tar.gz cpython-f299abdafa0f2b6eb7abae274861b19b361c96bc.tar.bz2 | |
Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
Diffstat (limited to 'Lib/test/test_zipfile.py')
| -rw-r--r-- | Lib/test/test_zipfile.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 1b2dc85..aa8c463 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -689,7 +689,7 @@ class PyZipFileTests(unittest.TestCase): self.requiresWriteAccess(os.path.dirname(__file__)) with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp: fn = __file__ - if fn.endswith('.pyc') or fn.endswith('.pyo'): + if fn.endswith('.pyc'): path_split = fn.split(os.sep) if os.altsep is not None: path_split.extend(fn.split(os.altsep)) @@ -706,7 +706,7 @@ class PyZipFileTests(unittest.TestCase): with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp: fn = __file__ - if fn.endswith(('.pyc', '.pyo')): + if fn.endswith('.pyc'): fn = fn[:-1] zipfp.writepy(fn, "testpackage") @@ -762,10 +762,8 @@ class PyZipFileTests(unittest.TestCase): import email packagedir = os.path.dirname(email.__file__) self.requiresWriteAccess(packagedir) - # use .pyc if running test in optimization mode, - # use .pyo if running test in debug mode optlevel = 1 if __debug__ else 0 - ext = '.pyo' if optlevel == 1 else '.pyc' + ext = '.pyc' with TemporaryFile() as t, \ zipfile.PyZipFile(t, "w", optimize=optlevel) as zipfp: @@ -839,11 +837,10 @@ class PyZipFileTests(unittest.TestCase): self.assertIn("SyntaxError", s.getvalue()) # as it will not have compiled the python file, it will - # include the .py file not .pyc or .pyo + # include the .py file not .pyc names = zipfp.namelist() self.assertIn('mod1.py', names) self.assertNotIn('mod1.pyc', names) - self.assertNotIn('mod1.pyo', names) finally: rmtree(TESTFN2) |
