[pypy-commit] pypy less-gettestobjspace: Progress. Fix for spaceconfig={}

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


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: less-gettestobjspace
Changeset: r58606:9fa214a7ec3d
Date: 2012-10-28 22:03 +0100
http://bitbucket.org/pypy/pypy/changeset/9fa214a7ec3d/

Log:	Progress. Fix for spaceconfig={}

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -328,7 +328,7 @@
         if appclass is not None:
             # Make cls.space and cls.option available in tests.
             spaceconfig = getattr(appclass.obj, 'spaceconfig', None)
-            if spaceconfig:
+            if spaceconfig is not None:
                 appclass.obj.space = gettestobjspace(**spaceconfig)
             appclass.obj.option = option
 
diff --git a/pypy/module/__builtin__/test/test_buffer.py b/pypy/module/__builtin__/test/test_buffer.py
--- a/pypy/module/__builtin__/test/test_buffer.py
+++ b/pypy/module/__builtin__/test/test_buffer.py
@@ -1,7 +1,6 @@
 """Tests some behaviour of the buffer type that is not tested in
 lib-python/2.5.2/test/test_types.py where the stdlib buffer tests live."""
 import autopath
-from pypy.conftest import gettestobjspace
 
 class AppTestBuffer:
     spaceconfig = dict(usemodules=['array'])
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
@@ -1,6 +1,5 @@
 import autopath
 import sys
-from pypy import conftest
 
 class AppTestBuiltinApp:
     def setup_class(cls):
@@ -21,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 conftest.option.runappdirect:
+        if cls.option.runappdirect:
             cls.w_safe_runtimerror = cls.space.wrap(True)
         else:
             cls.w_safe_runtimerror = cls.space.wrap(sys.version_info < (2, 6))
@@ -640,10 +639,7 @@
 
 
 class AppTestGetattr:
-    OPTIONS = {}
-
-    def setup_class(cls):
-        cls.space = conftest.gettestobjspace(**cls.OPTIONS)
+    spaceconfig = {}
 
     def test_getattr(self):
         class a(object):
@@ -669,7 +665,7 @@
 
 
 class AppTestGetattrWithGetAttributeShortcut(AppTestGetattr):
-    OPTIONS = {"objspace.std.getattributeshortcut": True}
+    spaceconfig = {"objspace.std.getattributeshortcut": True}
 
 
 class TestInternal:
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
@@ -1,6 +1,5 @@
 from __future__ import with_statement
 import py
-from pypy.conftest import gettestobjspace, option
 from pypy.interpreter import gateway
 
 
@@ -1080,9 +1079,10 @@
         assert self.is_strdict(A)
 
 class AppTestOldStyleMapDict(AppTestOldstyle):
+    spaceconfig = {"objspace.std.withmapdict": True}
+
     def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.withmapdict": True})
-        if option.runappdirect:
+        if cls.option.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)


More information about the pypy-commit mailing list