[pypy-commit] pypy default: Revert d9c685ecab5e: doesn't work. On pypy2 we have to run "pypy py.test".
arigo
pypy.commits at gmail.com
Sun Nov 13 10:27:24 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r88357:14917346434c
Date: 2016-11-13 16:26 +0100
http://bitbucket.org/pypy/pypy/changeset/14917346434c/
Log: Revert d9c685ecab5e: doesn't work. On pypy2 we have to run "pypy
py.test". On pypy3 we cannot run "pypy py.test". Fun.
diff --git a/pypy/module/pypyjit/test_pypy_c/test_00_model.py b/pypy/module/pypyjit/test_pypy_c/test_00_model.py
--- a/pypy/module/pypyjit/test_pypy_c/test_00_model.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_00_model.py
@@ -2,7 +2,7 @@
import sys, os
import types
import subprocess
-import py, pytest
+import py
from rpython.tool import disassembler
from rpython.tool.udir import udir
from rpython.tool import logparser
@@ -15,26 +15,10 @@
log_string = 'jit-log-opt,jit-log-noopt,jit-log-virtualstate,jit-summary'
def setup_class(cls):
- pypy_c = pytest.config.option.pypy_c or None
- if pypy_c:
- assert os.path.exists(pypy_c), (
- "--pypy specifies %r, which does not exist" % (pypy_c,))
- out = subprocess.check_output([pypy_c, '-c',
- "import sys; print('__pypy__' in sys.builtin_module_names)"])
- assert 'True' in out, "%r is not a pypy executable" % (pypy_c,)
- out = subprocess.check_output([pypy_c, '-c',
- "import sys; print(sys.pypy_translation_info['translation.jit'])"])
- assert 'True' in out, "%r is a not a JIT-enabled pypy" % (pypy_c,)
- out = subprocess.check_output([pypy_c, '-c',
- "import sys; print(sys.version)"])
- assert out.startswith('2.7'), "%r is a not a pypy 2.7" % (pypy_c,)
- else:
- # backward compatibility: use pypy_c = sys.executable
- # if that's a pypy with a JIT
- if ('__pypy__' in sys.builtin_module_names and
- sys.pypy_translation_info['translation.jit']):
- pypy_c = sys.executable
- cls.pypy_c = pypy_c
+ if '__pypy__' not in sys.builtin_module_names:
+ py.test.skip("must run this test with pypy")
+ if not sys.pypy_translation_info['translation.jit']:
+ py.test.skip("must give a pypy-c with the jit enabled")
cls.tmpdir = udir.join('test-pypy-jit')
cls.tmpdir.ensure(dir=True)
@@ -45,8 +29,6 @@
discard_stdout_before_last_line=False, **jitopts):
jitopts.setdefault('threshold', 200)
jitopts.setdefault('disable_unrolling', 9999)
- if self.pypy_c is None:
- py.test.skip("run with --pypy=PATH")
src = py.code.Source(func_or_src)
if isinstance(func_or_src, types.FunctionType):
funcname = func_or_src.func_name
@@ -60,12 +42,12 @@
f.write("import sys\n")
f.write("sys.setcheckinterval(10000000)\n")
f.write(str(src) + "\n")
- f.write("print(%s(%s))\n" % (funcname, arglist))
+ f.write("print %s(%s)\n" % (funcname, arglist))
#
# run a child pypy-c with logging enabled
logfile = self.filepath.new(ext='.log')
#
- cmdline = [self.pypy_c]
+ cmdline = [sys.executable]
if not import_site:
cmdline.append('-S')
if jitopts:
@@ -92,9 +74,6 @@
#if stderr.startswith('debug_alloc.h:'): # lldebug builds
# stderr = ''
#assert not stderr
- if not stdout:
- raise Exception("no stdout produced; stderr='''\n%s'''"
- % (stderr,))
if stderr:
print '*** stderr of the subprocess: ***'
print stderr
@@ -454,7 +433,7 @@
import pytest
def f():
import sys
- sys.stderr.write('SKIP: foobar\n')
+ print >> sys.stderr, 'SKIP: foobar'
#
raises(pytest.skip.Exception, "self.run(f, [])")
More information about the pypy-commit
mailing list