[Checkins] SVN: zope.testrunner/trunk/ Fix tests on Python 3.2.
Marius Gedminas
cvs-admin at zope.org
Fri Feb 8 08:30:51 UTC 2013
Log message for revision 129208:
Fix tests on Python 3.2.
The code was fine; the test was not (it assumed Python's automatically-created
pyc files would be acceptable for sourceless imports; that's no longer the case
in a PEP-3147 world).
Changed:
U zope.testrunner/trunk/CHANGES.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-wo-source.txt
-=-
Modified: zope.testrunner/trunk/CHANGES.txt
===================================================================
--- zope.testrunner/trunk/CHANGES.txt 2013-02-08 07:49:52 UTC (rev 129207)
+++ zope.testrunner/trunk/CHANGES.txt 2013-02-08 08:30:51 UTC (rev 129208)
@@ -6,9 +6,12 @@
- Dropped use of zope.fixers (LP: #1118877).
-- Fixed tox test error reporting; fixed tests on Pythons 2.6 and 3.1.
+- Fixed tox test error reporting; fixed tests on Pythons 2.6, 3.1, and 3.2.
+- Fix --shuffle ordering on Python 3.2 to be the same as it was on older Python
+ versions.
+
4.1.0 (2013-02-07)
==================
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-wo-source.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-wo-source.txt 2013-02-08 07:49:52 UTC (rev 129207)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-wo-source.txt 2013-02-08 08:30:51 UTC (rev 129208)
@@ -77,6 +77,20 @@
of "removing stale bytecode ..." messages shows that ``--usecompiled``
also implies ``--keepbytecode``:
+ >>> if sys.version_info >= (3, 2):
+ ... # PEP-3147: pyc files in __pycache__ directories cannot be
+ ... # imported; legacy source-less imports need to use the legacy
+ ... # layout
+ ... for root, dirs, files in os.walk(dst):
+ ... for f in files:
+ ... if f.endswith((".pyc", ".pyo")):
+ ... # "root/f" is "dirname/__pycache__/name.magic.ext"
+ ... dirname = os.path.dirname(os.path.abspath(root))
+ ... namewmagic, ext = os.path.splitext(os.path.basename(f))
+ ... newname = os.path.splitext(namewmagic)[0] + ext
+ ... os.rename(os.path.join(root, f),
+ ... os.path.join(dirname, newname))
+
>>> testrunner.run_internal(mydefaults, ["test", "--usecompiled"])
Running tests at level 1
Running zope.testrunner.layer.UnitTests tests:
More information about the checkins
mailing list