Read about our upcoming Code of Conduct on this issue

Commit bb3206ee authored by Ronan Lamy's avatar Ronan Lamy
Browse files

Re-enable assert reinterpretation for -A tests and simplify objspace creation

parent a31e7023a8ba
......@@ -186,27 +186,16 @@ def skip_on_missing_buildoption(**ropts):
py.test.skip("need translated pypy with: %s, got %s"
%(ropts,options))
class LazyObjSpaceGetter(object):
def __get__(self, obj, cls=None):
from pypy.tool.pytest.objspace import gettestobjspace
space = gettestobjspace()
if cls:
cls.space = space
return space
@pytest.hookimpl(tryfirst=True)
def pytest_runtest_setup(item):
if isinstance(item, py.test.collect.Function):
appclass = item.getparent(py.test.Class)
if appclass is not None:
from pypy.tool.pytest.objspace import gettestobjspace
# Make cls.space and cls.runappdirect available in tests.
spaceconfig = getattr(appclass.obj, 'spaceconfig', None)
if spaceconfig is not None:
from pypy.tool.pytest.objspace import gettestobjspace
appclass.obj.space = gettestobjspace(**spaceconfig)
else:
appclass.obj.space = LazyObjSpaceGetter()
spaceconfig = getattr(appclass.obj, 'spaceconfig', {})
spaceconfig.setdefault('objspace.std.reinterpretasserts', True)
appclass.obj.space = gettestobjspace(**spaceconfig)
appclass.obj.runappdirect = option.runappdirect
def pytest_ignore_collect(path, config):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment