Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r75189:21aecd71f599
Date: 2014-12-31 16:24 +0100
http://bitbucket.org/pypy/pypy/changeset/21aecd71f599/
Log: Fix many tests in interpreter/
diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -827,9 +827,14 @@
del os # make sure that os is not available globally, because this is what
# happens in "real life" outside the tests
+ # when run as __main__, this module is often executed by a Python
+ # interpreter that have a different list of builtin modules.
+ # Make some tests happy by loading them before we clobber sys.path
+ import runpy
if 'time' not in sys.builtin_module_names:
- # make some tests happy by loading this before we clobber sys.path
import time; del time
+ if 'operator' not in sys.builtin_module_names:
+ import operator; del operator
# no one should change to which lists sys.argv and sys.path are bound
old_argv = sys.argv
diff --git a/pypy/interpreter/astcompiler/test/test_symtable.py
b/pypy/interpreter/astcompiler/test/test_symtable.py
--- a/pypy/interpreter/astcompiler/test/test_symtable.py
+++ b/pypy/interpreter/astcompiler/test/test_symtable.py
@@ -391,9 +391,6 @@
def test_tmpnames(self):
scp = self.mod_scope("with x: pass")
assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
- scp = self.mod_scope("with x as y: pass")
- assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
- assert scp.lookup("_[2]") == symtable.SCOPE_LOCAL
def test_issue13343(self):
scp = self.mod_scope("lambda *, k1=x, k2: None")
diff --git a/pypy/interpreter/test/test_mixedmodule.py
b/pypy/interpreter/test/test_mixedmodule.py
--- a/pypy/interpreter/test/test_mixedmodule.py
+++ b/pypy/interpreter/test/test_mixedmodule.py
@@ -52,6 +52,13 @@
m = Module(space, space.wrap("test_module"))
m.install()
+ # Python3's importlib relies on sys.builtin_module_names, the
+ # call to m.install() above is not enough because the object
+ # space was already initialized.
+ space.setattr(space.sys, space.wrap('builtin_module_names'),
+ space.add(space.sys.get('builtin_module_names'),
+ space.newtuple([
+ space.wrap("test_module")])))
def teardown_class(cls):
from pypy.module.sys.state import get
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit