[pypy-commit] pypy default: Remove unnecessary conftest imports
rlamy
pypy.commits at gmail.com
Mon Jun 6 10:48:01 EDT 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch:
Changeset: r84966:9f49da4855da
Date: 2016-06-06 15:47 +0100
http://bitbucket.org/pypy/pypy/changeset/9f49da4855da/
Log: Remove unnecessary conftest imports
diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py
--- a/pypy/interpreter/test/test_pyframe.py
+++ b/pypy/interpreter/test/test_pyframe.py
@@ -1,5 +1,5 @@
+import pytest
from rpython.tool import udir
-from pypy.conftest import option
from pypy.interpreter.gateway import interp2app
def check_no_w_locals(space, w_frame):
@@ -11,7 +11,7 @@
space = cls.space
cls.w_udir = cls.space.wrap(str(udir.udir))
cls.w_tempfile1 = cls.space.wrap(str(udir.udir.join('tempfile1')))
- if not option.runappdirect:
+ if not pytest.config.option.runappdirect:
w_call_further = cls.space.appexec([], """():
def call_further(f):
return f()
@@ -48,10 +48,10 @@
return f.f_code
assert g() is g.func_code
- def test_f_trace_del(self):
+ def test_f_trace_del(self):
import sys
- f = sys._getframe()
- del f.f_trace
+ f = sys._getframe()
+ del f.f_trace
assert f.f_trace is None
def test_f_lineno(self):
@@ -116,7 +116,7 @@
def f():
assert sys._getframe().f_code.co_name == g()
def g():
- return sys._getframe().f_back.f_code.co_name
+ return sys._getframe().f_back.f_code.co_name
f()
def test_f_back_virtualref(self):
@@ -233,7 +233,7 @@
def test_trace_exc(self):
import sys
l = []
- def ltrace(a,b,c):
+ def ltrace(a,b,c):
if b == 'exception':
l.append(c)
return ltrace
@@ -298,7 +298,7 @@
def test_trace_return_exc(self):
import sys
l = []
- def trace(a,b,c):
+ def trace(a,b,c):
if b in ('exception', 'return'):
l.append((b, c))
return trace
@@ -444,7 +444,7 @@
def test_dont_trace_on_reraise(self):
import sys
l = []
- def ltrace(a,b,c):
+ def ltrace(a,b,c):
if b == 'exception':
l.append(c)
return ltrace
@@ -466,7 +466,7 @@
def test_dont_trace_on_raise_with_tb(self):
import sys
l = []
- def ltrace(a,b,c):
+ def ltrace(a,b,c):
if b == 'exception':
l.append(c)
return ltrace
diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py
--- a/pypy/interpreter/test/test_zzpickle_and_slow.py
+++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
@@ -1,9 +1,8 @@
import py
-from pypy import conftest
from pypy.interpreter import gateway
from rpython.rlib.jit import non_virtual_ref, vref_None
-class AppTestSlow:
+class AppTestSlow:
spaceconfig = dict(usemodules=['itertools'])
def setup_class(cls):
@@ -64,7 +63,7 @@
space.setitem(space.builtin.w_dict,
space.wrap('read_exc_type'),
space.wrap(read_exc_type_gw))
-
+
def _detach_helpers(space):
space.delitem(space.builtin.w_dict,
space.wrap('hide_top_frame'))
@@ -92,7 +91,7 @@
pckl = pickle.dumps(code)
result = pickle.loads(pckl)
assert code == result
-
+
def test_pickle_global_func(self):
import new
mod = new.module('mod')
@@ -109,7 +108,7 @@
assert func is result
finally:
del sys.modules['mod']
-
+
def test_pickle_not_imported_module(self):
import new
mod = new.module('mod')
@@ -119,13 +118,13 @@
result = pickle.loads(pckl)
assert mod.__name__ == result.__name__
assert mod.__dict__ == result.__dict__
-
+
def test_pickle_builtin_func(self):
import pickle
pckl = pickle.dumps(map)
result = pickle.loads(pckl)
assert map is result
-
+
def test_pickle_non_top_reachable_func(self):
def func():
return 42
@@ -142,7 +141,7 @@
assert func.func_dict == result.func_dict
assert func.func_doc == result.func_doc
assert func.func_globals == result.func_globals
-
+
def test_pickle_cell(self):
def g():
x = [42]
@@ -171,7 +170,7 @@
f1 = f()
saved = hide_top_frame(f1)
pckl = pickle.dumps(f1)
- restore_top_frame(f1, saved)
+ restore_top_frame(f1, saved)
f2 = pickle.loads(pckl)
assert type(f1) is type(f2)
@@ -223,7 +222,7 @@
f1 = f()
saved = hide_top_frame(f1)
pckl = pickle.dumps(f1)
- restore_top_frame(f1, saved)
+ restore_top_frame(f1, saved)
f2 = pickle.loads(pckl)
def test_frame_setstate_crash(self):
@@ -257,21 +256,21 @@
pckl = pickle.dumps(mod)
result = pickle.loads(pckl)
assert mod is result
-
+
def test_pickle_moduledict(self):
import pickle
moddict = pickle.__dict__
pckl = pickle.dumps(moddict)
result = pickle.loads(pckl)
assert moddict is result
-
+
def test_pickle_bltins_module(self):
import pickle
mod = __builtins__
pckl = pickle.dumps(mod)
result = pickle.loads(pckl)
assert mod is result
-
+
def test_pickle_buffer(self):
skip("Can't pickle buffer objects on top of CPython either. "
"Do we really need it?")
@@ -280,14 +279,14 @@
pckl = pickle.dumps(a)
result = pickle.loads(pckl)
assert a == result
-
+
def test_pickle_complex(self):
import pickle
a = complex(1.23,4.567)
pckl = pickle.dumps(a)
result = pickle.loads(pckl)
assert a == result
-
+
def test_pickle_method(self):
class myclass(object):
def f(self):
@@ -308,7 +307,7 @@
assert method() == result()
finally:
del sys.modules['mod']
-
+
def test_pickle_staticmethod(self):
class myclass(object):
def f():
@@ -319,7 +318,7 @@
pckl = pickle.dumps(method)
result = pickle.loads(pckl)
assert method() == result()
-
+
def test_pickle_classmethod(self):
class myclass(object):
def f(cls):
@@ -337,7 +336,7 @@
assert method() == result()
finally:
del sys.modules['mod']
-
+
def test_pickle_sequenceiter(self):
'''
In PyPy there is no distinction here between listiterator and
diff --git a/pypy/module/_continuation/test/test_translated.py b/pypy/module/_continuation/test/test_translated.py
--- a/pypy/module/_continuation/test/test_translated.py
+++ b/pypy/module/_continuation/test/test_translated.py
@@ -89,8 +89,7 @@
class AppTestWrapper:
def setup_class(cls):
"Run test_various_depths() when we are run with 'pypy py.test -A'."
- from pypy.conftest import option
- if not option.runappdirect:
+ if not py.test.config.option.runappdirect:
py.test.skip("meant only for -A run")
def _setup():
diff --git a/pypy/module/_file/test/test_file.py b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -516,12 +516,11 @@
assert s == 'bar\n'
def test_flush_at_exit():
- from pypy import conftest
from pypy.tool.option import make_config, make_objspace
from rpython.tool.udir import udir
tmpfile = udir.join('test_flush_at_exit')
- config = make_config(conftest.option)
+ config = make_config(py.test.config.option)
space = make_objspace(config)
space.appexec([space.wrap(str(tmpfile))], """(tmpfile):
f = open(tmpfile, 'w')
diff --git a/pypy/module/_io/test/test_fileio.py b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -222,14 +222,10 @@
assert not closed[0] # flush() called before file closed
os.close(fd)
-def test_flush_at_exit():
- from pypy import conftest
- from pypy.tool.option import make_config, make_objspace
+def test_flush_at_exit(space):
from rpython.tool.udir import udir
tmpfile = udir.join('test_flush_at_exit')
- config = make_config(conftest.option)
- space = make_objspace(config)
space.appexec([space.wrap(str(tmpfile))], """(tmpfile):
import io
f = io.open(tmpfile, 'w', encoding='ascii')
@@ -241,12 +237,7 @@
assert tmpfile.read() == '42'
-def test_flush_at_exit_IOError_and_ValueError():
- from pypy import conftest
- from pypy.tool.option import make_config, make_objspace
-
- config = make_config(conftest.option)
- space = make_objspace(config)
+def test_flush_at_exit_IOError_and_ValueError(space):
space.appexec([], """():
import io
class MyStream(io.IOBase):
diff --git a/pypy/module/_rawffi/test/test_tracker.py b/pypy/module/_rawffi/test/test_tracker.py
--- a/pypy/module/_rawffi/test/test_tracker.py
+++ b/pypy/module/_rawffi/test/test_tracker.py
@@ -1,5 +1,5 @@
import py
-from pypy.conftest import option
+from pytest import option
from pypy.module._rawffi.tracker import Tracker
@@ -44,4 +44,3 @@
def teardown_class(cls):
Tracker.DO_TRACING = False
-
diff --git a/pypy/module/gc/test/test_referents.py b/pypy/module/gc/test/test_referents.py
--- a/pypy/module/gc/test/test_referents.py
+++ b/pypy/module/gc/test/test_referents.py
@@ -1,4 +1,4 @@
-from pypy.conftest import option
+from pytest import option
class AppTestReferents(object):
diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -13,7 +13,7 @@
from pypy.module.imp import importing
-from pypy import conftest
+from pytest import config
def setuppkg(pkgname, **entries):
p = udir.join('impsubdir')
@@ -106,7 +106,7 @@
# create compiled/x.py and a corresponding pyc file
p = setuppkg("compiled", x = "x = 84")
- if conftest.option.runappdirect:
+ if config.option.runappdirect:
import marshal, stat, struct, os, imp
code = py.code.Source(p.join("x.py").read()).compile()
s3 = marshal.dumps(code)
@@ -143,7 +143,7 @@
def _setup(space):
dn = setup_directory_structure(space)
return space.appexec([space.wrap(dn)], """
- (dn):
+ (dn):
import sys
path = list(sys.path)
sys.path.insert(0, dn)
@@ -168,7 +168,7 @@
}
def setup_class(cls):
- cls.w_runappdirect = cls.space.wrap(conftest.option.runappdirect)
+ cls.w_runappdirect = cls.space.wrap(config.option.runappdirect)
cls.saved_modules = _setup(cls.space)
#XXX Compile class
@@ -1017,7 +1017,7 @@
cpathname = udir.join('test.pyc')
assert not cpathname.check()
-
+
def test_load_source_module_importerror(self):
# the .pyc file is created before executing the module
space = self.space
@@ -1126,11 +1126,11 @@
stream.close()
-def test_PYTHONPATH_takes_precedence(space):
+def test_PYTHONPATH_takes_precedence(space):
if sys.platform == "win32":
py.test.skip("unresolved issues with win32 shell quoting rules")
- from pypy.interpreter.test.test_zpy import pypypath
- extrapath = udir.ensure("pythonpath", dir=1)
+ from pypy.interpreter.test.test_zpy import pypypath
+ extrapath = udir.ensure("pythonpath", dir=1)
extrapath.join("sched.py").write("print 42\n")
old = os.environ.get('PYTHONPATH', None)
oldlang = os.environ.pop('LANG', None)
@@ -1494,8 +1494,6 @@
spaceconfig = dict(usemodules=['thread', 'time'])
def setup_class(cls):
- #if not conftest.option.runappdirect:
- # py.test.skip("meant as an -A test")
tmpfile = udir.join('test_multithreaded_imp.py')
tmpfile.write('''if 1:
x = 666
diff --git a/pypy/module/micronumpy/test/test_base.py b/pypy/module/micronumpy/test/test_base.py
--- a/pypy/module/micronumpy/test/test_base.py
+++ b/pypy/module/micronumpy/test/test_base.py
@@ -1,4 +1,4 @@
-from pypy.conftest import option
+from pytest import config
from pypy.module.micronumpy import constants as NPY
@@ -7,7 +7,7 @@
@classmethod
def setup_class(cls):
- if option.runappdirect:
+ if config.option.runappdirect:
import sys
if '__pypy__' not in sys.builtin_module_names:
import numpy
diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py
--- a/pypy/module/micronumpy/test/test_complex.py
+++ b/pypy/module/micronumpy/test/test_complex.py
@@ -2,7 +2,6 @@
import sys
-from pypy.conftest import option
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import interp2app
from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
@@ -23,13 +22,13 @@
# special values testing
if isnan(a):
if isnan(b):
- return True,''
+ return True, ''
raise AssertionError(msg + '%r should be nan' % (b,))
if isinf(a):
if a == b:
- return True,''
- raise AssertionError(msg + 'finite result where infinity expected: '+ \
+ return True, ''
+ raise AssertionError(msg + 'finite result where infinity expected: '
'expected %r, got %r' % (a, b))
# if both a and b are zero, check whether they have the same sign
@@ -39,7 +38,7 @@
if not a and not b:
# only check it if we are running on top of CPython >= 2.6
if sys.version_info >= (2, 6) and copysign(1., a) != copysign(1., b):
- raise AssertionError( msg + \
+ raise AssertionError(msg +
'zero has wrong sign: expected %r, got %r' % (a, b))
# if a-b overflows, or b is infinite, return False. Again, in
@@ -96,7 +95,6 @@
cls.w_testcases128 = cls.space.wrap(list(parse_testfile(fname128)))
cls.w_testcases64 = cls.space.wrap(list(parse_testfile(fname64)))
- cls.w_runAppDirect = cls.space.wrap(option.runappdirect)
cls.w_isWindows = cls.space.wrap(os.name == 'nt')
if cls.runappdirect:
@@ -495,8 +493,8 @@
c = array([1.e+110, 1.e-110], dtype=complex128)
d = floor_divide(c**2, c)
assert (d == [1.e+110, 0]).all()
-
-
+
+
def test_basic(self):
import sys
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -1,11 +1,11 @@
-from pypy.conftest import option
+from pytest import config
from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
from pypy.interpreter.gateway import interp2app
class BaseAppTestDtypes(BaseNumpyAppTest):
def setup_class(cls):
BaseNumpyAppTest.setup_class.im_func(cls)
- if option.runappdirect:
+ if config.option.runappdirect:
import platform
bits, linkage = platform.architecture()
ptr_size = int(bits[:-3]) // 8
@@ -372,8 +372,8 @@
a = np.array(data, dtype=b)
x = pickle.loads(pickle.dumps(a))
assert (x == a).all()
- assert x.dtype == a.dtype
-
+ assert x.dtype == a.dtype
+
def test_index(self):
import numpy as np
for dtype in [np.int8, np.int16, np.int32, np.int64]:
@@ -1088,7 +1088,7 @@
spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
def setup_class(cls):
BaseNumpyAppTest.setup_class.im_func(cls)
- if option.runappdirect:
+ if config.option.runappdirect:
cls.w_test_for_core_internal = cls.space.wrap(True)
else:
cls.w_test_for_core_internal = cls.space.wrap(False)
@@ -1459,7 +1459,7 @@
"'offsets':[0,76800], "
"'itemsize':80000, "
"'aligned':True}")
-
+
assert dt == np.dtype(eval(str(dt)))
dt = np.dtype({'names': ['r', 'g', 'b'], 'formats': ['u1', 'u1', 'u1'],
@@ -1515,7 +1515,7 @@
else:
assert stor2[1] == '\x01'
assert stor2[0] == '\x00'
- if option.runappdirect:
+ if config.option.runappdirect:
cls.w_check_non_native = lambda *args : None
else:
cls.w_check_non_native = cls.space.wrap(interp2app(check_non_native))
diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -2,7 +2,7 @@
import py
import sys
-from pypy.conftest import option
+from pytest import config
from pypy.module.micronumpy.appbridge import get_appbridge_cache
from pypy.module.micronumpy.strides import Chunk, new_view, EllipsisChunk
from pypy.module.micronumpy.ndarray import W_NDimArray
@@ -1878,7 +1878,7 @@
assert map(isnan, e) == [False, False, False, True, False]
assert map(isinf, e) == [False, False, True, False, False]
assert e.argmax() == 3
- # numpy preserves value for uint16 -> cast_as_float16 ->
+ # numpy preserves value for uint16 -> cast_as_float16 ->
# convert_to_float64 -> convert_to_float16 -> uint16
# even for float16 various float16 nans
all_f16 = arange(0xfe00, 0xffff, dtype='uint16')
@@ -2608,7 +2608,7 @@
a = np.arange(6).reshape(2,3)
i = np.dtype('int32').type(0)
assert (a[0] == a[i]).all()
-
+
def test_ellipsis_indexing(self):
import numpy as np
@@ -3850,7 +3850,7 @@
class AppTestRepr(BaseNumpyAppTest):
def setup_class(cls):
- if option.runappdirect:
+ if config.option.runappdirect:
py.test.skip("Can't be run directly.")
BaseNumpyAppTest.setup_class.im_func(cls)
cache = get_appbridge_cache(cls.space)
@@ -3867,7 +3867,7 @@
assert repr(array(1.5).real) == "array(1.5)"
def teardown_class(cls):
- if option.runappdirect:
+ if config.option.runappdirect:
return
cache = get_appbridge_cache(cls.space)
cache.w_array_repr = cls.old_array_repr
@@ -4343,7 +4343,7 @@
class AppTestPyPy(BaseNumpyAppTest):
def setup_class(cls):
- if option.runappdirect and '__pypy__' not in sys.builtin_module_names:
+ if config.option.runappdirect and '__pypy__' not in sys.builtin_module_names:
py.test.skip("pypy only test")
BaseNumpyAppTest.setup_class.im_func(cls)
diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py
--- a/pypy/module/micronumpy/test/test_object_arrays.py
+++ b/pypy/module/micronumpy/test/test_object_arrays.py
@@ -1,14 +1,9 @@
from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
-from pypy.conftest import option
class AppTestObjectDtypes(BaseNumpyAppTest):
spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
- def setup_class(cls):
- BaseNumpyAppTest.setup_class.im_func(cls)
- cls.w_runappdirect = cls.space.wrap(option.runappdirect)
-
def test_scalar_from_object(self):
from numpy import array
import sys
@@ -200,7 +195,7 @@
from numpy import arange, dtype
from cPickle import loads, dumps
import sys
-
+
a = arange(15).astype(object)
if '__pypy__' in sys.builtin_module_names:
raises(NotImplementedError, dumps, a)
@@ -211,4 +206,4 @@
a = arange(15).astype(object).reshape((3, 5))
b = loads(dumps(a))
assert (a == b).all()
-
+
diff --git a/pypy/module/micronumpy/test/test_support_app.py b/pypy/module/micronumpy/test/test_support_app.py
--- a/pypy/module/micronumpy/test/test_support_app.py
+++ b/pypy/module/micronumpy/test/test_support_app.py
@@ -3,11 +3,12 @@
import py
from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
-from pypy.conftest import option
+from pytest import config
class AppTestSupport(BaseNumpyAppTest):
def setup_class(cls):
- if option.runappdirect and '__pypy__' not in sys.builtin_module_names:
+ if (config.option.runappdirect and
+ '__pypy__' not in sys.builtin_module_names):
py.test.skip("pypy only test")
BaseNumpyAppTest.setup_class.im_func(cls)
diff --git a/pypy/module/test_lib_pypy/support.py b/pypy/module/test_lib_pypy/support.py
--- a/pypy/module/test_lib_pypy/support.py
+++ b/pypy/module/test_lib_pypy/support.py
@@ -1,6 +1,6 @@
import py
-from pypy.conftest import option
+from pytest import config
from pypy.interpreter.error import OperationError
def import_lib_pypy(space, name, skipmsg=None):
@@ -9,7 +9,7 @@
Raises a pytest Skip on ImportError if a skip message was specified.
"""
- if option.runappdirect:
+ if config.option.runappdirect:
try:
mod = __import__('lib_pypy.' + name)
except ImportError as e:
diff --git a/pypy/objspace/std/test/test_bytearrayobject.py b/pypy/objspace/std/test/test_bytearrayobject.py
--- a/pypy/objspace/std/test/test_bytearrayobject.py
+++ b/pypy/objspace/std/test/test_bytearrayobject.py
@@ -1,9 +1,9 @@
-from pypy import conftest
+from pytest import config
class AppTestBytesArray:
def setup_class(cls):
- cls.w_runappdirect = cls.space.wrap(conftest.option.runappdirect)
+ cls.w_runappdirect = cls.space.wrap(config.option.runappdirect)
def test_basics(self):
b = bytearray()
diff --git a/pypy/objspace/std/test/test_obj.py b/pypy/objspace/std/test/test_obj.py
--- a/pypy/objspace/std/test/test_obj.py
+++ b/pypy/objspace/std/test/test_obj.py
@@ -1,5 +1,4 @@
-from __future__ import with_statement
-from pypy.conftest import option
+from pytest import config
class AppTestObject:
@@ -7,13 +6,13 @@
from pypy.interpreter import gateway
import sys
- cpython_behavior = (not option.runappdirect
+ cpython_behavior = (not config.option.runappdirect
or not hasattr(sys, 'pypy_translation_info'))
space = cls.space
cls.w_cpython_behavior = space.wrap(cpython_behavior)
cls.w_cpython_version = space.wrap(tuple(sys.version_info))
- cls.w_appdirect = space.wrap(option.runappdirect)
+ cls.w_appdirect = space.wrap(config.option.runappdirect)
cls.w_cpython_apptest = space.wrap(option.runappdirect and not hasattr(sys, 'pypy_translation_info'))
def w_unwrap_wrap_unicode(space, w_obj):
diff --git a/pypy/objspace/std/test/test_proxy_usercreated.py b/pypy/objspace/std/test/test_proxy_usercreated.py
--- a/pypy/objspace/std/test/test_proxy_usercreated.py
+++ b/pypy/objspace/std/test/test_proxy_usercreated.py
@@ -5,7 +5,7 @@
from pypy.interpreter.typedef import TypeDef
from pypy.interpreter.gateway import interp2app
from pypy.objspace.std.transparent import register_proxyable
-from pypy.conftest import option
+from pytest import config
class W_Wrapped(W_Root):
@@ -25,7 +25,7 @@
class AppTestProxyNewtype(AppProxy):
def setup_class(cls):
- if option.runappdirect:
+ if config.option.runappdirect:
py.test.skip("Impossible to run on appdirect")
AppProxy.setup_class.im_func(cls)
cls.w_wrapped = cls.space.wrap(W_Wrapped())
diff --git a/pypy/objspace/test/test_binop_overriding.py b/pypy/objspace/test/test_binop_overriding.py
--- a/pypy/objspace/test/test_binop_overriding.py
+++ b/pypy/objspace/test/test_binop_overriding.py
@@ -1,5 +1,5 @@
# test about the binop operation rule, see issue 412
-from pypy.conftest import option
+from pytest import config
class AppTestBinopCombinations:
@@ -73,7 +73,7 @@
if C is not object:
setattr(C, name, f)
override_in_hier(n-1)
- if C is not object:
+ if C is not object:
delattr(C, name)
override_in_hier()
@@ -83,7 +83,7 @@
return Base, do_test
""")
cls.w_helpers = w_helpers
- cls.w_appdirect = cls.space.wrap(option.runappdirect)
+ cls.w_appdirect = cls.space.wrap(config.option.runappdirect)
def test_overriding_base_binop_explict(self):
class MulBase(object):
@@ -105,7 +105,7 @@
if not self.appdirect:
skip("slow test, should be run as appdirect test")
Base, do_test = self.helpers
-
+
class X(Base):
pass
class Y(X):
@@ -116,7 +116,7 @@
assert not fail
def test_binop_combinations_sub(self):
- Base, do_test = self.helpers
+ Base, do_test = self.helpers
class X(Base):
pass
class Y(X):
@@ -124,13 +124,13 @@
fail = do_test(X, Y, 'sub', lambda x,y: x-y)
#print len(fail)
- assert not fail
+ assert not fail
def test_binop_combinations_pow(self):
if not self.appdirect:
skip("slow test, should be run as appdirect test")
Base, do_test = self.helpers
-
+
class X(Base):
pass
class Y(X):
@@ -138,13 +138,13 @@
fail = do_test(X, Y, 'pow', lambda x,y: x**y)
#print len(fail)
- assert not fail
+ assert not fail
def test_binop_combinations_more_exhaustive(self):
if not self.appdirect:
skip("very slow test, should be run as appdirect test")
Base, do_test = self.helpers
-
+
class X(Base):
pass
diff --git a/pypy/tool/pytest/appsupport.py b/pypy/tool/pytest/appsupport.py
--- a/pypy/tool/pytest/appsupport.py
+++ b/pypy/tool/pytest/appsupport.py
@@ -184,7 +184,6 @@
source = str(source).strip()
except py.error.ENOENT:
source = None
- from pypy import conftest
if source and py.test.config._assertstate.mode != "off":
msg = interpret(source, runner, should_fail=True)
space.setattr(w_self, space.wrap('args'),
diff --git a/pypy/tool/pytest/objspace.py b/pypy/tool/pytest/objspace.py
--- a/pypy/tool/pytest/objspace.py
+++ b/pypy/tool/pytest/objspace.py
@@ -3,14 +3,13 @@
from rpython.config.config import ConflictConfigError
from pypy.tool.option import make_config, make_objspace
from pypy.tool.pytest import appsupport
-from pypy.conftest import option
_SPACECACHE={}
def gettestobjspace(**kwds):
""" helper for instantiating and caching space's for testing.
"""
try:
- config = make_config(option,**kwds)
+ config = make_config(py.test.config.option,**kwds)
except ConflictConfigError as e:
# this exception is typically only raised if a module is not available.
# in this case the test should be skipped
@@ -19,7 +18,7 @@
try:
return _SPACECACHE[key]
except KeyError:
- if getattr(option, 'runappdirect', None):
+ if getattr(py.test.config.option, 'runappdirect', None):
return TinyObjSpace(**kwds)
space = maketestobjspace(config)
_SPACECACHE[key] = space
@@ -27,7 +26,7 @@
def maketestobjspace(config=None):
if config is None:
- config = make_config(option)
+ config = make_config(py.test.config.option)
if config.objspace.usemodules.thread:
config.translation.thread = True
space = make_objspace(config)
More information about the pypy-commit
mailing list