diff options
author | Éric Araujo <merwok@netwok.org> | 2011-10-08 04:09:15 +0200 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-10-08 04:09:15 +0200 |
commit | a29e4f64c1dfeb4ca1cf9f4c9636cb4528b2fd8c (patch) | |
tree | f162133d4375ac1c80313861d6e409c186a849ee /Lib/packaging/tests/test_command_build_py.py | |
parent | 73b1e7dd2098279910e89454d5ba92d5b46370da (diff) | |
download | cpython-git-a29e4f64c1dfeb4ca1cf9f4c9636cb4528b2fd8c.tar.gz |
Fix packaging byte-compilation to comply with PEP 3147 (#11254).
I want to replace custom byte-compiling function with calls to
compileall before 3.3b1, but in the short term it’s good to have this
fixed.
Adapted from the distutils patch by Jeff Ramnani. I tested with -B, -O
and -OO; test_util and test_mixin2to3 fail in -O mode because lib2to3
doesn’t support it.
Diffstat (limited to 'Lib/packaging/tests/test_command_build_py.py')
-rw-r--r-- | Lib/packaging/tests/test_command_build_py.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/packaging/tests/test_command_build_py.py b/Lib/packaging/tests/test_command_build_py.py index 4eeb34e117..a978c91602 100644 --- a/Lib/packaging/tests/test_command_build_py.py +++ b/Lib/packaging/tests/test_command_build_py.py @@ -2,6 +2,7 @@ import os import sys +import imp from packaging.command.build_py import build_py from packaging.dist import Distribution @@ -58,13 +59,15 @@ class BuildPyTestCase(support.TempdirManager, self.assertEqual(len(cmd.get_outputs()), 3) pkgdest = os.path.join(destination, "pkg") files = os.listdir(pkgdest) + pycache_dir = os.path.join(pkgdest, "__pycache__") self.assertIn("__init__.py", files) self.assertIn("README.txt", files) - # XXX even with -O, distutils writes pyc, not pyo; bug? if sys.dont_write_bytecode: - self.assertNotIn("__init__.pyc", files) + self.assertFalse(os.path.exists(pycache_dir)) else: - self.assertIn("__init__.pyc", files) + # XXX even with -O, packaging writes pyc, not pyo; bug? + pyc_files = os.listdir(pycache_dir) + self.assertIn("__init__.%s.pyc" % imp.get_tag(), pyc_files) def test_empty_package_dir(self): # See SF 1668596/1720897. |