[pypy-commit] pypy less-gettestobjspace: Only export cls.runappdirect instead of the whole option object.

amauryfa noreply at buildbot.pypy.org
Mon Oct 29 22:40:27 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: less-gettestobjspace
Changeset: r58623:a03792cb9cbb
Date: 2012-10-29 08:49 +0100
http://bitbucket.org/pypy/pypy/changeset/a03792cb9cbb/

Log:	Only export cls.runappdirect instead of the whole option object.

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -326,11 +326,11 @@
     if isinstance(item, py.test.collect.Function):
         appclass = item.getparent(PyPyClassCollector)
         if appclass is not None:
-            # Make cls.space and cls.option available in tests.
+            # Make cls.space and cls.runappdirect available in tests.
             spaceconfig = getattr(appclass.obj, 'spaceconfig', None)
             if spaceconfig is not None:
                 appclass.obj.space = gettestobjspace(**spaceconfig)
-            appclass.obj.option = option
+            appclass.obj.runappdirect = option.runappdirect
 
     __multicall__.execute()
 
diff --git a/pypy/interpreter/test/test_executioncontext.py b/pypy/interpreter/test/test_executioncontext.py
--- a/pypy/interpreter/test/test_executioncontext.py
+++ b/pypy/interpreter/test/test_executioncontext.py
@@ -260,7 +260,7 @@
 class AppTestDelNotBlocked:
 
     def setup_method(self, meth):
-        if not cls.option.runappdirect:
+        if not self.runappdirect:
             py.test.skip("test is meant for running with py.test -A")
         from pypy.tool.udir import udir
         tmpfile = udir.join('test_execution_context')
diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py
--- a/pypy/module/__builtin__/test/test_builtin.py
+++ b/pypy/module/__builtin__/test/test_builtin.py
@@ -20,7 +20,7 @@
         # For example if an object x has a __getattr__, we can get
         # AttributeError if attempting to call x.__getattr__ runs out
         # of stack.  That's annoying, so we just work around it.
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             cls.w_safe_runtimerror = cls.space.wrap(True)
         else:
             cls.w_safe_runtimerror = cls.space.wrap(sys.version_info < (2, 6))
diff --git a/pypy/module/__builtin__/test/test_classobj.py b/pypy/module/__builtin__/test/test_classobj.py
--- a/pypy/module/__builtin__/test/test_classobj.py
+++ b/pypy/module/__builtin__/test/test_classobj.py
@@ -1082,7 +1082,7 @@
     spaceconfig = {"objspace.std.withmapdict": True}
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("can only be run on py.py")
         def has_mapdict(space, w_inst):
             return space.wrap(w_inst._get_mapdict_map() is not None)
diff --git a/pypy/module/__pypy__/test/test_debug.py b/pypy/module/__pypy__/test/test_debug.py
--- a/pypy/module/__pypy__/test/test_debug.py
+++ b/pypy/module/__pypy__/test/test_debug.py
@@ -5,7 +5,7 @@
     spaceconfig = dict(usemodules=['__pypy__'])
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("not meant to be run with -A")
         cls.w_check_log = cls.space.wrap(cls.check_log)
 
diff --git a/pypy/module/__pypy__/test/test_special.py b/pypy/module/__pypy__/test/test_special.py
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -5,7 +5,7 @@
                    "objspace.std.withrangelist": True}
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("does not make sense on pypy-c")
 
     def test__isfake(self):
diff --git a/pypy/module/_cffi_backend/test/test_c.py b/pypy/module/_cffi_backend/test/test_c.py
--- a/pypy/module/_cffi_backend/test/test_c.py
+++ b/pypy/module/_cffi_backend/test/test_c.py
@@ -64,7 +64,7 @@
             return space.wrap(addr)
 
         space = cls.space
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             def interp2app(func):
                 def run(*args):
                     return func(space, *args)
diff --git a/pypy/module/_ffi/test/test_struct.py b/pypy/module/_ffi/test/test_struct.py
--- a/pypy/module/_ffi/test/test_struct.py
+++ b/pypy/module/_ffi/test/test_struct.py
@@ -61,7 +61,7 @@
         dummy_type.c_alignment = rffi.cast(rffi.USHORT, 0)
         dummy_type.c_type = rffi.cast(rffi.USHORT, 0)
         cls.w_dummy_type = W_FFIType('dummy', dummy_type)
-        cls.w_runappdirect = cls.space.wrap(cls.option.runappdirect)
+        cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
         
     def test__StructDescr(self):
         from _ffi import _StructDescr, Field, types
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
@@ -262,7 +262,7 @@
 
         cls.old_read = os.read
 
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("works with internals of _file impl on py.py")
         state = [0]
         def read(fd, n=None):
@@ -295,7 +295,7 @@
     spaceconfig = dict(usemodules=("_file",))
 
     def setup_class(cls):
-        if not cls.option.runappdirect:
+        if not cls.runappdirect:
             py.test.skip("likely to deadlock when interpreted by py.py")
         cls.w_temppath = cls.space.wrap(
             str(py.test.ensuretemp("fileimpl").join("concurrency.txt")))
diff --git a/pypy/module/_io/test/test_bufferedio.py b/pypy/module/_io/test/test_bufferedio.py
--- a/pypy/module/_io/test/test_bufferedio.py
+++ b/pypy/module/_io/test/test_bufferedio.py
@@ -224,7 +224,7 @@
     def setup_class(cls):
         tmpfile = udir.join('tmpfile')
         cls.w_tmpfile = cls.space.wrap(str(tmpfile))
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             cls.w_readfile = tmpfile.read
         else:
             def readfile(space):
diff --git a/pypy/module/_multiprocessing/test/test_connection.py b/pypy/module/_multiprocessing/test/test_connection.py
--- a/pypy/module/_multiprocessing/test/test_connection.py
+++ b/pypy/module/_multiprocessing/test/test_connection.py
@@ -11,7 +11,7 @@
     spaceconfig = dict(usemodules=['_multiprocessing', 'thread', 'signal'])
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             def raiseBufferTooShort(self, data):
                 import multiprocessing
                 raise multiprocessing.BufferTooShort(data)
@@ -73,7 +73,7 @@
         if sys.platform != "win32":
             py.test.skip("win32 only")
 
-        if not cls.option.runappdirect:
+        if not cls.runappdirect:
             space = cls.space
             # stubs for some modules,
             # just for multiprocessing to import correctly on Windows
@@ -114,7 +114,7 @@
             space.call_method(cls.w_connections, "append", space.wrap(client))
 
             return space.wrap((server.fileno(), client.fileno()))
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             cls.w_socketpair = lambda self: socketpair(cls.space)
         else:
             cls.w_socketpair = cls.space.wrap(interp2app(socketpair))
diff --git a/pypy/module/_sre/test/test_app_sre.py b/pypy/module/_sre/test/test_app_sre.py
--- a/pypy/module/_sre/test/test_app_sre.py
+++ b/pypy/module/_sre/test/test_app_sre.py
@@ -598,7 +598,7 @@
     spaceconfig = dict(usemodules=('_locale',))
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("can only be run on py.py: _sre opcodes don't match")
         # This imports support_test_sre as the global "s"
         init_app_test(cls, cls.space)
diff --git a/pypy/module/bz2/test/test_large.py b/pypy/module/bz2/test/test_large.py
--- a/pypy/module/bz2/test/test_large.py
+++ b/pypy/module/bz2/test/test_large.py
@@ -5,7 +5,7 @@
     spaceconfig = dict(usemodules=('bz2',))
 
     def setup_class(cls):
-        if not cls.option.runappdirect:
+        if not cls.runappdirect:
             py.test.skip("skipping this very slow test; try 'pypy-c -A'")
         largetest_bz2 = py.path.local(__file__).dirpath().join("largetest.bz2")
         cls.w_compressed_data = cls.space.wrap(largetest_bz2.read('rb'))
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -36,7 +36,7 @@
 class AppTestJitHook(object):
     spaceconfig = dict(usemodules=('pypyjit',))
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("Can't run this test with -A")
         w_f = cls.space.appexec([], """():
         def function():
diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -12,7 +12,7 @@
 class AppTestAppSysTests:
 
     def setup_class(cls):
-        cls.w_appdirect = cls.space.wrap(cls.option.runappdirect)
+        cls.w_appdirect = cls.space.wrap(cls.runappdirect)
         cls.w_filesystemenc = cls.space.wrap(sys.getfilesystemencoding())
 
     def test_sys_in_modules(self):
@@ -126,7 +126,7 @@
 class AppTestSysModulePortedFromCPython:
 
     def setup_class(cls):
-        cls.w_appdirect = cls.space.wrap(cls.option.runappdirect)
+        cls.w_appdirect = cls.wrap(cls.runappdirect)
 
     def test_original_displayhook(self):
         import sys, cStringIO, __builtin__
diff --git a/pypy/module/test_lib_pypy/test_stackless_pickle.py b/pypy/module/test_lib_pypy/test_stackless_pickle.py
--- a/pypy/module/test_lib_pypy/test_stackless_pickle.py
+++ b/pypy/module/test_lib_pypy/test_stackless_pickle.py
@@ -5,7 +5,7 @@
     spaceconfig = dict(usemodules=('_continuation', '_socket'))
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             cls.w_lev = cls.space.wrap(14)
         else:
             cls.w_lev = cls.space.wrap(2)
diff --git a/pypy/module/thread/test/support.py b/pypy/module/thread/test/support.py
--- a/pypy/module/thread/test/support.py
+++ b/pypy/module/thread/test/support.py
@@ -32,7 +32,7 @@
     spaceconfig = dict(usemodules=('thread', 'time', 'signal'))
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             def plain_waitfor(self, condition, delay=1):
                 adaptivedelay = 0.04
                 limit = time.time() + NORMAL_TIMEOUT * delay
diff --git a/pypy/objspace/std/test/test_celldict.py b/pypy/objspace/std/test/test_celldict.py
--- a/pypy/objspace/std/test/test_celldict.py
+++ b/pypy/objspace/std/test/test_celldict.py
@@ -56,7 +56,7 @@
     spaceconfig = {"objspace.std.withcelldict": True}
 
     def setup_class(cls):
-        cls.w_runappdirect = cls.space.wrap(cls.option.runappdirect)
+        cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
 
     def w_impl_used(self, obj):
         if self.runappdirect:
@@ -125,7 +125,7 @@
     spaceconfig = {"objspace.std.withcelldict": True}
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("__repr__ doesn't work on appdirect")
         strategy = ModuleDictStrategy(cls.space)
         storage = strategy.get_empty_storage()
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -771,7 +771,7 @@
 
 class AppTestStrategies(object):
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("__repr__ doesn't work on appdirect")
 
     def w_get_strategy(self, obj):
diff --git a/pypy/objspace/std/test/test_identitydict.py b/pypy/objspace/std/test/test_identitydict.py
--- a/pypy/objspace/std/test/test_identitydict.py
+++ b/pypy/objspace/std/test/test_identitydict.py
@@ -6,7 +6,7 @@
 
     def setup_class(cls):
         from pypy.objspace.std import identitydict
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("interp2app doesn't work on appdirect")
 
         def compares_by_identity(space, w_cls):
@@ -59,7 +59,7 @@
     spaceconfig = {"objspace.std.withidentitydict": True}
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("interp2app doesn't work on appdirect")
 
     def w_uses_identity_strategy(self, obj):
diff --git a/pypy/objspace/std/test/test_kwargsdict.py b/pypy/objspace/std/test/test_kwargsdict.py
--- a/pypy/objspace/std/test/test_kwargsdict.py
+++ b/pypy/objspace/std/test/test_kwargsdict.py
@@ -124,7 +124,7 @@
 
 class AppTestKwargsDictStrategy(object):
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("__repr__ doesn't work on appdirect")
 
     def w_get_strategy(self, obj):
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -404,10 +404,10 @@
 class AppTestW_ListObject(object):
     def setup_class(cls):
         import sys
-        on_cpython = (cls.option.runappdirect and
+        on_cpython = (cls.runappdirect and
                       not hasattr(sys, 'pypy_translation_info'))
         cls.w_on_cpython = cls.space.wrap(on_cpython)
-        cls.w_runappdirect = cls.space.wrap(cls.option.runappdirect)
+        cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
 
     def test_getstrategyfromlist_w(self):
         l0 = ["a", "2", "a", True]
diff --git a/pypy/objspace/std/test/test_proxy_internals.py b/pypy/objspace/std/test/test_proxy_internals.py
--- a/pypy/objspace/std/test/test_proxy_internals.py
+++ b/pypy/objspace/std/test/test_proxy_internals.py
@@ -22,7 +22,7 @@
 
 class AppTestProxyInterpOnly(AppProxy):
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("interp only test")
         from pypy.interpreter.typedef import TypeDef, interp2app
         from pypy.interpreter.baseobjspace import Wrappable
diff --git a/pypy/objspace/std/test/test_rangeobject.py b/pypy/objspace/std/test/test_rangeobject.py
--- a/pypy/objspace/std/test/test_rangeobject.py
+++ b/pypy/objspace/std/test/test_rangeobject.py
@@ -4,7 +4,7 @@
     spaceconfig = {"objspace.std.withrangelist": True}
 
     def setup_class(cls):
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("__pypy__.internal_repr() cannot be used to see "
                          "if a range list was forced on top of pypy-c")
         cls.w_not_forced = cls.space.appexec([], """():
diff --git a/pypy/objspace/std/test/test_specialisedtupleobject.py b/pypy/objspace/std/test/test_specialisedtupleobject.py
--- a/pypy/objspace/std/test/test_specialisedtupleobject.py
+++ b/pypy/objspace/std/test/test_specialisedtupleobject.py
@@ -67,7 +67,7 @@
                 raise OperationError(space.w_ReferenceError, w_tuple)
             w_tuple.delegating = delegation_forbidden
             return w_tuple
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             cls.w_forbid_delegation = lambda self, x: x
             cls.test_delegation = lambda self: skip("runappdirect")
         else:
diff --git a/pypy/objspace/std/test/test_userobject.py b/pypy/objspace/std/test/test_userobject.py
--- a/pypy/objspace/std/test/test_userobject.py
+++ b/pypy/objspace/std/test/test_userobject.py
@@ -7,7 +7,7 @@
     spaceconfig = {}
 
     def setup_class(cls):
-        cls.w_runappdirect = cls.space.wrap(bool(cls.option.runappdirect))
+        cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
         def rand(space):
             import random
             return space.wrap(random.randrange(0, 5))
@@ -281,7 +281,7 @@
 
         cls.prev_installer = multimethod.Installer
         multimethod.Installer = multimethod.InstallerVersion2
-        if cls.option.runappdirect:
+        if cls.runappdirect:
             py.test.skip("Cannot run different installers when runappdirect")
 
     def teardown_class(cls):


More information about the pypy-commit mailing list