[pypy-commit] pypy py3.5: In this test, interpret() seems not to be usable on non-assert

arigo pypy.commits at gmail.com
Fri Nov 18 10:33:56 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r88469:cbe653eeb8fb
Date: 2016-11-18 16:33 +0100
http://bitbucket.org/pypy/pypy/changeset/cbe653eeb8fb/

Log:	In this test, interpret() seems not to be usable on non-assert
	statements. Do the 'f = lambda x: x+1' manually instead.

diff --git a/pypy/tool/pytest/test/test_pytestsupport.py b/pypy/tool/pytest/test/test_pytestsupport.py
--- a/pypy/tool/pytest/test/test_pytestsupport.py
+++ b/pypy/tool/pytest/test/test_pytestsupport.py
@@ -21,7 +21,13 @@
     co = PyCode._from_code(space, somefunc.func_code)
     pyframe = space.FrameClass(space, co, space.newdict(), None)
     runner = AppFrame(space, pyframe)
-    interpret("f = lambda x: x+1", runner, should_fail=False)
+    # XXX the following, in two calls to interpret(), no longer seems to
+    # work---the name 'f' is not defined in the second call.  We must
+    # build the 'f' manually with a space.appexec().
+    #interpret("f = lambda x: x+1", runner, should_fail=False)
+    space.appexec([runner.get_w_globals()], """(dict):
+        dict['f'] = lambda x: x+1
+    """)
     msg = interpret("assert isinstance(f(2), float)", runner)
     assert msg.startswith("assert isinstance(3, float)\n"
                           " +  where 3 = ")


More information about the pypy-commit mailing list