[pypy-svn] pypy default: PyPy refuses to load a .pyc file when there is no corresponding .py.
amauryfa
commits-noreply at bitbucket.org
Wed Jan 26 19:09:24 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r41364:bf9f511d17e9
Date: 2011-01-26 13:59 +0100
http://bitbucket.org/pypy/pypy/changeset/bf9f511d17e9/
Log: PyPy refuses to load a .pyc file when there is no corresponding .py.
Fix the tests accordingly.
diff --git a/lib-python/modified-2.7.0/test/test_import.py b/lib-python/modified-2.7.0/test/test_import.py
--- a/lib-python/modified-2.7.0/test/test_import.py
+++ b/lib-python/modified-2.7.0/test/test_import.py
@@ -7,7 +7,8 @@
import sys
import unittest
from test.test_support import (unlink, TESTFN, unload, run_unittest, rmtree,
- is_jython, check_warnings, EnvironmentVarGuard)
+ is_jython, check_warnings, EnvironmentVarGuard,
+ impl_detail, check_impl_detail)
def remove_files(name):
@@ -68,7 +69,8 @@
self.assertEqual(mod.b, b,
"module loaded (%s) but contents invalid" % mod)
finally:
- unlink(source)
+ if check_impl_detail(pypy=False):
+ unlink(source)
try:
imp.reload(mod)
@@ -148,13 +150,16 @@
# Compile & remove .py file, we only need .pyc (or .pyo).
with open(filename, 'r') as f:
py_compile.compile(filename)
- unlink(filename)
+ if check_impl_detail(pypy=False):
+ # pypy refuses to import a .pyc if the .py does not exist
+ unlink(filename)
# Need to be able to load from current dir.
sys.path.append('')
# This used to crash.
exec 'import ' + module
+ reload(longlist)
# Cleanup.
del sys.path[-1]
@@ -314,6 +319,7 @@
self.assertEqual(mod.code_filename, self.file_name)
self.assertEqual(mod.func_filename, self.file_name)
+ @impl_detail("pypy refuses to import without a .py source", pypy=False)
def test_module_without_source(self):
target = "another_module.py"
py_compile.compile(self.file_name, dfile=target)
More information about the Pypy-commit
mailing list