python testrunner/app_level_tests.py
in dir /build_dir/pypy-c-jit-linux-x86-64/build (timeout 4000 secs)
watching logfiles {'pytestLog': 'pytest-A.log'}
argv: ['python', 'testrunner/app_level_tests.py']
environment:
AUDITWHEEL_ARCH=x86_64
AUDITWHEEL_PLAT=manylinux2014_x86_64
AUDITWHEEL_POLICY=manylinux2014
DEVTOOLSET_ROOTPATH=/opt/rh/devtoolset-10/root
HOME=/home/buildslave
HOSTNAME=255659ffae49
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LD_LIBRARY_PATH=/usr/local/lib:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64
LOGNAME=buildslave
PATH=/python27_virt/bin:/opt/rh/devtoolset-10/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
PWD=/build_dir/pypy-c-jit-linux-x86-64/build
PYPY_LOCALBASE=/usr/local
PYPY_MAKE_PORTABLE=1
PYPY_USESSION_DIR=/tmp/pytest
SHELL=/bin/bash
SHLVL=2
SSL_CERT_FILE=/opt/_internal/certs.pem
TERM=xterm
TMPDIR=/tmp/pytest
USER=buildslave
USE_CURL=1
_=/python27_virt/bin/buildslave
using PTY: False
using config pypy/pytest-A.cfg
using config pypy/pytest-A.py
ignoring non-existant config /home/buildslave/machine-A_cfg.py
-- interpreter/astcompiler/test
-- interpreter/pyparser/test
-- interpreter/test
-- objspace/test
-- objspace/std/test
-- module/__builtin__/test
-- module/__pypy__/test
-- module/_abc/test
-- module/_ast/test
-- module/_cffi_backend/test
-- module/_codecs/test
-- module/_collections/test
-- module/_continuation/test
-- module/_cppyy/test
-- module/_csv/test
-- module/_demo/test
-- module/_hpy_universal/test/_vendored
-- module/_hpy_universal/test/pypy
-- module/_io/test
-- module/_jitlog/test
-- module/_locale/test
-- module/_lsprof/test
-- module/_md5/test
-- module/_minimal_curses/test
-- module/_multibytecodec/test
-- module/_multiprocessing/test
-- module/_opcode/test
-- module/_pickle/test
-- module/_pickle_support/test
-- module/_posixsubprocess/test
-- module/_pypyjson/test
-- module/_random/test
-- module/_rawffi/alt/test
-- module/_rawffi/test
-- module/_socket/test
-- module/_sre/test
-- module/_vmprof/test
-- module/_warnings/test
-- module/_weakref/test
-- module/_winreg/test
-- module/array/test
-- module/atexit/test
-- module/binascii/test
-- module/bz2/test
-- module/cmath/test
-- module/cpyext/test
-- module/crypt/test
-- module/errno/test
-- module/exceptions/test
-- module/faulthandler/test
-- module/fcntl/test
-- module/gc/test
-- module/imp/test
-- module/itertools/test
-- module/marshal/test
-- module/math/test
-- module/micronumpy/test
-- module/mmap/test
-- module/operator/test
-- module/posix/test
-- module/pwd/test
-- module/pyexpat/test
-- module/pypyjit/test
-- module/select/test
-- module/signal/test
-- module/struct/test
-- module/sys/test
-- module/termios/test
-- module/test_lib_pypy
-- module/thread/test
-- module/time/test
-- module/token/test
-- module/unicodedata/test
-- module/zipimport/test
-- module/zlib/test
-- total: 75 to run
++ 17:14:49 starting interpreter/astcompiler/test [1 started in total]
__ interpreter/astcompiler/test [1 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 15 items
interpreter/astcompiler/test/test_compiler.py ..s............
===================== 14 passed, 1 skipped in 1.24 seconds =====================
++ 17:14:53 starting interpreter/pyparser/test [2 started in total]
__ interpreter/pyparser/test [2 done in total, somefailed=False] ______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.24 seconds =========================
++ 17:14:55 starting interpreter/test [3 started in total]
__ interpreter/test [3 done in total, somefailed=True] ________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 233 items
interpreter/test/test_app_main.py sss
interpreter/test/test_appinterp.py .
interpreter/test/test_argument.py ...............
interpreter/test/test_code.py ...........
interpreter/test/test_compiler.py ................F......s..................F..F..F........F
interpreter/test/test_exceptcomp.py .........
interpreter/test/test_executioncontext.py ....
interpreter/test/test_extmodules.py s
interpreter/test/test_gateway.py .......
interpreter/test/test_interpreter.py ..............
interpreter/test/test_mixedmodule.py ssss
interpreter/test/test_module.py ....FF.F............
interpreter/test/test_pyframe.py .....
interpreter/test/test_special.py ...
interpreter/test/test_syntax.py ............................FFF......
interpreter/test/test_typedef.py ...........
interpreter/test/test_zzpickle_and_slow.py ..............................
=================================== FAILURES ===================================
____________________ AppTestCompiler.test_cpython_issue2301 ____________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...ssion-py3.12-1188/src.py", line 68, in test_cpython_issue2301
assert v.text == "print '\u5e74'\n"
AssertionError
>
func = <function <lambda> at 0x7fc651d2c250>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cpython_issue2301'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cpython_issue2301'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cpython_issue2301'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc65352c460>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651c858c0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651c858c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651e9fe10>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc65295e190>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc65295e190>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2301'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_cpython_issue2301'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_cpython_issue2301'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_cpython_issue2301 at 0x7fc6529ac450>, usemodules = None
definitions = {'host_is_pypy': False, 'is_pypy': <bound method AppTestCompiler.w_is_pypy of <pypy.interpreter.test.test_compiler.AppTestCompiler object at 0x7fc651d32810>>, 'runappdirect': True}
defs = ['self.host_is_pypy = False\n', "def w_is_pypy(self):\n import sys\n return (not self.runappdirect) or '__pypy__' in sys.modules", 'type(self).is_pypy = w_is_pypy\n', 'self.runappdirect = True\n']
symbol = 'runappdirect', value = True
code = <py._code.code.Code object at 0x7fc651d36050>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 66, in test_cpython_issue2301
E compile(b"# coding: utf7\nprint '+XnQ-'", "dummy", "exec")
E File "dummy", line 2
E print '年'
E ^^^^^^^^
E SyntaxError: Missing parentheses in call to 'print'. Did you mean print('年')?
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 72, in <module>
E test_cpython_issue2301()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 68, in test_cpython_issue2301
E assert v.text == "print '\u5e74'\n"
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
self.host_is_pypy = False
def w_is_pypy(self):
import sys
return (not self.runappdirect) or '__pypy__' in sys.modules
type(self).is_pypy = w_is_pypy
self.runappdirect = True
def test_cpython_issue2301():
try:
compile(b"# coding: utf7\nprint '+XnQ-'", "dummy", "exec")
except SyntaxError as v:
assert v.text == "print '\u5e74'\n"
else:
assert False, "Expected SyntaxError"
try:
test_cpython_issue2301()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):\n File "/tmp/pytest/usession-py3.12-1188/src.py", line 66, in test_cpython_issue2301\n compile(b"# coding: utf7\\nprint '+XnQ-'", "dummy", "exec")\n File "dummy", line 2\n print '\u5e74'\n ^^^^^^^^\nSyntaxError: Missing parentheses in call to 'print'. Did you mean print('\u5e74')?\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/pytest/usession-py3.12-1188/src.py", line 72, in <module>\n test_cpython_issue2301()\n File "/tmp/pytest/usession-py3.12-1188/src.py", line 68, in test_cpython_issue2301\n assert v.text == "print '\\u5e74'\\n"\nAssertionError\n
_____________ AppTestOptimizer.test_folding_of_binops_on_constants _____________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...s
elif deop == LOAD_SUPER_ATTR:
^^^^^^^^^^^^^^^
NameError: name 'LOAD_SUPER_ATTR' is not defined
>
func = <function <lambda> at 0x7fc651c103d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_folding_of_binops_on_constants'...all__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_folding_of_binops_on_constants'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_folding_of_binops_on_constants'...all__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_folding_of_binops_on_constants'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_folding_of_binops_on_constants'...all__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_folding_of_binops_on_constants'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_folding_of_binops_on_constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651b91960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651b91050>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651b91050>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_folding_of_binops_on_constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651b91320>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d301e0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d301e0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_folding_of_binops_on_constants'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_folding_of_binops_on_constants'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_folding_of_binops_on_constants'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_folding_of_binops_on_constants at 0x7fc6529ae2d0>
usemodules = None
definitions = {'is_pypy': <bound method AppTestOptimizer.w_is_pypy of <pypy.interpreter.test.test_compiler.AppTestOptimizer object at 0x7fc651b48450>>, 'runappdirect': True}
defs = ["def w_is_pypy(self):\n import sys\n return not self.runappdirect or '__pypy__' in sys.modules", 'type(self).is_pypy = w_is_pypy\n', 'self.runappdirect = True\n']
symbol = 'runappdirect', value = True
code = <py._code.code.Code object at 0x7fc651b48210>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 109, in <module>
E test_folding_of_binops_on_constants()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 95, in test_folding_of_binops_on_constants
E asm = dis_single(line)
E ^^^^^^^^^^^^^^^^
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 76, in dis_single
E return disassemble(compile(line, '', 'single'))
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 69, in disassemble
E dis.dis(func)
E ^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 114, in dis
E _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 555, in _disassemble_recursive
E disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 548, in disassemble
E _disassemble_bytes(_get_code_array(co, adaptive),
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 586, in _disassemble_bytes
E for instr in _get_instructions_bytes(code, varname_from_oparg, names,
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 483, in _get_instructions_bytes
E elif deop == LOAD_SUPER_ATTR:
E ^^^^^^^^^^^^^^^
E NameError: name 'LOAD_SUPER_ATTR' is not defined
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_is_pypy(self):
import sys
return not self.runappdirect or '__pypy__' in sys.modules
type(self).is_pypy = w_is_pypy
self.runappdirect = True
def test_folding_of_binops_on_constants():
def disassemble(func):
from io import StringIO
import sys, dis
f = StringIO()
tmp = sys.stdout
sys.stdout = f
dis.dis(func)
sys.stdout = tmp
result = f.getvalue()
f.close()
return result
def dis_single(line):
return disassemble(compile(line, '', 'single'))
for line, elem in (
('a = 2+3+4', '(9)'), # chained fold
('"@"*4', "('@@@@')"), # check string ops
('a="abc" + "def"', "('abcdef')"), # check string ops
('a = 3**4', '(81)'), # binary power
('a = 3*4', '(12)'), # binary multiply
('a = 13//4', '(3)'), # binary floor divide
('a = 14%4', '(2)'), # binary modulo
('a = 2+3', '(5)'), # binary add
('a = 13-4', '(9)'), # binary subtract
('a = (12,13)[1]', '(13)'), # binary subscr
('a = 13 << 2', '(52)'), # binary lshift
('a = 13 >> 2', '(3)'), # binary rshift
('a = 13 & 7', '(5)'), # binary and
('a = 13 ^ 7', '(10)'), # binary xor
('a = 13 | 7', '(15)'), # binary or
):
asm = dis_single(line)
print(asm)
assert elem in asm, 'ELEMENT not in asm'
assert 'BINARY_' not in asm, 'BINARY_in_asm'
# Verify that unfoldables are skipped
asm = dis_single('a=2+"b"')
assert '(2)' in asm
assert "('b')" in asm
# Verify that large sequences do not result from folding
asm = dis_single('a="x"*1000')
assert '(1000)' in asm
try:
test_folding_of_binops_on_constants()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 109, in <module>
test_folding_of_binops_on_constants()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 95, in test_folding_of_binops_on_constants
asm = dis_single(line)
^^^^^^^^^^^^^^^^
File "/tmp/pytest/usession-py3.12-1188/src.py", line 76, in dis_single
return disassemble(compile(line, '', 'single'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pytest/usession-py3.12-1188/src.py", line 69, in disassemble
dis.dis(func)
^^^
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 114, in dis
_disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 555, in _disassemble_recursive
disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 548, in disassemble
_disassemble_bytes(_get_code_array(co, adaptive),
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 586, in _disassemble_bytes
for instr in _get_instructions_bytes(code, varname_from_oparg, names,
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 483, in _get_instructions_bytes
elif deop == LOAD_SUPER_ATTR:
^^^^^^^^^^^^^^^
NameError: name 'LOAD_SUPER_ATTR' is not defined
___________________ AppTestOptimizer.test_optimize_list_comp ___________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p..._instructions_bytes
elif deop == BINARY_OP:
^^^^^^^^^
NameError: name 'BINARY_OP' is not defined
>
func = <function <lambda> at 0x7fc651c10dd0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_optimize_list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_optimize_list_comp'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_optimize_list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_optimize_list_comp'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_optimize_list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_optimize_list_comp'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_optimize_list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d1aaf0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d1af50>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d1af50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_optimize_list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d1a410>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d1ab40>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d1ab40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_optimize_list_comp'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_optimize_list_comp'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_optimize_list_comp'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_optimize_list_comp at 0x7fc6529ae450>
usemodules = None
definitions = {'is_pypy': <bound method AppTestOptimizer.w_is_pypy of <pypy.interpreter.test.test_compiler.AppTestOptimizer object at 0x7fc651c0b7d0>>, 'runappdirect': True}
defs = ["def w_is_pypy(self):\n import sys\n return not self.runappdirect or '__pypy__' in sys.modules", 'type(self).is_pypy = w_is_pypy\n', 'self.runappdirect = True\n']
symbol = 'runappdirect', value = True
code = <py._code.code.Code object at 0x7fc651c0b450>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 82, in <module>
E test_optimize_list_comp()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 76, in test_optimize_list_comp
E dis.dis(code)
E ^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 114, in dis
E _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 555, in _disassemble_recursive
E disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 548, in disassemble
E _disassemble_bytes(_get_code_array(co, adaptive),
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 586, in _disassemble_bytes
E for instr in _get_instructions_bytes(code, varname_from_oparg, names,
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 512, in _get_instructions_bytes
E elif deop == BINARY_OP:
E ^^^^^^^^^
E NameError: name 'BINARY_OP' is not defined
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_is_pypy(self):
import sys
return not self.runappdirect or '__pypy__' in sys.modules
type(self).is_pypy = w_is_pypy
self.runappdirect = True
def test_optimize_list_comp():
source = """def _f(a):
return [x for x in a if None]
"""
ns = {}
exec(source, ns)
code = ns['_f'].__code__
import sys, dis
from io import StringIO
s = StringIO()
out = sys.stdout
sys.stdout = s
try:
dis.dis(code)
finally:
sys.stdout = out
output = s.getvalue()
assert "LOAD_GLOBAL" not in output
try:
test_optimize_list_comp()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 82, in <module>
test_optimize_list_comp()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 76, in test_optimize_list_comp
dis.dis(code)
^^^
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 114, in dis
_disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 555, in _disassemble_recursive
disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 548, in disassemble
_disassemble_bytes(_get_code_array(co, adaptive),
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 586, in _disassemble_bytes
for instr in _get_instructions_bytes(code, varname_from_oparg, names,
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 512, in _get_instructions_bytes
elif deop == BINARY_OP:
^^^^^^^^^
NameError: name 'BINARY_OP' is not defined
___________________ AppTestOptimizer.test_call_method_kwargs ___________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...s
elif deop == LOAD_SUPER_ATTR:
^^^^^^^^^^^^^^^
NameError: name 'LOAD_SUPER_ATTR' is not defined
>
func = <function <lambda> at 0x7fc651acdad0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_call_method_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_call_method_kwargs'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_call_method_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_call_method_kwargs'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_call_method_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_call_method_kwargs'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_call_method_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651acafa0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...hod_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651acacd0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651acacd0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...hod_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_call_method_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651aca8c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...hod_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651acae60>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651acae60>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...hod_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_call_method_kwargs'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_call_method_kwargs'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_call_method_kwargs'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_call_method_kwargs at 0x7fc6529ae5d0>
usemodules = None
definitions = {'is_pypy': <bound method AppTestOptimizer.w_is_pypy of <pypy.interpreter.test.test_compiler.AppTestOptimizer object at 0x7fc651c48750>>, 'runappdirect': True}
defs = ["def w_is_pypy(self):\n import sys\n return not self.runappdirect or '__pypy__' in sys.modules", 'type(self).is_pypy = w_is_pypy\n', 'self.runappdirect = True\n']
symbol = 'runappdirect', value = True
code = <py._code.code.Code object at 0x7fc651c48d90>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 84, in <module>
E test_call_method_kwargs()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 78, in test_call_method_kwargs
E dis.dis(code)
E ^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 114, in dis
E _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 555, in _disassemble_recursive
E disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 548, in disassemble
E _disassemble_bytes(_get_code_array(co, adaptive),
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 586, in _disassemble_bytes
E for instr in _get_instructions_bytes(code, varname_from_oparg, names,
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 483, in _get_instructions_bytes
E elif deop == LOAD_SUPER_ATTR:
E ^^^^^^^^^^^^^^^
E NameError: name 'LOAD_SUPER_ATTR' is not defined
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_is_pypy(self):
import sys
return not self.runappdirect or '__pypy__' in sys.modules
type(self).is_pypy = w_is_pypy
self.runappdirect = True
def test_call_method_kwargs():
if not self.is_pypy():
skip("CALL_METHOD exists only on pypy")
source = """def _f(a):
return a.f(a=a)
"""
ns = {}
exec(source, ns)
code = ns['_f'].__code__
import sys, dis
from io import StringIO
s = StringIO()
out = sys.stdout
sys.stdout = s
try:
dis.dis(code)
finally:
sys.stdout = out
output = s.getvalue()
assert "CALL_METHOD" in output, output
try:
test_call_method_kwargs()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 84, in <module>
test_call_method_kwargs()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 78, in test_call_method_kwargs
dis.dis(code)
^^^
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 114, in dis
_disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 555, in _disassemble_recursive
disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 548, in disassemble
_disassemble_bytes(_get_code_array(co, adaptive),
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 586, in _disassemble_bytes
for instr in _get_instructions_bytes(code, varname_from_oparg, names,
File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/dis.py", line 483, in _get_instructions_bytes
elif deop == LOAD_SUPER_ATTR:
^^^^^^^^^^^^^^^
NameError: name 'LOAD_SUPER_ATTR' is not defined
____________ AppTestExceptions.test_asterror_has_line_without_file _____________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p.../src.py", line 60, in test_asterror_has_line_without_file
assert excinfo.value.text == "a/2 = 5\n"
AssertionError
>
func = <function <lambda> at 0x7fc651ac5950>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_asterror_has_line_without_file'...all__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_asterror_has_line_without_file'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_asterror_has_line_without_file'...all__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_asterror_has_line_without_file'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_asterror_has_line_without_file'...all__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_asterror_has_line_without_file'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_asterror_has_line_without_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651acab90>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...thout_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651aca910>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651aca910>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...thout_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_asterror_has_line_without_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651acaaf0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...thout_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651ade5a0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651ade5a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...thout_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_asterror_has_line_without_file'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_asterror_has_line_without_file'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_asterror_has_line_without_file'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_asterror_has_line_without_file at 0x7fc6529aea50>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 62, in <module>
E test_asterror_has_line_without_file()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 60, in test_asterror_has_line_without_file
E assert excinfo.value.text == "a/2 = 5\n"
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_asterror_has_line_without_file():
code = u"print(1)\na/2 = 5\n"
with raises(SyntaxError) as excinfo:
compile(code, 'not a file!', 'exec')
assert excinfo.value.text == "a/2 = 5\n"
try:
test_asterror_has_line_without_file()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 62, in <module>
test_asterror_has_line_without_file()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 60, in test_asterror_has_line_without_file
assert excinfo.value.text == "a/2 = 5\n"
AssertionError
______ AppTest_ModuleObject.test_repr_with_loader_with_valid_module_repr _______
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...r_with_valid_module_repr
assert repr(test_module) == "<module 'test_module': 'CustomLoader' Test>"
AssertionError
>
func = <function <lambda> at 0x7fc651d86a50>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_valid_mod..._MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_valid_mod..._MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_valid_mod..._MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d80f50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d80d20>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d80d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d80730>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d80910>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d80910>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_repr_with_loader_with_valid_module_repr'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_repr_with_loader_with_valid_module_repr at 0x7fc65225e3d0>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 73, in <module>
E test_repr_with_loader_with_valid_module_repr()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 71, in test_repr_with_loader_with_valid_module_repr
E assert repr(test_module) == "<module 'test_module': 'CustomLoader' Test>"
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_repr_with_loader_with_valid_module_repr():
import sys
test_module = type(sys)("test_module", "doc")
# If the module has a __loader__ and that loader has a module_repr()
# method, call it with a single argument, which is the module object.
# The value returned is used as the module's repr.
class CustomLoader:
@classmethod
def module_repr(cls, module):
mod_repr = ("<module {mod_name}: "
"{cls} Test>".format(mod_name=repr(module.__name__),
cls=repr(cls.__name__)))
return mod_repr
test_module.__loader__ = CustomLoader
assert repr(test_module) == "<module 'test_module': 'CustomLoader' Test>"
try:
test_repr_with_loader_with_valid_module_repr()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 73, in <module>
test_repr_with_loader_with_valid_module_repr()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 71, in test_repr_with_loader_with_valid_module_repr
assert repr(test_module) == "<module 'test_module': 'CustomLoader' Test>"
AssertionError
____ AppTest_ModuleObject.test_repr_with_loader_with_module_repr_wrong_type ____
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...ssion-py3.12-1188/src.py", line 35, in raises
raise AssertionError("DID NOT RAISE")
AssertionError: DID NOT RAISE
>
func = <function <lambda> at 0x7fc651d2c250>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_module_re...iCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_module_re...iCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_module_re...iCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d90eb0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d90af0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d90af0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d90820>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d90410>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d90410>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_repr_with_loader_with_module_repr_wrong_type'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_repr_with_loader_with_module_repr_wrong_type at 0x7fc65225e450>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 69, in <module>
E test_repr_with_loader_with_module_repr_wrong_type()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 67, in test_repr_with_loader_with_module_repr_wrong_type
E raises(TypeError, repr, test_module)
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 35, in raises
E raise AssertionError("DID NOT RAISE")
E AssertionError: DID NOT RAISE
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_repr_with_loader_with_module_repr_wrong_type():
import sys
test_module = type(sys)("test_module", "doc")
# This return value must be a string.
class BuggyCustomLoader:
@classmethod
def module_repr(cls, module):
return 5
test_module.__loader__ = BuggyCustomLoader
raises(TypeError, repr, test_module)
try:
test_repr_with_loader_with_module_repr_wrong_type()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 69, in <module>
test_repr_with_loader_with_module_repr_wrong_type()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 67, in test_repr_with_loader_with_module_repr_wrong_type
raises(TypeError, repr, test_module)
File "/tmp/pytest/usession-py3.12-1188/src.py", line 35, in raises
raise AssertionError("DID NOT RAISE")
AssertionError: DID NOT RAISE
_____ AppTest_ModuleObject.test_repr_with_loader_with_raising_module_repr2 _____
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...ssion-py3.12-1188/src.py", line 35, in raises
raise AssertionError("DID NOT RAISE")
AssertionError: DID NOT RAISE
>
func = <function <lambda> at 0x7fc651d5bcd0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_raising_m...ltiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_raising_m...ltiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_raising_m...ltiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651ad6910>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...dule_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651ad6af0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651ad6af0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...dule_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651ad6f50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...dule_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651ad6fa0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651ad6fa0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...dule_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_repr_with_loader_with_raising_module_repr2'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_repr_with_loader_with_raising_module_repr2 at 0x7fc65225e550>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 70, in <module>
E test_repr_with_loader_with_raising_module_repr2()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 68, in test_repr_with_loader_with_raising_module_repr2
E raises(KeyboardInterrupt, 'repr(test_module)')
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 35, in raises
E raise AssertionError("DID NOT RAISE")
E AssertionError: DID NOT RAISE
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_repr_with_loader_with_raising_module_repr2():
import sys
test_module = type(sys)("test_module", "doc")
# If an exception occurs in module_repr(), the exception is caught
# and discarded, and the calculation of the module's repr continues
# as if module_repr() did not exist.
class CustomLoaderWithRaisingRepr:
@classmethod
def module_repr(cls, module):
raise KeyboardInterrupt
test_module.__loader__ = CustomLoaderWithRaisingRepr
raises(KeyboardInterrupt, 'repr(test_module)')
try:
test_repr_with_loader_with_raising_module_repr2()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 70, in <module>
test_repr_with_loader_with_raising_module_repr2()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 68, in test_repr_with_loader_with_raising_module_repr2
raises(KeyboardInterrupt, 'repr(test_module)')
File "/tmp/pytest/usession-py3.12-1188/src.py", line 35, in raises
raise AssertionError("DID NOT RAISE")
AssertionError: DID NOT RAISE
_______________ AppTestSyntaxError.test_tokenizer_error_location _______________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...est/usession-py3.12-1188/src.py", line 62, in test_tokenizer_error_location
assert e.text == line4
AssertionError
>
func = <function <lambda> at 0x7fc651b873d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tokenizer_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_tokenizer_error_location'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tokenizer_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_tokenizer_error_location'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tokenizer_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_tokenizer_error_location'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tokenizer_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d4ba00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d4b2d0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d4b2d0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tokenizer_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651d4bd70>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d4b320>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d4b320>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tokenizer_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_tokenizer_error_location'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_tokenizer_error_location'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_tokenizer_error_location at 0x7fc6522d2c50>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 59, in test_tokenizer_error_location
E exec("print\nprint\nprint\n" + line4)
E File "<string>", line 4
E if ?: pass
E ^
E SyntaxError: invalid syntax
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 67, in <module>
E test_tokenizer_error_location()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 62, in test_tokenizer_error_location
E assert e.text == line4
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_tokenizer_error_location():
line4 = "if ?: pass\n"
try:
exec("print\nprint\nprint\n" + line4)
except SyntaxError as e:
assert e.lineno == 4
assert e.text == line4
assert e.offset == e.text.index('?') + 1
else:
raise Exception("no SyntaxError??")
try:
test_tokenizer_error_location()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 59, in test_tokenizer_error_location
exec("print\nprint\nprint\n" + line4)
File "<string>", line 4
if ?: pass
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 67, in <module>
test_tokenizer_error_location()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 62, in test_tokenizer_error_location
assert e.text == line4
AssertionError
________________ AppTestSyntaxError.test_grammar_error_location ________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...on-py3.12-1188/src.py", line 66, in test_grammar_error_location
assert e.text.endswith('a as e\n')
AssertionError
>
func = <function <lambda> at 0x7fc651b872d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_grammar_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_grammar_error_location'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_grammar_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_grammar_error_location'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_grammar_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_grammar_error_location'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_grammar_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc6519e27d0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc6519e2af0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc6519e2af0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_grammar_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc6519e29b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc6519e2c30>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc6519e2c30>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_grammar_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_grammar_error_location'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_grammar_error_location'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_grammar_error_location at 0x7fc6522d2cd0>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 58, in test_grammar_error_location
E exec("""if 1:
E File "<string>", line 4
E a as e
E ^^
E SyntaxError: invalid syntax
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 72, in <module>
E test_grammar_error_location()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 66, in test_grammar_error_location
E assert e.text.endswith('a as e\n')
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_grammar_error_location():
try:
exec("""if 1:
class Foo:
bla
a as e
bar
""")
except SyntaxError as e:
assert e.lineno == 4
assert e.text.endswith('a as e\n')
print(e.offset, e.text.index('as'))
assert e.offset == e.text.index('as') + 1 # offset is 1-based
else:
raise Exception("no SyntaxError??")
try:
test_grammar_error_location()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 58, in test_grammar_error_location
exec("""if 1:
File "<string>", line 4
a as e
^^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 72, in <module>
test_grammar_error_location()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 66, in test_grammar_error_location
assert e.text.endswith('a as e\n')
AssertionError
______________ AppTestSyntaxError.test_astbuilder_error_location _______________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p.../usession-py3.12-1188/src.py", line 62, in test_astbuilder_error_location
assert e.text == program
AssertionError
>
func = <function <lambda> at 0x7fc651b87150>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_astbuilder_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_astbuilder_error_location'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7fc656748f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_astbuilder_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_astbuilder_error_location'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_astbuilder_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_astbuilder_error_location'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_astbuilder_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651b892d0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d4b9b0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651d4b9b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_astbuilder_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7fc651c41640>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651c41f00>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7fc651c41f00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...r_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_astbuilder_error_location'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_astbuilder_error_location'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_astbuilder_error_location'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_astbuilder_error_location at 0x7fc6522d2d50>
usemodules = None, definitions = {}, defs = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 59, in test_astbuilder_error_location
E exec(program)
E File "<string>", line 1
E (1, 2) += (3, 4)
E ^^^^^^
E SyntaxError: 'tuple' is an illegal expression for augmented assignment
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 66, in <module>
E test_astbuilder_error_location()
E File "/tmp/pytest/usession-py3.12-1188/src.py", line 62, in test_astbuilder_error_location
E assert e.text == program
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def test_astbuilder_error_location():
program = "(1, 2) += (3, 4)\n"
try:
exec(program)
except SyntaxError as e:
assert e.lineno == 1
assert e.text == program
else:
raise Exception("no SyntaxError??")
try:
test_astbuilder_error_location()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1188/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 59, in test_astbuilder_error_location
exec(program)
File "<string>", line 1
(1, 2) += (3, 4)
^^^^^^
SyntaxError: 'tuple' is an illegal expression for augmented assignment
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1188/src.py", line 66, in <module>
test_astbuilder_error_location()
File "/tmp/pytest/usession-py3.12-1188/src.py", line 62, in test_astbuilder_error_location
assert e.text == program
AssertionError
=========================== short test summary info ============================
FAIL interpreter/test/test_compiler.py::AppTestCompiler::()::test_cpython_issue2301
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_folding_of_binops_on_constants
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_optimize_list_comp
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_call_method_kwargs
FAIL interpreter/test/test_compiler.py::AppTestExceptions::()::test_asterror_has_line_without_file
FAIL interpreter/test/test_module.py::AppTest_ModuleObject::()::test_repr_with_loader_with_valid_module_repr
FAIL interpreter/test/test_module.py::AppTest_ModuleObject::()::test_repr_with_loader_with_module_repr_wrong_type
FAIL interpreter/test/test_module.py::AppTest_ModuleObject::()::test_repr_with_loader_with_raising_module_repr2
FAIL interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_tokenizer_error_location
FAIL interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_grammar_error_location
FAIL interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_astbuilder_error_location
=============== 11 failed, 213 passed, 9 skipped in 9.86 seconds ===============
++ 17:15:07 starting objspace/test [4 started in total]
__ objspace/test [4 done in total, somefailed=False] __________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:15:09 starting objspace/std/test [5 started in total]
__ objspace/std/test [5 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 1522 items
objspace/std/test/test_bytearrayobject.py .....................................................................................
objspace/std/test/test_bytesobject.py ..............................................................................................
objspace/std/test/test_celldict.py ......sss
objspace/std/test/test_dictmultiobject.py ...........................................................................................................................................ssssssss
objspace/std/test/test_dictproxy.py ................
objspace/std/test/test_floatobject.py .................................................
objspace/std/test/test_identitydict.py sssss
objspace/std/test/test_identityset.py sssssss
objspace/std/test/test_index.py ...................................
objspace/std/test/test_intobject.py ..........................................................................................................................
objspace/std/test/test_jsondict.py ..........
objspace/std/test/test_kwargsdict.py sssssss
objspace/std/test/test_listobject.py ...................................................................................
objspace/std/test/test_longobject.py ...................................s...........
objspace/std/test/test_mapdict.py ..................ssssssssssssssssssssssssssssssssssssssssssssssss
objspace/std/test/test_memoryobject.py ..........................................
objspace/std/test/test_methodcache.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
objspace/std/test/test_newformat.py ...............................................................
objspace/std/test/test_obj.py ......................................
objspace/std/test/test_prebuiltint.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
objspace/std/test/test_proxy.py ssssssssssss
objspace/std/test/test_proxy_function.py ........
objspace/std/test/test_proxy_internals.py s......
objspace/std/test/test_proxy_iter.py .
objspace/std/test/test_proxy_object.py ..........
objspace/std/test/test_proxy_usercreated.py s
objspace/std/test/test_setobject.py ..........................................................................................
objspace/std/test/test_sliceobject.py ........
objspace/std/test/test_smalllongobject.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
objspace/std/test/test_specialisedtupleobject.py ...................
objspace/std/test/test_typeobject.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.....sssssssssssss
objspace/std/test/test_unicodeobject.py ....
objspace/std/test/test_userobject.py .
=================== 998 passed, 524 skipped in 35.22 seconds ===================
++ 17:15:47 starting module/__builtin__/test [6 started in total]
__ module/__builtin__/test [6 done in total, somefailed=False] ________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 282 items
module/__builtin__/test/test_abstractinst.py ...........
module/__builtin__/test/test_breakpoint.py ........
module/__builtin__/test/test_builtin.py .......................................................................
module/__builtin__/test/test_construct_singletons.py .
module/__builtin__/test/test_descriptor.py ...................................
module/__builtin__/test/test_dir.py ...........
module/__builtin__/test/test_filter.py ........
module/__builtin__/test/test_filter_pickle.py .....
module/__builtin__/test/test_format.py .
module/__builtin__/test/test_functional.py .......................................................................................
module/__builtin__/test/test_map_pickle.py ...
module/__builtin__/test/test_minmax.py .......................
module/__builtin__/test/test_rawinput.py ..
module/__builtin__/test/test_sum.py .
module/__builtin__/test/test_vars.py ...
module/__builtin__/test/test_zip.py ...........
module/__builtin__/test/test_zip_pickle.py .
========================== 282 passed in 8.47 seconds ==========================
++ 17:15:57 starting module/__pypy__/test [7 started in total]
__ module/__pypy__/test [7 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 75 items
module/__pypy__/test/test_builders.py .....
module/__pypy__/test/test_bytebuffer.py ...
module/__pypy__/test/test_debug.py sssssss
module/__pypy__/test/test_identitydict.py ......
module/__pypy__/test/test_intop.py ...........
module/__pypy__/test/test_locals2fast.py .....
module/__pypy__/test/test_magic.py .......s..
module/__pypy__/test/test_newmemoryview.py ........
module/__pypy__/test/test_os.py .
module/__pypy__/test/test_signal.py .....
module/__pypy__/test/test_special.py sssssssssss..s
==================== 55 passed, 20 skipped in 7.77 seconds =====================
++ 17:16:07 starting module/_abc/test [8 started in total]
__ module/_abc/test [8 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 3 items
module/_abc/test/test_abc.py ...
=========================== 3 passed in 0.10 seconds ===========================
++ 17:16:09 starting module/_ast/test [9 started in total]
__ module/_ast/test [9 done in total, somefailed=True] ________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 52 items
module/_ast/test/test_ast.py .........................F.....................F....
=================================== FAILURES ===================================
_________________________ AppTestAST.test_functiondef __________________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: required field 'type_params' missing from FunctionDef
>
func = <function <lambda> at 0x7f1290dfd6d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_functiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_functiondef'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f1293d1bf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_functiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_functiondef'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_functiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_functiondef'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_functiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f1290e4a780>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...unctiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290e4a690>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290e4a690>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...unctiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_functiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f1290e4ab40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...unctiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290dd2550>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290dd2550>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...unctiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_functiondef'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_functiondef'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_functiondef'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_functiondef at 0x7f1290e3d5d0>
usemodules = ['_struct', 'binascii']
definitions = {'ast': <module '_ast' (built-in)>, 'get_ast': <bound method AppTestAST.w_get_ast of <pypy.module._ast.test.test_ast.AppTestAST instance at 0x7f1290df4f50>>}
defs = ['import _ast; self.ast = _ast\n', 'def w_get_ast(self, source, mode="exec", flags=0, feature_version=-1):\n ast = ...ure_version=feature_version)\n assert isinstance(mod, ast.mod)\n return mod', 'type(self).get_ast = w_get_ast\n']
symbol = 'get_ast'
value = <bound method AppTestAST.w_get_ast of <pypy.module._ast.test.test_ast.AppTestAST instance at 0x7f1290df4f50>>
code = <py._code.code.Code object at 0x7f1290dd4e10>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1194/src.py", line 101, in <module>
E test_functiondef()
E File "/tmp/pytest/usession-py3.12-1194/src.py", line 94, in test_functiondef
E compiled = compile(exprAst, "<foo>", "single")
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: required field 'type_params' missing from FunctionDef
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_struct', 'binascii']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
import _ast; self.ast = _ast
def w_get_ast(self, source, mode="exec", flags=0, feature_version=-1):
ast = self.ast
mod = compile(source, "<test>", mode, ast.PyCF_ONLY_AST | flags, _feature_version=feature_version)
assert isinstance(mod, ast.mod)
return mod
type(self).get_ast = w_get_ast
def test_functiondef():
import ast as ast_utils
import _ast as ast
fAst = ast.FunctionDef(
name="foo",
args=ast.arguments(
args=[], vararg=None, kwarg=None, defaults=[],
kwonlyargs=[], kw_defaults=[], posonlyargs=[]),
body=[ast.Expr(ast.Constant('docstring', None))],
decorator_list=[], lineno=5, col_offset=0)
exprAst = ast.Interactive(body=[fAst])
ast_utils.fix_missing_locations(exprAst)
compiled = compile(exprAst, "<foo>", "single")
#
d = {}
eval(compiled, d, d)
assert type(d['foo']) is type(lambda: 42)
assert d['foo']() is None
try:
test_functiondef()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1194/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1194/src.py", line 101, in <module>
test_functiondef()
File "/tmp/pytest/usession-py3.12-1194/src.py", line 94, in test_functiondef
compiled = compile(exprAst, "<foo>", "single")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: required field 'type_params' missing from FunctionDef
___________ AppTestAST.test_fstring_self_documenting_feature_version ___________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...ssion-py3.12-1194/src.py", line 53, in raises
raise AssertionError("DID NOT RAISE")
AssertionError: DID NOT RAISE
>
func = <function <lambda> at 0x7f1290d3fbd0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_fstring_self_documenting_featur...MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_fstring_self_documenting_feature_version'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f1293d1bf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_fstring_self_documenting_featur...MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_fstring_self_documenting_feature_version'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_fstring_self_documenting_featur...MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_fstring_self_documenting_feature_version'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_fstring_self_documenting_feature_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f1290dd6050>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...re_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290dd6230>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290dd6230>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...re_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_fstring_self_documenting_feature_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f1290dd6190>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...re_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290dd61e0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f1290dd61e0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...re_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_fstring_self_documenting_feature_version'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_fstring_self_documenting_feature_version'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_fstring_self_documenting_feature_version'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_fstring_self_documenting_feature_version at 0x7f1290e3e150>
usemodules = ['_struct', 'binascii']
definitions = {'ast': <module '_ast' (built-in)>, 'get_ast': <bound method AppTestAST.w_get_ast of <pypy.module._ast.test.test_ast.AppTestAST instance at 0x7f1290e17640>>}
defs = ['import _ast; self.ast = _ast\n', 'def w_get_ast(self, source, mode="exec", flags=0, feature_version=-1):\n ast = ...ure_version=feature_version)\n assert isinstance(mod, ast.mod)\n return mod', 'type(self).get_ast = w_get_ast\n']
symbol = 'get_ast'
value = <bound method AppTestAST.w_get_ast of <pypy.module._ast.test.test_ast.AppTestAST instance at 0x7f1290e17640>>
code = <py._code.code.Code object at 0x7f1290daa210>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1194/src.py", line 86, in <module>
E test_fstring_self_documenting_feature_version()
E File "/tmp/pytest/usession-py3.12-1194/src.py", line 83, in test_fstring_self_documenting_feature_version
E raises(SyntaxError, self.get_ast, "f'{x=}'", feature_version=7)
E File "/tmp/pytest/usession-py3.12-1194/src.py", line 53, in raises
E raise AssertionError("DID NOT RAISE")
E AssertionError: DID NOT RAISE
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_struct', 'binascii']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
import _ast; self.ast = _ast
def w_get_ast(self, source, mode="exec", flags=0, feature_version=-1):
ast = self.ast
mod = compile(source, "<test>", mode, ast.PyCF_ONLY_AST | flags, _feature_version=feature_version)
assert isinstance(mod, ast.mod)
return mod
type(self).get_ast = w_get_ast
def test_fstring_self_documenting_feature_version():
raises(SyntaxError, self.get_ast, "f'{x=}'", feature_version=7)
self.get_ast("'f{x=}'", feature_version=7)
try:
test_fstring_self_documenting_feature_version()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1194/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1194/src.py", line 86, in <module>
test_fstring_self_documenting_feature_version()
File "/tmp/pytest/usession-py3.12-1194/src.py", line 83, in test_fstring_self_documenting_feature_version
raises(SyntaxError, self.get_ast, "f'{x=}'", feature_version=7)
File "/tmp/pytest/usession-py3.12-1194/src.py", line 53, in raises
raise AssertionError("DID NOT RAISE")
AssertionError: DID NOT RAISE
=========================== short test summary info ============================
FAIL module/_ast/test/test_ast.py::AppTestAST::()::test_functiondef
FAIL module/_ast/test/test_ast.py::AppTestAST::()::test_fstring_self_documenting_feature_version
===================== 2 failed, 50 passed in 2.07 seconds ======================
++ 17:16:12 starting module/_cffi_backend/test [10 started in total]
__ module/_cffi_backend/test [10 done in total, somefailed=False] _____________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 443 items
module/_cffi_backend/test/test_c.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
module/_cffi_backend/test/test_fastpath.py ..................
module/_cffi_backend/test/test_ffi_obj.py .............................................
module/_cffi_backend/test/test_re_python.py ....................
module/_cffi_backend/test/test_recompiler.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
module/_cffi_backend/test/test_unicode_literals.py .......
==================== 90 passed, 353 skipped in 4.09 seconds ====================
++ 17:16:18 starting module/_codecs/test [11 started in total]
__ module/_codecs/test [11 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 89 items
module/_codecs/test/test_codecs.py ....................sss..................................................................
===================== 86 passed, 3 skipped in 3.01 seconds =====================
++ 17:16:22 starting module/_collections/test [12 started in total]
__ module/_collections/test [12 done in total, somefailed=False] ______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:16:24 starting module/_continuation/test [13 started in total]
__ module/_continuation/test [13 done in total, somefailed=False] _____________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 72 items / 2 skipped
module/_continuation/test/test_generator.py ....
module/_continuation/test/test_greenlet.py ............................
module/_continuation/test/test_stacklet.py ........................................
===================== 72 passed, 2 skipped in 2.92 seconds =====================
++ 17:16:28 starting module/_cppyy/test [14 started in total]
__ module/_cppyy/test [14 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:16:30 starting module/_csv/test [15 started in total]
__ module/_csv/test [15 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 27 items
module/_csv/test/test_dialect.py ..............
module/_csv/test/test_reader.py .............
========================== 27 passed in 0.83 seconds ===========================
++ 17:16:32 starting module/_demo/test [16 started in total]
__ module/_demo/test [16 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 1 items
module/_demo/test/test_sieve.py s
========================== 1 skipped in 0.04 seconds ===========================
++ 17:16:34 starting module/_hpy_universal/test/_vendored [17 started in total]
__ module/_hpy_universal/test/_vendored [17 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.01 seconds =========================
++ 17:16:36 starting module/_hpy_universal/test/pypy [18 started in total]
__ module/_hpy_universal/test/pypy [18 done in total, somefailed=False] _______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:16:38 starting module/_io/test [19 started in total]
__ module/_io/test [19 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 134 items / 1 skipped
module/_io/test/test_bufferedio.py .................................................s.....................................................
module/_io/test/test_fileio.py ...............................
==================== 133 passed, 2 skipped in 5.52 seconds =====================
++ 17:16:44 starting module/_jitlog/test [20 started in total]
__ module/_jitlog/test [20 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 1 items
module/_jitlog/test/test__jitlog.py .
=========================== 1 passed in 0.05 seconds ===========================
++ 17:16:46 starting module/_locale/test [21 started in total]
__ module/_locale/test [21 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 15 items
module/_locale/test/test_locale.py ssssssssssssss.
===================== 1 passed, 14 skipped in 0.05 seconds =====================
++ 17:16:48 starting module/_lsprof/test [22 started in total]
__ module/_lsprof/test [22 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 6 items
module/_lsprof/test/test_cprofile.py ......
=========================== 6 passed in 1.19 seconds ===========================
++ 17:16:50 starting module/_md5/test [23 started in total]
__ module/_md5/test [23 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 8 items
module/_md5/test/test_md5.py ........
=========================== 8 passed in 0.24 seconds ===========================
++ 17:16:52 starting module/_minimal_curses/test [24 started in total]
__ module/_minimal_curses/test [24 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:16:54 starting module/_multibytecodec/test [25 started in total]
__ module/_multibytecodec/test [25 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 3 items
module/_multibytecodec/test/test_multibtye_codecs.py ...
=========================== 3 passed in 0.14 seconds ===========================
++ 17:16:56 starting module/_multiprocessing/test [26 started in total]
__ module/_multiprocessing/test [26 done in total, somefailed=False] __________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 10 items
module/_multiprocessing/test/test_semaphore.py .........
module/_multiprocessing/test/test_win32.py s
===================== 9 passed, 1 skipped in 0.64 seconds ======================
++ 17:16:58 starting module/_opcode/test [27 started in total]
__ module/_opcode/test [27 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:17:00 starting module/_pickle/test [28 started in total]
__ module/_pickle/test [28 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:17:02 starting module/_pickle_support/test [29 started in total]
__ module/_pickle_support/test [29 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:17:03 starting module/_posixsubprocess/test [30 started in total]
__ module/_posixsubprocess/test [30 done in total, somefailed=False] __________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.18 seconds =========================
++ 17:17:05 starting module/_pypyjson/test [31 started in total]
__ module/_pypyjson/test [31 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 29 items
module/_pypyjson/test/test__pypyjson.py .............................
========================== 29 passed in 1.10 seconds ===========================
++ 17:17:08 starting module/_random/test [32 started in total]
__ module/_random/test [32 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 12 items
module/_random/test/test_random.py ............
========================== 12 passed in 0.50 seconds ===========================
++ 17:17:09 starting module/_rawffi/alt/test [33 started in total]
__ module/_rawffi/alt/test [33 done in total, somefailed=False] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 61 items
module/_rawffi/alt/test/test_ffitype.py .....
module/_rawffi/alt/test/test_funcptr.py ....ss....................................
module/_rawffi/alt/test/test_struct.py ..............
===================== 59 passed, 2 skipped in 2.37 seconds =====================
++ 17:17:14 starting module/_rawffi/test [34 started in total]
__ module/_rawffi/test [34 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 79 items
module/_rawffi/test/test__rawffi.py .....................................................................
module/_rawffi/test/test_exit.py .
module/_rawffi/test/test_nested.py ......
module/_rawffi/test/test_tracker.py sss
===================== 76 passed, 3 skipped in 2.71 seconds =====================
++ 17:17:18 starting module/_socket/test [35 started in total]
__ module/_socket/test [35 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.79 seconds =========================
++ 17:17:21 starting module/_sre/test [36 started in total]
__ module/_sre/test [36 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 94 items
module/_sre/test/test_app_sre.py ..............................ssssssssssssssssssssssssssssssssssss
module/_sre/test/test_sre_buf.py ............................
==================== 58 passed, 36 skipped in 2.88 seconds =====================
++ 17:17:25 starting module/_vmprof/test [37 started in total]
__ module/_vmprof/test [37 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 5 items
module/_vmprof/test/test__vmprof.py .....
=========================== 5 passed in 0.42 seconds ===========================
++ 17:17:27 starting module/_warnings/test [38 started in total]
__ module/_warnings/test [38 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:17:29 starting module/_weakref/test [39 started in total]
__ module/_weakref/test [39 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:17:30 starting module/_winreg/test [40 started in total]
__ module/_winreg/test [40 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items / 1 skipped
========================== 1 skipped in 0.01 seconds ===========================
++ 17:17:32 starting module/array/test [41 started in total]
__ module/array/test [41 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 60 items
module/array/test/test_array.py ............................................................
========================== 60 passed in 1.89 seconds ===========================
++ 17:17:35 starting module/atexit/test [42 started in total]
__ module/atexit/test [42 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:17:37 starting module/binascii/test [43 started in total]
__ module/binascii/test [43 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 18 items
module/binascii/test/test_binascii.py ..................
========================== 18 passed in 0.62 seconds ===========================
++ 17:17:40 starting module/bz2/test [44 started in total]
__ module/bz2/test [44 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 45 items
module/bz2/test/test_bz2_compdecomp.py ssssssssssssssss
module/bz2/test/test_bz2_file.py ssssssssssssssssssssssssssss
module/bz2/test/test_large.py s
========================== 45 skipped in 1.53 seconds ==========================
++ 17:17:43 starting module/cmath/test [45 started in total]
__ module/cmath/test [45 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 16 items
module/cmath/test/test_cmath.py ................
========================== 16 passed in 0.48 seconds ===========================
++ 17:17:45 starting module/cpyext/test [46 started in total]
__ module/cpyext/test [46 done in total, somefailed=True] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 446 items / 1 skipped
module/cpyext/test/test_arraymodule.py ..........x.......
module/cpyext/test/test_async_iter.py sss
module/cpyext/test/test_boolobject.py ...
module/cpyext/test/test_borrow.py ...
module/cpyext/test/test_buffer.py .....
module/cpyext/test/test_bytearrayobject.py ......
module/cpyext/test/test_bytesobject.py .........
module/cpyext/test/test_capsule.py ...
module/cpyext/test/test_cell.py .
module/cpyext/test/test_classobject.py ..
module/cpyext/test/test_codecs.py .
module/cpyext/test/test_complexobject.py .....
module/cpyext/test/test_contextvars.py .
module/cpyext/test/test_cpyext.py s....F...........s..s....
module/cpyext/test/test_datetime.py ....F..
module/cpyext/test/test_dictobject.py ...........
module/cpyext/test/test_eval.py .........
module/cpyext/test/test_exception.py ..
module/cpyext/test/test_fileobject.py .
module/cpyext/test/test_floatobject.py ............
module/cpyext/test/test_frameobject.py ....
module/cpyext/test/test_funcobject.py .......
module/cpyext/test/test_genobject.py ..
module/cpyext/test/test_getargs.py ................
module/cpyext/test/test_import.py ..
module/cpyext/test/test_iterator.py ..
module/cpyext/test/test_listobject.py .....
module/cpyext/test/test_longobject.py ...............
module/cpyext/test/test_marshal.py ..
module/cpyext/test/test_memoryobject.py .s.........
module/cpyext/test/test_methodobject.py ............FF
module/cpyext/test/test_misc.py .
module/cpyext/test/test_module.py .......................
module/cpyext/test/test_namespaceobject.py F
module/cpyext/test/test_number.py ...
module/cpyext/test/test_object.py ...................
module/cpyext/test/test_pyerrors.py .............s.........
module/cpyext/test/test_pymem.py .
module/cpyext/test/test_pysignals.py .
module/cpyext/test/test_pystate.py ....x.......
module/cpyext/test/test_pystrhex.py .
module/cpyext/test/test_pystrtod.py .
module/cpyext/test/test_sequence.py ....
module/cpyext/test/test_setobject.py .
module/cpyext/test/test_sliceobject.py ......
module/cpyext/test/test_structseq.py .
module/cpyext/test/test_sysmodule.py ...
module/cpyext/test/test_thread.py sssss.
module/cpyext/test/test_tupleobject.py .....
module/cpyext/test/test_typeobject.py .........................................................................................
module/cpyext/test/test_unicodeobject.py ..............................
module/cpyext/test/test_userslots.py ....
module/cpyext/test/test_version.py .s
module/cpyext/test/test_weakref.py ..
=================================== FAILURES ===================================
__________________ AppTestCpythonExtension.test_load_dynamic ___________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p.../usession-py3.12-1231/src.py", line 143, in test_load_dynamic
assert foo.__dict__ == foo2.__dict__
AssertionError
>
func = <function <lambda> at 0x7f4863726250>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_load_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_load_dynamic'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f486917cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_load_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_load_dynamic'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_load_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_load_dynamic'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_load_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863721190>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...ad_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863721960>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863721960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...ad_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_load_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863721a50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...ad_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f48637214b0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f48637214b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...ad_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_load_dynamic'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_load_dynamic'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_load_dynamic'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_load_dynamic at 0x7f4863f95150>
usemodules = ['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', ...]
definitions = {'compile_module': <bound method AppTestCpythonExtension.w_compile_module of <pypy.module.cpyext.test.test_cpyext.AppT...ion.w_import_extension of <pypy.module.cpyext.test.test_cpyext.AppTestCpythonExtension object at 0x7f4863722a10>>, ...}
defs = ['def w_compile_module(self, name,\n source_files=None, source_strings=None):\n from extbuild import get_sys...e=prologue,\n include_dirs=include_dirs, more_init=more_init,\n PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)', ...]
symbol = 'udir', value = u'/tmp/pytest/usession-py3.12-1231'
code = <py._code.code.Code object at 0x7f4863722650>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 145, in <module>
E test_load_dynamic()
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 143, in test_load_dynamic
E assert foo.__dict__ == foo2.__dict__
E AssertionError
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_signal', '_cffi_backend']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_compile_module(self, name,
source_files=None, source_strings=None):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
type(self).compile_module = w_compile_module
def w_debug_collect(self):
import gc
gc.collect()
gc.collect()
gc.collect()
type(self).debug_collect = w_debug_collect
self.here = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/module/cpyext/test'
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_extension = w_import_extension
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
include_dirs=include_dirs,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_module = w_import_module
def w_load_module(self, mod, name):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
type(self).load_module = w_load_module
self.runappdirect = True
self.udir = '/tmp/pytest/usession-py3.12-1231'
def test_load_dynamic():
import sys
body = """
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"%(modname)s", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
NULL, /* m_methods */
};
"""
foo = self.import_module(name='foo', body=body, use_imp=True)
assert 'foo' in sys.modules
del sys.modules['foo']
# replaces imp.load_dynamic('foo', foo.__file__), removed in 3.12
import importlib.machinery, importlib.util
loader = importlib.machinery.ExtensionFileLoader('foo', foo.__file__)
spec = importlib.util.spec_from_file_location(
'foo', foo.__file__, loader=loader)
foo2 = importlib.util.module_from_spec(spec)
sys.modules['foo'] = foo2
loader.exec_module(foo2)
assert 'foo' in sys.modules
assert foo.__dict__ == foo2.__dict__
try:
test_load_dynamic()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1231/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1231/src.py", line 145, in <module>
test_load_dynamic()
File "/tmp/pytest/usession-py3.12-1231/src.py", line 143, in test_load_dynamic
assert foo.__dict__ == foo2.__dict__
AssertionError
_________________________ AppTestDatetime.test_tzinfo __________________________
self = <CallInfo when='call' exception: Subprocess failed with exit code -11:
>
func = <function <lambda> at 0x7f4863387ed0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_tzinfo'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f486917cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_tzinfo'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_tzinfo'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863723fa0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863723500>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863723500>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f48634200a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863420140>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863420140>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_tzinfo'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_tzinfo'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_tzinfo'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_tzinfo at 0x7f4863ed5c50>
usemodules = ['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', ...]
definitions = {'compile_module': <bound method AppTestDatetime.w_compile_module of <pypy.module.cpyext.test.test_datetime.AppTestDat...tDatetime.w_import_extension of <pypy.module.cpyext.test.test_datetime.AppTestDatetime object at 0x7f4863735c10>>, ...}
defs = ['def w_compile_module(self, name,\n source_files=None, source_strings=None):\n from extbuild import get_sys...e=prologue,\n include_dirs=include_dirs, more_init=more_init,\n PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)', ...]
symbol = 'udir', value = u'/tmp/pytest/usession-py3.12-1231'
code = <py._code.code.Code object at 0x7f4863710710>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code -11:
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_signal', '_cffi_backend']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_compile_module(self, name,
source_files=None, source_strings=None):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
type(self).compile_module = w_compile_module
def w_debug_collect(self):
import gc
gc.collect()
gc.collect()
gc.collect()
type(self).debug_collect = w_debug_collect
self.here = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/module/cpyext/test'
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_extension = w_import_extension
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
include_dirs=include_dirs,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_module = w_import_module
def w_load_module(self, mod, name):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
type(self).load_module = w_load_module
self.runappdirect = True
self.udir = '/tmp/pytest/usession-py3.12-1231'
def test_tzinfo():
module = self.import_extension('foo', [
("time_with_tzinfo", "METH_O",
""" PyDateTime_IMPORT;
return PyDateTimeAPI->Time_FromTime(
6, 6, 6, 6, args, PyDateTimeAPI->TimeType);
"""),
("datetime_with_tzinfo", "METH_O",
"""
PyObject * obj;
int tzrefcnt = args->ob_refcnt;
PyDateTime_IMPORT;
obj = PyDateTimeAPI->DateTime_FromDateAndTime(
2000, 6, 6, 6, 6, 6, 6, args,
PyDateTimeAPI->DateTimeType);
if (!((PyDateTime_DateTime*)obj)->hastzinfo)
{
Py_DECREF(obj);
PyErr_SetString(PyExc_ValueError, "missing tzinfo");
return NULL;
}
if (((PyDateTime_DateTime*)obj)->tzinfo->ob_refcnt <= tzrefcnt)
{
Py_DECREF(obj);
PyErr_SetString(PyExc_ValueError, "tzinfo refcnt not incremented");
return NULL;
}
return obj;
"""),
], prologue='#include "datetime.h"\n')
from datetime import tzinfo, datetime, timedelta, time
# copied from datetime documentation
class GMT1(tzinfo):
def __del__(self):
print('deleting GMT1')
def utcoffset(self, dt):
return timedelta(hours=1) + self.dst(dt)
def dst(self, dt):
return timedelta(0)
def tzname(self,dt):
return "GMT +1"
gmt1 = GMT1()
dt1 = module.time_with_tzinfo(gmt1)
assert dt1 == time(6, 6, 6, 6, gmt1)
assert '+01' in str(dt1)
dt_tz = module.datetime_with_tzinfo(gmt1)
assert dt_tz == datetime(2000, 6, 6, 6, 6, 6, 6, gmt1)
try:
test_tzinfo()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1231/src.py
----------------------------- Captured stderr call -----------------------------
_____________________ AppTestMethodObject.test_module_name _____________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
test_func.c: In function ‘__Pyx_PyCode_New’:
...)
distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
>
func = <function <lambda> at 0x7f486332a6d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_module_name'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f486917cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_module_name'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_module_name'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863328d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f48633284b0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f48633284b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f48633288c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863328320>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863328320>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_module_name'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_module_name'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_module_name at 0x7f4863d79450>
usemodules = ['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', ...]
definitions = {'compile_module': <bound method AppTestMethodObject.w_compile_module of <pypy.module.cpyext.test.test_methodobject.Ap...t.w_import_extension of <pypy.module.cpyext.test.test_methodobject.AppTestMethodObject object at 0x7f4863324410>>, ...}
defs = ['def w_compile_module(self, name,\n source_files=None, source_strings=None):\n from extbuild import get_sys...e=prologue,\n include_dirs=include_dirs, more_init=more_init,\n PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)', ...]
symbol = 'udir', value = u'/tmp/pytest/usession-py3.12-1231'
code = <py._code.code.Code object at 0x7f4863324310>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E test_func.c: In function ‘__Pyx_PyCode_New’:
E test_func.c:592:9: error: implicit declaration of function ‘PyUnstable_Code_NewWithPosOnlyArgs’; did you mean ‘PyPyCode_NewWithPosOnlyArgs’? [-Werror=implicit-function-declaration]
E 592 | PyUnstable_Code_NewWithPosOnlyArgs
E | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E | PyPyCode_NewWithPosOnlyArgs
E test_func.c:590:12: warning: assignment to ‘PyCodeObject *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
E 590 | result =
E | ^
E cc1: some warnings being treated as errors
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn
E subprocess.check_call(cmd, env=_inject_macos_ver(env))
E ^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/subprocess.py", line 413, in check_call
E raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-64/build/include/pypy3.12', '-c', 'test_func.c', '-o', 'test_func.o']' returned non-zero exit status 1.
E
E The above exception was the direct cause of the following exception:
E
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile
E self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
E ^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1151, in spawn
E spawn(cmd, **kwargs)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn
E raise DistutilsExecError(
E distutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 125, in <module>
E test_module_name()
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 122, in test_module_name
E mod = self.import_module(name="test_func")
E ^^^^^^^^^^^^^
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 105, in w_import_module
E return sys_info.import_module(
E ^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module
E mod = self.compile_extension_module(
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module
E soname = c_compile(source_files, outputfilename=str(dirname / modname),
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile
E _build(
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 233, in _build
E res = compiler.compile([cfile.basename],
E ^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 648, in compile
E self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
E ^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile
E raise CompileError(msg)
E distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_signal', '_cffi_backend']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_compile_module(self, name,
source_files=None, source_strings=None):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
type(self).compile_module = w_compile_module
def w_debug_collect(self):
import gc
gc.collect()
gc.collect()
gc.collect()
type(self).debug_collect = w_debug_collect
self.here = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/module/cpyext/test'
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_extension = w_import_extension
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
include_dirs=include_dirs,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_module = w_import_module
def w_load_module(self, mod, name):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
type(self).load_module = w_load_module
self.runappdirect = True
self.udir = '/tmp/pytest/usession-py3.12-1231'
def test_module_name():
# issue 3993
mod = self.import_module(name="test_func")
assert mod.f.__module__ == "test_func"
try:
test_module_name()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1231/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
test_func.c: In function \u2018__Pyx_PyCode_New\u2019:\ntest_func.c:592:9: error: implicit declaration of function \u2018PyUnstable_Code_NewWithPosOnlyArgs\u2019; did you mean \u2018PyPyCode_NewWithPosOnlyArgs\u2019? [-Werror=implicit-function-declaration]\n 592 | PyUnstable_Code_NewWithPosOnlyArgs\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n | PyPyCode_NewWithPosOnlyArgs\ntest_func.c:590:12: warning: assignment to \u2018PyCodeObject *\u2019 from \u2018int\u2019 makes pointer from integer without a cast [-Wint-conversion]\n 590 | result =\n | ^\ncc1: some warnings being treated as errors\nTraceback (most recent call last):\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn\n subprocess.check_call(cmd, env=_inject_macos_ver(env))\n ^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/subprocess.py", line 413, in check_call\n raise CalledProcessError(retcode, cmd)\nsubprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-64/build/include/pypy3.12', '-c', 'test_func.c', '-o', 'test_func.o']' returned non-zero exit status 1.\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile\n self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)\n ^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1151, in spawn\n spawn(cmd, **kwargs)\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn\n raise DistutilsExecError(\ndistutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 125, in <module>\n test_module_name()\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 122, in test_module_name\n mod = self.import_module(name="test_func")\n ^^^^^^^^^^^^^\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 105, in w_import_module\n return sys_info.import_module(\n ^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module\n mod = self.compile_extension_module(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module\n soname = c_compile(source_files, outputfilename=str(dirname / modname),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile\n _build(\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 233, in _build\n res = compiler.compile([cfile.basename],\n ^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 648, in compile\n self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)\n ^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile\n raise CompileError(msg)\ndistutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1\n
_______________________ AppTestMethodObject.test_min_max _______________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
builtin_min_max.c:10401:5: warning: excess elemen...)
distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
>
func = <function <lambda> at 0x7f4863731050>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_min_max'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f486917cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_min_max'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_min_max'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863341a50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f48633415f0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f48633415f0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863341460>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863341b40>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863341b40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_min_max'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_min_max'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_min_max at 0x7f4863d794d0>
usemodules = ['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', ...]
definitions = {'compile_module': <bound method AppTestMethodObject.w_compile_module of <pypy.module.cpyext.test.test_methodobject.Ap...t.w_import_extension of <pypy.module.cpyext.test.test_methodobject.AppTestMethodObject object at 0x7f4863336890>>, ...}
defs = ['def w_compile_module(self, name,\n source_files=None, source_strings=None):\n from extbuild import get_sys...e=prologue,\n include_dirs=include_dirs, more_init=more_init,\n PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)', ...]
symbol = 'udir', value = u'/tmp/pytest/usession-py3.12-1231'
code = <py._code.code.Code object at 0x7f4863336ed0>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E builtin_min_max.c:10401:5: warning: excess elements in struct initializer
E 10401 | 0,
E | ^
E builtin_min_max.c:10401:5: note: (near initialization for ‘__pyx_CyFunctionType_type’)
E builtin_min_max.c: In function ‘__Pyx__PyCode_New’:
E builtin_min_max.c:11865:9: error: implicit declaration of function ‘PyUnstable_Code_NewWithPosOnlyArgs’; did you mean ‘PyPyCode_NewWithPosOnlyArgs’? [-Werror=implicit-function-declaration]
E 11865 | PyUnstable_Code_NewWithPosOnlyArgs
E | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E | PyPyCode_NewWithPosOnlyArgs
E builtin_min_max.c:11863:12: warning: assignment to ‘PyCodeObject *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
E 11863 | result =
E | ^
E cc1: some warnings being treated as errors
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn
E subprocess.check_call(cmd, env=_inject_macos_ver(env))
E ^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/subprocess.py", line 413, in check_call
E raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-64/build/include/pypy3.12', '-c', 'builtin_min_max.c', '-o', 'builtin_min_max.o']' returned non-zero exit status 1.
E
E The above exception was the direct cause of the following exception:
E
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile
E self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
E ^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1151, in spawn
E spawn(cmd, **kwargs)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn
E raise DistutilsExecError(
E distutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 124, in <module>
E test_min_max()
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 121, in test_min_max
E mod = self.import_module(name="builtin_min_max")
E ^^^^^^^^^^^^^
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 105, in w_import_module
E return sys_info.import_module(
E ^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module
E mod = self.compile_extension_module(
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module
E soname = c_compile(source_files, outputfilename=str(dirname / modname),
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile
E _build(
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 233, in _build
E res = compiler.compile([cfile.basename],
E ^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 648, in compile
E self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
E ^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile
E raise CompileError(msg)
E distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_signal', '_cffi_backend']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_compile_module(self, name,
source_files=None, source_strings=None):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
type(self).compile_module = w_compile_module
def w_debug_collect(self):
import gc
gc.collect()
gc.collect()
gc.collect()
type(self).debug_collect = w_debug_collect
self.here = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/module/cpyext/test'
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_extension = w_import_extension
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
include_dirs=include_dirs,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_module = w_import_module
def w_load_module(self, mod, name):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
type(self).load_module = w_load_module
self.runappdirect = True
self.udir = '/tmp/pytest/usession-py3.12-1231'
def test_min_max():
mod = self.import_module(name="builtin_min_max")
mod.test_max2()
try:
test_min_max()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1231/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
builtin_min_max.c:10401:5: warning: excess elements in struct initializer\n10401 | 0,\n | ^\nbuiltin_min_max.c:10401:5: note: (near initialization for \u2018__pyx_CyFunctionType_type\u2019)\nbuiltin_min_max.c: In function \u2018__Pyx__PyCode_New\u2019:\nbuiltin_min_max.c:11865:9: error: implicit declaration of function \u2018PyUnstable_Code_NewWithPosOnlyArgs\u2019; did you mean \u2018PyPyCode_NewWithPosOnlyArgs\u2019? [-Werror=implicit-function-declaration]\n11865 | PyUnstable_Code_NewWithPosOnlyArgs\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n | PyPyCode_NewWithPosOnlyArgs\nbuiltin_min_max.c:11863:12: warning: assignment to \u2018PyCodeObject *\u2019 from \u2018int\u2019 makes pointer from integer without a cast [-Wint-conversion]\n11863 | result =\n | ^\ncc1: some warnings being treated as errors\nTraceback (most recent call last):\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn\n subprocess.check_call(cmd, env=_inject_macos_ver(env))\n ^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/subprocess.py", line 413, in check_call\n raise CalledProcessError(retcode, cmd)\nsubprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-64/build/include/pypy3.12', '-c', 'builtin_min_max.c', '-o', 'builtin_min_max.o']' returned non-zero exit status 1.\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile\n self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)\n ^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1151, in spawn\n spawn(cmd, **kwargs)\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn\n raise DistutilsExecError(\ndistutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 124, in <module>\n test_min_max()\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 121, in test_min_max\n mod = self.import_module(name="builtin_min_max")\n ^^^^^^^^^^^^^\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 105, in w_import_module\n return sys_info.import_module(\n ^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module\n mod = self.compile_extension_module(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module\n soname = c_compile(source_files, outputfilename=str(dirname / modname),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile\n _build(\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 233, in _build\n res = compiler.compile([cfile.basename],\n ^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 648, in compile\n self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)\n ^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile\n raise CompileError(msg)\ndistutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1\n
_________________________ AppTestNamespace.test_simple _________________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
source_0.c:5:14: error: #include expects "FILENAM...)
distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
>
func = <function <lambda> at 0x7f48632ef350>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_simple'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f486917cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_simple'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_simple'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863539b90>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863539a00>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863539a00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f4863539230>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863539640>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f4863539640>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...est_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_simple'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_simple'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_simple'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_simple at 0x7f4863d1ea50>
usemodules = ['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', ...]
definitions = {'compile_module': <bound method AppTestNamespace.w_compile_module of <pypy.module.cpyext.test.test_namespaceobject.Ap...e.w_import_extension of <pypy.module.cpyext.test.test_namespaceobject.AppTestNamespace object at 0x7f48632ecfd0>>, ...}
defs = ['def w_compile_module(self, name,\n source_files=None, source_strings=None):\n from extbuild import get_sys...e=prologue,\n include_dirs=include_dirs, more_init=more_init,\n PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)', ...]
symbol = 'udir', value = u'/tmp/pytest/usession-py3.12-1231'
code = <py._code.code.Code object at 0x7f486344b050>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E source_0.c:5:14: error: #include expects "FILENAME" or <FILENAME>
E 5 | #include pycore_namespace.h
E | ^~~~~~~~~~~~~~~~
E source_0.c: In function ‘ns_new’:
E source_0.c:9:24: error: implicit declaration of function ‘_PyNamespace_New’ [-Werror=implicit-function-declaration]
E 9 | return _PyNamespace_New(args);
E | ^~~~~~~~~~~~~~~~
E source_0.c:9:24: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
E 9 | return _PyNamespace_New(args);
E | ^~~~~~~~~~~~~~~~~~~~~~
E cc1: some warnings being treated as errors
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn
E subprocess.check_call(cmd, env=_inject_macos_ver(env))
E ^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/subprocess.py", line 413, in check_call
E raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-64/build/include/pypy3.12', '-c', 'source_0.c', '-o', 'source_0.o']' returned non-zero exit status 1.
E
E The above exception was the direct cause of the following exception:
E
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile
E self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
E ^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1151, in spawn
E spawn(cmd, **kwargs)
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn
E raise DistutilsExecError(
E distutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 129, in <module>
E test_simple()
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 122, in test_simple
E module = self.import_extension('ns', [
E ^^^^^^^^^^^^^^^^
E File "/tmp/pytest/usession-py3.12-1231/src.py", line 95, in w_import_extension
E return sys_info.import_extension(
E ^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 96, in import_extension
E return self.import_module(
E ^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module
E mod = self.compile_extension_module(
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module
E soname = c_compile(source_files, outputfilename=str(dirname / modname),
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile
E _build(
E File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 233, in _build
E res = compiler.compile([cfile.basename],
E ^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 648, in compile
E self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
E ^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile
E raise CompileError(msg)
E distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_signal', '_cffi_backend']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_compile_module(self, name,
source_files=None, source_strings=None):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
type(self).compile_module = w_compile_module
def w_debug_collect(self):
import gc
gc.collect()
gc.collect()
gc.collect()
type(self).debug_collect = w_debug_collect
self.here = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/module/cpyext/test'
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_extension = w_import_extension
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
include_dirs=include_dirs,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_module = w_import_module
def w_load_module(self, mod, name):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
type(self).load_module = w_load_module
self.runappdirect = True
self.udir = '/tmp/pytest/usession-py3.12-1231'
def test_simple():
from types import SimpleNamespace
module = self.import_extension('ns', [
("new", "METH_O",
"""
return _PyNamespace_New(args);
""")], prologue="#include pycore_namespace.h")
assert module.new({'a': 1, 'b': 2}) == SimpleNamespace(a=1, b=2)
try:
test_simple()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1231/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
source_0.c:5:14: error: #include expects "FILENAME" or <FILENAME>\n 5 | #include pycore_namespace.h\n | ^~~~~~~~~~~~~~~~\nsource_0.c: In function \u2018ns_new\u2019:\nsource_0.c:9:24: error: implicit declaration of function \u2018_PyNamespace_New\u2019 [-Werror=implicit-function-declaration]\n 9 | return _PyNamespace_New(args);\n | ^~~~~~~~~~~~~~~~\nsource_0.c:9:24: warning: returning \u2018int\u2019 from a function with return type \u2018PyObject *\u2019 {aka \u2018struct _object *\u2019} makes pointer from integer without a cast [-Wint-conversion]\n 9 | return _PyNamespace_New(args);\n | ^~~~~~~~~~~~~~~~~~~~~~\ncc1: some warnings being treated as errors\nTraceback (most recent call last):\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn\n subprocess.check_call(cmd, env=_inject_macos_ver(env))\n ^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib-python/3/subprocess.py", line 413, in check_call\n raise CalledProcessError(retcode, cmd)\nsubprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-64/build/include/pypy3.12', '-c', 'source_0.c', '-o', 'source_0.o']' returned non-zero exit status 1.\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile\n self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)\n ^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1151, in spawn\n spawn(cmd, **kwargs)\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn\n raise DistutilsExecError(\ndistutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 129, in <module>\n test_simple()\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 122, in test_simple\n module = self.import_extension('ns', [\n ^^^^^^^^^^^^^^^^\n File "/tmp/pytest/usession-py3.12-1231/src.py", line 95, in w_import_extension\n return sys_info.import_extension(\n ^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 96, in import_extension\n return self.import_module(\n ^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module\n mod = self.compile_extension_module(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module\n soname = c_compile(source_files, outputfilename=str(dirname / modname),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile\n _build(\n File "/build_dir/pypy-c-jit-linux-x86-64/build/pypy/tool/cpyext/extbuild.py", line 233, in _build\n res = compiler.compile([cfile.basename],\n ^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 648, in compile\n self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)\n ^^^^^^^^\n File "/build_dir/pypy-c-jit-linux-x86-64/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile\n raise CompileError(msg)\ndistutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1\n
=========================== short test summary info ============================
FAIL module/cpyext/test/test_cpyext.py::AppTestCpythonExtension::()::test_load_dynamic
FAIL module/cpyext/test/test_datetime.py::AppTestDatetime::()::test_tzinfo
FAIL module/cpyext/test/test_methodobject.py::AppTestMethodObject::()::test_module_name
FAIL module/cpyext/test/test_methodobject.py::AppTestMethodObject::()::test_min_max
FAIL module/cpyext/test/test_namespaceobject.py::AppTestNamespace::()::test_simple
======== 5 failed, 425 passed, 15 skipped, 2 xfailed in 240.75 seconds =========
++ 17:21:51 starting module/crypt/test [47 started in total]
__ module/crypt/test [47 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 1 items
module/crypt/test/test_crypt.py s
========================== 1 skipped in 0.04 seconds ===========================
++ 17:21:52 starting module/errno/test [48 started in total]
__ module/errno/test [48 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 3 items
module/errno/test/test_errno.py ...
=========================== 3 passed in 0.10 seconds ===========================
++ 17:21:54 starting module/exceptions/test [49 started in total]
__ module/exceptions/test [49 done in total, somefailed=False] ________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 48 items
module/exceptions/test/test_exc.py ................................................
========================== 48 passed in 1.43 seconds ===========================
++ 17:21:57 starting module/faulthandler/test [50 started in total]
__ module/faulthandler/test [50 done in total, somefailed=False] ______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 2 items
module/faulthandler/test/test_faulthander.py ..
=========================== 2 passed in 0.07 seconds ===========================
++ 17:21:59 starting module/fcntl/test [51 started in total]
__ module/fcntl/test [51 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 8 items
module/fcntl/test/test_fcntl.py ........
=========================== 8 passed in 0.77 seconds ===========================
++ 17:22:02 starting module/gc/test [52 started in total]
__ module/gc/test [52 done in total, somefailed=False] ________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 24 items
module/gc/test/test_gc.py sssssx..
module/gc/test/test_hook.py ssssssss
module/gc/test/test_referents.py ........
=============== 10 passed, 13 skipped, 1 xfailed in 0.55 seconds ===============
++ 17:22:03 starting module/imp/test [53 started in total]
__ module/imp/test [53 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 99 items
module/imp/test/test_app.py ................
module/imp/test/test_import.py ..........................s....................................................ssss
===================== 94 passed, 5 skipped in 5.17 seconds =====================
++ 17:22:10 starting module/itertools/test [54 started in total]
__ module/itertools/test [54 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 87 items
module/itertools/test/test_itertools.py .......................................................................................
========================== 87 passed in 2.74 seconds ===========================
++ 17:22:15 starting module/marshal/test [55 started in total]
__ module/marshal/test [55 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.40 seconds =========================
++ 17:22:16 starting module/math/test [56 started in total]
__ module/math/test [56 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 31 items
module/math/test/test_math.py ...............................
========================== 31 passed in 0.98 seconds ===========================
++ 17:22:19 starting module/micronumpy/test [57 started in total]
__ module/micronumpy/test [57 done in total, somefailed=False] ________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:22:21 starting module/mmap/test [58 started in total]
__ module/mmap/test [58 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 46 items
module/mmap/test/test_mmap.py ..............................................
========================== 46 passed in 1.46 seconds ===========================
++ 17:22:24 starting module/operator/test [59 started in total]
__ module/operator/test [59 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 24 items
module/operator/test/test_operator.py ........................
========================== 24 passed in 0.96 seconds ===========================
++ 17:22:27 starting module/posix/test [60 started in total]
__ module/posix/test [60 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 170 items / 2 skipped
module/posix/test/test_posix2.py ................................................................................................................s..ss.....................ssss.......s
module/posix/test/test_scandir.py ....................
=================== 162 passed, 10 skipped in 13.01 seconds ====================
++ 17:22:41 starting module/pwd/test [61 started in total]
__ module/pwd/test [61 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 4 items
module/pwd/test/test_pwd.py ....
=========================== 4 passed in 0.15 seconds ===========================
++ 17:22:43 starting module/pyexpat/test [62 started in total]
__ module/pyexpat/test [62 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 17 items
module/pyexpat/test/test_parser.py .................
========================== 17 passed in 3.83 seconds ===========================
++ 17:22:48 starting module/pypyjit/test [63 started in total]
__ module/pypyjit/test [63 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 15 items
module/pypyjit/test/test_jit_hook.py sssssssss
module/pypyjit/test/test_jit_not_in_trace.py ..
module/pypyjit/test/test_jit_setup.py ....
===================== 6 passed, 9 skipped in 0.23 seconds ======================
++ 17:22:50 starting module/select/test [64 started in total]
__ module/select/test [64 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 45 items
module/select/test/test_epoll.py ..........
module/select/test/test_kqueue.py ssssss
module/select/test/test_select.py ............................
module/select/test/test_select_signal.py .
==================== 39 passed, 6 skipped in 14.23 seconds =====================
++ 17:23:07 starting module/signal/test [65 started in total]
__ module/signal/test [65 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 25 items
module/signal/test/test_signal.py ......................sss
===================== 22 passed, 3 skipped in 9.79 seconds =====================
++ 17:23:20 starting module/struct/test [66 started in total]
__ module/struct/test [66 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 7 items
module/struct/test/test_struct.py .......
=========================== 7 passed in 0.23 seconds ===========================
++ 17:23:21 starting module/sys/test [67 started in total]
__ module/sys/test [67 done in total, somefailed=True] ________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 72 items
module/sys/test/test_sysmodule.py ................................................F.................
module/sys/test/test_version.py ......
=================================== FAILURES ===================================
_ AppTestSysModulePortedFromCPython.test_reload_doesnt_override_sys_executable _
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p..., in test_reload_doesnt_override_sys_executable
from imp import reload
ModuleNotFoundError: No module named 'imp'
>
func = <function <lambda> at 0x7f01dc930d50>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_reload_doesnt_override_sys_exec... <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_reload_doesnt_override_sys_executable'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f01e0729f50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_reload_doesnt_override_sys_exec... <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_reload_doesnt_override_sys_executable'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_reload_doesnt_override_sys_exec... <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_reload_doesnt_override_sys_executable'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_reload_doesnt_override_sys_executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f01dc91c960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f01dc91c550>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f01dc91c550>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_reload_doesnt_override_sys_executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f01dc91c050>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f01dc919d20>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f01dc919d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_reload_doesnt_override_sys_executable'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_reload_doesnt_override_sys_executable'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_reload_doesnt_override_sys_executable'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_reload_doesnt_override_sys_executable at 0x7f01dc99ac50>
usemodules = ['_struct'], definitions = {'appdirect': True}
defs = ['self.appdirect = True\n'], symbol = 'appdirect', value = True
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1252/src.py", line 84, in <module>
E test_reload_doesnt_override_sys_executable()
E File "/tmp/pytest/usession-py3.12-1252/src.py", line 77, in test_reload_doesnt_override_sys_executable
E from imp import reload
E ModuleNotFoundError: No module named 'imp'
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_struct']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
self.appdirect = True
def test_reload_doesnt_override_sys_executable():
import sys
from imp import reload
if not hasattr(sys, 'executable'): # if not translated
sys.executable = 'from_test_sysmodule'
previous = sys.executable
reload(sys)
assert sys.executable == previous
try:
test_reload_doesnt_override_sys_executable()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1252/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1252/src.py", line 84, in <module>
test_reload_doesnt_override_sys_executable()
File "/tmp/pytest/usession-py3.12-1252/src.py", line 77, in test_reload_doesnt_override_sys_executable
from imp import reload
ModuleNotFoundError: No module named 'imp'
=========================== short test summary info ============================
FAIL module/sys/test/test_sysmodule.py::AppTestSysModulePortedFromCPython::()::test_reload_doesnt_override_sys_executable
===================== 1 failed, 71 passed in 2.73 seconds ======================
++ 17:23:26 starting module/termios/test [68 started in total]
__ module/termios/test [68 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 3 items
module/termios/test/test_termios.py ...
=========================== 3 passed in 0.10 seconds ===========================
++ 17:23:27 starting module/test_lib_pypy [69 started in total]
__ module/test_lib_pypy [69 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 206 items / 7 skipped
module/test_lib_pypy/test_code_module.py ...
module/test_lib_pypy/test_collections.py .....................
module/test_lib_pypy/test_marshal_extra.py .......................................................................................................................................................
module/test_lib_pypy/test_md5_extra.py ssssss
module/test_lib_pypy/test_pickle_extra.py s
module/test_lib_pypy/test_sha_extra.py .....
module/test_lib_pypy/test_site_extra.py .
module/test_lib_pypy/test_structseq.py ...........
module/test_lib_pypy/test_tputil.py .......
==================== 199 passed, 14 skipped in 1.77 seconds ====================
++ 17:23:31 starting module/thread/test [70 started in total]
__ module/thread/test [70 done in total, somefailed=True] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 49 items
module/thread/test/test_fork.py ...F
module/thread/test/test_import_lock.py F.FF
module/thread/test/test_local.py ......
module/thread/test/test_lock.py ....................
module/thread/test/test_thread.py ...............
=================================== FAILURES ===================================
___________________ AppTestFork.test_nested_import_lock_fork ___________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p....12-1255/src.py", line 115, in test_nested_import_lock_fork
import imp
ModuleNotFoundError: No module named 'imp'
>
func = <function <lambda> at 0x7f0d5709c1d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_nested_import_lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_nested_import_lock_fork'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f0d5a11cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_nested_import_lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_nested_import_lock_fork'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_nested_import_lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_nested_import_lock_fork'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_nested_import_lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d57075370>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d57075640>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d57075640>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_nested_import_lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d57075550>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d57075500>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d57075500>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i..._lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_nested_import_lock_fork'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_nested_import_lock_fork'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_nested_import_lock_fork'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_nested_import_lock_fork at 0x7f0d57244250>
usemodules = ['_thread', 'time', '_signal', '_imp']
definitions = {'NORMAL_TIMEOUT': 300.0, 'busywait': (<py._code.source.Source object at 0x7f0d5706d810>, []), 'runappdirect': True, '... method AppTestFork.timeout_killer of <pypy.module.thread.test.test_fork.AppTestFork instance at 0x7f0d570b27d0>>, ...}
defs = ['self.NORMAL_TIMEOUT = 300.0\n', 'def anonymous():\n import time\n return time.sleep', 'self.bu...n import threading\n threading.Thread(target=kill).start()', 'type(self).timeout_killer = timeout_killer\n', ...]
symbol = 'waitfor'
value = <bound method AppTestFork.plain_waitfor of <pypy.module.thread.test.test_fork.AppTestFork instance at 0x7f0d570b27d0>>
code = <py._code.code.Code object at 0x7f0d5706df10>, args = '', arg_repr = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 157, in <module>
E test_nested_import_lock_fork()
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 115, in test_nested_import_lock_fork
E import imp
E ModuleNotFoundError: No module named 'imp'
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_thread', 'time', '_signal', '_imp']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
self.NORMAL_TIMEOUT = 300.0
def anonymous():
import time
return time.sleep
self.busywait = anonymous()
self.runappdirect = True
def timeout_killer(cls, pid, delay):
def kill():
for x in range(delay * 10):
time.sleep(0.1)
try:
os.kill(pid, 0)
except OSError as e:
if e.errno == errno.ESRCH: # no such process
return
raise
os.kill(pid, 9)
print("process %s killed!" % (pid,))
import threading
threading.Thread(target=kill).start()
type(self).timeout_killer = timeout_killer
def plain_waitfor(cls, condition, delay=1):
import gc
import time
adaptivedelay = 0.04
limit = time.time() + cls.NORMAL_TIMEOUT * delay
while time.time() <= limit:
time.sleep(adaptivedelay)
gc.collect()
if condition():
return
adaptivedelay *= 1.05
print('*** timed out ***')
type(self).waitfor = plain_waitfor
def test_nested_import_lock_fork():
"""Check fork() in main thread works while the main thread is doing an import"""
# Issue 9573: this used to trigger RuntimeError in the child process
import imp
import os
import time
if not hasattr(os, 'fork'):
skip("No fork on this platform")
def fork_with_import_lock(level):
release = 0
in_child = False
try:
try:
for i in range(level):
imp.acquire_lock()
release += 1
pid = os.fork()
in_child = not pid
finally:
for i in range(release):
imp.release_lock()
except RuntimeError:
if in_child:
if verbose > 1:
print("RuntimeError in child")
os._exit(1)
raise
if in_child:
os._exit(0)
for i in range(10):
spid, status = os.waitpid(pid, os.WNOHANG)
if spid == pid:
break
time.sleep(1.0)
assert spid == pid
assert status == 0
# Check this works with various levels of nested
# import in the main thread
for level in range(5):
fork_with_import_lock(level)
try:
test_nested_import_lock_fork()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1255/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1255/src.py", line 157, in <module>
test_nested_import_lock_fork()
File "/tmp/pytest/usession-py3.12-1255/src.py", line 115, in test_nested_import_lock_fork
import imp
ModuleNotFoundError: No module named 'imp'
________________________ AppTestThread.test_import_lock ________________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...py3.12-1255/src.py", line 117, in test_import_lock
import _thread, imp
ModuleNotFoundError: No module named 'imp'
>
func = <function <lambda> at 0x7f0d570b49d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_import_lock'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f0d5a11cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_import_lock'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_import_lock'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d570a14b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...mport_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d5708cf50>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d5708cf50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...mport_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d5708fa50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...mport_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d5708fb40>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d5708fb40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...mport_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_lock'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_import_lock'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_import_lock'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_import_lock at 0x7f0d571a16d0>
usemodules = ['_thread', 'time', '_signal']
definitions = {'NORMAL_TIMEOUT': 300.0, 'busywait': (<py._code.source.Source object at 0x7f0d570f0950>, []), 'runappdirect': True, '...TestThread.timeout_killer of <pypy.module.thread.test.test_import_lock.AppTestThread instance at 0x7f0d570a11e0>>, ...}
defs = ['self.NORMAL_TIMEOUT = 300.0\n', 'def anonymous():\n import time\n return time.sleep', 'self.bu...n import threading\n threading.Thread(target=kill).start()', 'type(self).timeout_killer = timeout_killer\n', ...]
symbol = 'waitfor'
value = <bound method AppTestThread.plain_waitfor of <pypy.module.thread.test.test_import_lock.AppTestThread instance at 0x7f0d570a11e0>>
code = <py._code.code.Code object at 0x7f0d570f0fd0>, args = '', arg_repr = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 131, in <module>
E test_import_lock()
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 117, in test_import_lock
E import _thread, imp
E ModuleNotFoundError: No module named 'imp'
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_thread', 'time', '_signal']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
self.NORMAL_TIMEOUT = 300.0
def anonymous():
import time
return time.sleep
self.busywait = anonymous()
self.runappdirect = True
def timeout_killer(cls, pid, delay):
def kill():
for x in range(delay * 10):
time.sleep(0.1)
try:
os.kill(pid, 0)
except OSError as e:
if e.errno == errno.ESRCH: # no such process
return
raise
os.kill(pid, 9)
print("process %s killed!" % (pid,))
import threading
threading.Thread(target=kill).start()
type(self).timeout_killer = timeout_killer
self.tmpdir = '/tmp/pytest/usession-py3.12-1255/test_import_lock'
def plain_waitfor(cls, condition, delay=1):
import gc
import time
adaptivedelay = 0.04
limit = time.time() + cls.NORMAL_TIMEOUT * delay
while time.time() <= limit:
time.sleep(adaptivedelay)
gc.collect()
if condition():
return
adaptivedelay *= 1.05
print('*** timed out ***')
type(self).waitfor = plain_waitfor
def test_import_lock():
# XXX XXX XXX this test fails if run together with all other tests
# of this directory, but not when run alone
import _thread, imp
assert not imp.lock_held()
done = []
def f(i):
print('[ENTER %d]' % i)
from imghdr import testall
print('[LEAVE %d]' % i)
done.append(1)
for i in range(5):
print('[RUN %d]' % i)
_thread.start_new_thread(f, (i,))
self.waitfor(lambda: len(done) == 5)
assert len(done) == 5
try:
test_import_lock()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1255/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1255/src.py", line 131, in <module>
test_import_lock()
File "/tmp/pytest/usession-py3.12-1255/src.py", line 117, in test_import_lock
import _thread, imp
ModuleNotFoundError: No module named 'imp'
______________________ AppTestThread.test_manual_locking _______________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...", line 115, in test_manual_locking
import _thread, os, imp, time, sys
ModuleNotFoundError: No module named 'imp'
>
func = <function <lambda> at 0x7f0d56f0e850>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_manual_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_manual_locking'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f0d5a11cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_manual_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_manual_locking'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_manual_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_manual_locking'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_manual_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d56f1e910>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...al_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56f1e550>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56f1e550>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...al_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_manual_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d56ea95f0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...al_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56ea90a0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56ea90a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...al_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_manual_locking'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_manual_locking'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_manual_locking'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_manual_locking at 0x7f0d571a17d0>
usemodules = ['_thread', 'time', '_signal']
definitions = {'NORMAL_TIMEOUT': 300.0, 'busywait': (<py._code.source.Source object at 0x7f0d570f0950>, []), 'runappdirect': True, '...TestThread.timeout_killer of <pypy.module.thread.test.test_import_lock.AppTestThread instance at 0x7f0d56f1e820>>, ...}
defs = ['self.NORMAL_TIMEOUT = 300.0\n', 'def anonymous():\n import time\n return time.sleep', 'self.bu...n import threading\n threading.Thread(target=kill).start()', 'type(self).timeout_killer = timeout_killer\n', ...]
symbol = 'waitfor'
value = <bound method AppTestThread.plain_waitfor of <pypy.module.thread.test.test_import_lock.AppTestThread instance at 0x7f0d56f1e820>>
code = <py._code.code.Code object at 0x7f0d56eaa050>, args = '', arg_repr = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 146, in <module>
E test_manual_locking()
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 115, in test_manual_locking
E import _thread, os, imp, time, sys
E ModuleNotFoundError: No module named 'imp'
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_thread', 'time', '_signal']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
self.NORMAL_TIMEOUT = 300.0
def anonymous():
import time
return time.sleep
self.busywait = anonymous()
self.runappdirect = True
def timeout_killer(cls, pid, delay):
def kill():
for x in range(delay * 10):
time.sleep(0.1)
try:
os.kill(pid, 0)
except OSError as e:
if e.errno == errno.ESRCH: # no such process
return
raise
os.kill(pid, 9)
print("process %s killed!" % (pid,))
import threading
threading.Thread(target=kill).start()
type(self).timeout_killer = timeout_killer
self.tmpdir = '/tmp/pytest/usession-py3.12-1255/test_import_lock'
def plain_waitfor(cls, condition, delay=1):
import gc
import time
adaptivedelay = 0.04
limit = time.time() + cls.NORMAL_TIMEOUT * delay
while time.time() <= limit:
time.sleep(adaptivedelay)
gc.collect()
if condition():
return
adaptivedelay *= 1.05
print('*** timed out ***')
type(self).waitfor = plain_waitfor
def test_manual_locking():
import _thread, os, imp, time, sys
f = open(os.path.join(self.tmpdir, 'foobaz2.py'), 'w')
f.close() # empty
done = []
def f():
sys.path.insert(0, self.tmpdir)
import foobaz2
p = sys.path.pop(0)
assert p == self.tmpdir
done.append(1)
assert not imp.lock_held()
imp.acquire_lock()
assert imp.lock_held()
_thread.start_new_thread(f, ())
time.sleep(0.9)
assert not done
assert imp.lock_held()
# check that it's a recursive lock
imp.acquire_lock()
assert imp.lock_held()
imp.acquire_lock()
assert imp.lock_held()
imp.release_lock()
assert imp.lock_held()
imp.release_lock()
assert imp.lock_held()
imp.release_lock()
assert not imp.lock_held()
self.waitfor(lambda: done)
assert done
try:
test_manual_locking()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1255/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1255/src.py", line 146, in <module>
test_manual_locking()
File "/tmp/pytest/usession-py3.12-1255/src.py", line 115, in test_manual_locking
import _thread, os, imp, time, sys
ModuleNotFoundError: No module named 'imp'
________________ AppTestThread.test_lock_held_by_another_thread ________________
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
Traceback (most recent call last):
File "/tmp/p...115, in test_lock_held_by_another_thread
import _thread as thread, imp
ModuleNotFoundError: No module named 'imp'
>
func = <function <lambda> at 0x7f0d56f0e350>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_lock_held_by_another_thread'>, ...ticall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_lock_held_by_another_thread'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../_pytest/vendored_packages/pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x7f0d5a11cf50>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_lock_held_by_another_thread'>, ...ticall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_lock_held_by_another_thread'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_lock_held_by_another_thread'>, ...ticall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_lock_held_by_another_thread'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_lock_held_by_another_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d56f92c80>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...her_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56f92b40>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56f92b40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...her_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_lock_held_by_another_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f0d56f92dc0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...her_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56f92f00>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
../_pytest/vendored_packages/pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f0d56f92f00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...her_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_lock_held_by_another_thread'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_lock_held_by_another_thread'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_lock_held_by_another_thread'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-64/build/pypy/goal/pypy3.12-c'
target_ = <function test_lock_held_by_another_thread at 0x7f0d571a1850>
usemodules = ['_thread', 'time', '_signal']
definitions = {'NORMAL_TIMEOUT': 300.0, 'busywait': (<py._code.source.Source object at 0x7f0d570f0950>, []), 'runappdirect': True, '...TestThread.timeout_killer of <pypy.module.thread.test.test_import_lock.AppTestThread instance at 0x7f0d56f92b90>>, ...}
defs = ['self.NORMAL_TIMEOUT = 300.0\n', 'def anonymous():\n import time\n return time.sleep', 'self.bu...n import threading\n threading.Thread(target=kill).start()', 'type(self).timeout_killer = timeout_killer\n', ...]
symbol = 'waitfor'
value = <bound method AppTestThread.plain_waitfor of <pypy.module.thread.test.test_import_lock.AppTestThread instance at 0x7f0d56f92b90>>
code = <py._code.code.Code object at 0x7f0d56f7a110>, args = '', arg_repr = []
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E Traceback (most recent call last):
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 136, in <module>
E test_lock_held_by_another_thread()
E File "/tmp/pytest/usession-py3.12-1255/src.py", line 115, in test_lock_held_by_another_thread
E import _thread as thread, imp
E ModuleNotFoundError: No module named 'imp'
tool/pytest/apptest.py:239: AssertionError
----------------------------- Captured stdout call -----------------------------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-64/build')
missing = set(['_thread', 'time', '_signal']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
self.NORMAL_TIMEOUT = 300.0
def anonymous():
import time
return time.sleep
self.busywait = anonymous()
self.runappdirect = True
def timeout_killer(cls, pid, delay):
def kill():
for x in range(delay * 10):
time.sleep(0.1)
try:
os.kill(pid, 0)
except OSError as e:
if e.errno == errno.ESRCH: # no such process
return
raise
os.kill(pid, 9)
print("process %s killed!" % (pid,))
import threading
threading.Thread(target=kill).start()
type(self).timeout_killer = timeout_killer
self.tmpdir = '/tmp/pytest/usession-py3.12-1255/test_import_lock'
def plain_waitfor(cls, condition, delay=1):
import gc
import time
adaptivedelay = 0.04
limit = time.time() + cls.NORMAL_TIMEOUT * delay
while time.time() <= limit:
time.sleep(adaptivedelay)
gc.collect()
if condition():
return
adaptivedelay *= 1.05
print('*** timed out ***')
type(self).waitfor = plain_waitfor
def test_lock_held_by_another_thread():
import _thread as thread, imp
lock_held = thread.allocate_lock()
test_complete = thread.allocate_lock()
lock_released = thread.allocate_lock()
def other_thread():
imp.acquire_lock() # 3
assert imp.lock_held()
lock_held.release() # 4
test_complete.acquire() # 7
imp.release_lock() # 8
lock_released.release() # 9
lock_held.acquire()
test_complete.acquire()
lock_released.acquire()
#
thread.start_new_thread(other_thread, ()) # 1
lock_held.acquire() # 2
assert imp.lock_held() # 5
test_complete.release() # 6
lock_released.acquire() # 10
try:
test_lock_held_by_another_thread()
finally:
print("===aefwuiheawiu===")
from /tmp/pytest/usession-py3.12-1255/src.py
===aefwuiheawiu===
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
File "/tmp/pytest/usession-py3.12-1255/src.py", line 136, in <module>
test_lock_held_by_another_thread()
File "/tmp/pytest/usession-py3.12-1255/src.py", line 115, in test_lock_held_by_another_thread
import _thread as thread, imp
ModuleNotFoundError: No module named 'imp'
=========================== short test summary info ============================
FAIL module/thread/test/test_fork.py::AppTestFork::()::test_nested_import_lock_fork
FAIL module/thread/test/test_import_lock.py::AppTestThread::()::test_import_lock
FAIL module/thread/test/test_import_lock.py::AppTestThread::()::test_manual_locking
FAIL module/thread/test/test_import_lock.py::AppTestThread::()::test_lock_held_by_another_thread
===================== 4 failed, 45 passed in 57.51 seconds =====================
++ 17:24:36 starting module/time/test [71 started in total]
__ module/time/test [71 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.01 seconds =========================
++ 17:24:38 starting module/token/test [72 started in total]
__ module/token/test [72 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:24:40 starting module/unicodedata/test [73 started in total]
__ module/unicodedata/test [73 done in total, somefailed=False] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 19 items
module/unicodedata/test/test_unicodedata.py ...................
========================== 19 passed in 0.78 seconds ===========================
++ 17:24:42 starting module/zipimport/test [74 started in total]
__ module/zipimport/test [74 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 17:24:44 starting module/zlib/test [75 started in total]
__ module/zlib/test [75 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/pypy-c-jit-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/pypy-c-jit-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/pypy-c-jit-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.42.0
collected 46 items
module/zlib/test/test_zlib.py ..................................s...........
===================== 45 passed, 1 skipped in 1.50 seconds =====================
program finished with exit code 1
elapsedTime=599.197241