Author: Amaury Forgeot d'Arc <[email protected]>
Branch: less-gettestobjspace
Changeset: r58608:3c18b10e3af1
Date: 2012-10-28 22:39 +0100
http://bitbucket.org/pypy/pypy/changeset/3c18b10e3af1/

Log:    Progress. cppyy tests could probably share more code.

diff --git a/pypy/module/cppyy/test/test_aclassloader.py 
b/pypy/module/cppyy/test/test_aclassloader.py
--- a/pypy/module/cppyy/test/test_aclassloader.py
+++ b/pypy/module/cppyy/test/test_aclassloader.py
@@ -1,5 +1,4 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 
 currpath = py.path.local(__file__).dirpath()
@@ -13,8 +12,7 @@
 
 
 class AppTestACLASSLOADER:
-    def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=['cppyy'])
+    spaceconfig = dict(usemodules=['cppyy'])
 
     def test01_class_autoloading(self):
         """Test whether a class can be found through .rootmap."""
diff --git a/pypy/module/cppyy/test/test_advancedcpp.py 
b/pypy/module/cppyy/test/test_advancedcpp.py
--- a/pypy/module/cppyy/test/test_advancedcpp.py
+++ b/pypy/module/cppyy/test/test_advancedcpp.py
@@ -1,5 +1,4 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 from pypy.module.cppyy import capi
 
@@ -7,8 +6,6 @@
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("advancedcppDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy', 'array'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -18,11 +15,11 @@
             raise OSError("'make' failed (see stderr)")
 
 class AppTestADVANCEDCPP:
+    spaceconfig = dict(usemodules=['cppyy', 'array'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_test_dct = space.wrap(test_dct)
-        cls.w_capi_identity = space.wrap(capi.identify())
+        cls.w_test_dct = cls.space.wrap(test_dct)
+        cls.w_capi_identity = cls.space.wrap(capi.identify())
         cls.w_advanced = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_cint.py 
b/pypy/module/cppyy/test/test_cint.py
--- a/pypy/module/cppyy/test/test_cint.py
+++ b/pypy/module/cppyy/test/test_cint.py
@@ -1,5 +1,4 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 # These tests are for the CINT backend only (they exercise ROOT features
 # and classes that are not loaded/available with the Reflex backend). At
@@ -11,8 +10,6 @@
 currpath = py.path.local(__file__).dirpath()
 iotypes_dct = str(currpath.join("iotypesDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -21,8 +18,7 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestCINT:
-    def setup_class(cls):
-        cls.space = space
+    spaceconfig = dict(usemodules=['cppyy'])
 
     def test01_globals(self):
         """Test the availability of ROOT globals"""
@@ -100,8 +96,7 @@
 
 
 class AppTestCINTPythonizations:
-    def setup_class(cls):
-        cls.space = space
+    spaceconfig = dict(usemodules=['cppyy'])
 
     def test03_TVector(self):
         """Test TVector2/3/T behavior"""
@@ -121,13 +116,14 @@
 
 
 class AppTestCINTTTree:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        cls.w_N = space.wrap(5)
-        cls.w_M = space.wrap(10)
-        cls.w_fname = space.wrap("test.root")
-        cls.w_tname = space.wrap("test")
-        cls.w_title = space.wrap("test tree")
+        cls.w_N = cls.space.wrap(5)
+        cls.w_M = cls.space.wrap(10)
+        cls.w_fname = cls.space.wrap("test.root")
+        cls.w_tname = cls.space.wrap("test")
+        cls.w_title = cls.space.wrap("test tree")
         cls.w_iotypes = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (iotypes_dct,))
diff --git a/pypy/module/cppyy/test/test_cppyy.py 
b/pypy/module/cppyy/test/test_cppyy.py
--- a/pypy/module/cppyy/test/test_cppyy.py
+++ b/pypy/module/cppyy/test/test_cppyy.py
@@ -1,13 +1,10 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 from pypy.module.cppyy import interp_cppyy, executor
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("example01Dict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -16,7 +13,7 @@
         raise OSError("'make' failed (see stderr)")
 
 class TestCPPYYImplementation:
-    def test01_class_query(self):
+    def test01_class_query(self, space):
         # NOTE: this test needs to run before test_pythonify.py
         dct = interp_cppyy.load_dictionary(space, test_dct)
         w_cppyyclass = interp_cppyy.scope_byname(space, "example01")
@@ -31,9 +28,9 @@
 
 
 class AppTestCPPYY:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
         cls.w_example01, cls.w_payload = 
cls.space.unpackiterable(cls.space.appexec([], """():
             import cppyy
             cppyy.load_reflection_info(%r)
diff --git a/pypy/module/cppyy/test/test_crossing.py 
b/pypy/module/cppyy/test/test_crossing.py
--- a/pypy/module/cppyy/test/test_crossing.py
+++ b/pypy/module/cppyy/test/test_crossing.py
@@ -1,5 +1,4 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
 
 currpath = py.path.local(__file__).dirpath()
@@ -14,9 +13,10 @@
 
 
 class AppTestCrossing(AppTestCpythonExtensionBase):
+    spaceconfig = dict(usemodules=['cpyext', 'cppyy', 'thread', '_rawffi', 
'_ffi', 'array'])
+
     def setup_class(cls):
         # following from AppTestCpythonExtensionBase, with cppyy added
-        cls.space = gettestobjspace(usemodules=['cpyext', 'cppyy', 'thread', 
'_rawffi', '_ffi', 'array'])
         cls.space.getbuiltinmodule("cpyext")
         from pypy.module.imp.importing import importhook
         importhook(cls.space, "os") # warm up reference counts
diff --git a/pypy/module/cppyy/test/test_datatypes.py 
b/pypy/module/cppyy/test/test_datatypes.py
--- a/pypy/module/cppyy/test/test_datatypes.py
+++ b/pypy/module/cppyy/test/test_datatypes.py
@@ -1,12 +1,9 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("datatypesDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy', 'array', '_rawffi'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -15,11 +12,11 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestDATATYPES:
+    spaceconfig = dict(usemodules=['cppyy', 'array', '_rawffi'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_N = space.wrap(5)    # should be imported from the dictionary
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_N = cls.space.wrap(5)  # should be imported from the dictionary
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_datatypes = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_fragile.py 
b/pypy/module/cppyy/test/test_fragile.py
--- a/pypy/module/cppyy/test/test_fragile.py
+++ b/pypy/module/cppyy/test/test_fragile.py
@@ -1,13 +1,9 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
-
 from pypy.module.cppyy import capi
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("fragileDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -16,11 +12,11 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestFRAGILE:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_test_dct  = space.wrap(test_dct)
-        cls.w_capi = space.wrap(capi)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
+        cls.w_capi = cls.space.wrap(capi)
         cls.w_fragile = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_operators.py 
b/pypy/module/cppyy/test/test_operators.py
--- a/pypy/module/cppyy/test/test_operators.py
+++ b/pypy/module/cppyy/test/test_operators.py
@@ -1,12 +1,9 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("operatorsDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -15,11 +12,11 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestOPERATORS:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_N = space.wrap(5)    # should be imported from the dictionary
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_N = cls.space.wrap(5)  # should be imported from the dictionary
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_operators = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_overloads.py 
b/pypy/module/cppyy/test/test_overloads.py
--- a/pypy/module/cppyy/test/test_overloads.py
+++ b/pypy/module/cppyy/test/test_overloads.py
@@ -1,12 +1,9 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("overloadsDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -15,10 +12,10 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestOVERLOADS:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_overloads = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_pythonify.py 
b/pypy/module/cppyy/test/test_pythonify.py
--- a/pypy/module/cppyy/test/test_pythonify.py
+++ b/pypy/module/cppyy/test/test_pythonify.py
@@ -1,13 +1,10 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 from pypy.module.cppyy import interp_cppyy, executor
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("example01Dict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -16,10 +13,10 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestPYTHONIFY:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_example01 = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -325,10 +322,10 @@
 
 
 class AppTestPYTHONIFY_UI:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_test_dct  = self.space.wrap(test_dct)
         cls.w_example01 = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_stltypes.py 
b/pypy/module/cppyy/test/test_stltypes.py
--- a/pypy/module/cppyy/test/test_stltypes.py
+++ b/pypy/module/cppyy/test/test_stltypes.py
@@ -1,12 +1,9 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("stltypesDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -15,10 +12,11 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestSTLVECTOR:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        cls.w_N = space.wrap(13)
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_N = cls.space.wrap(13)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_stlvector = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -202,9 +200,10 @@
 
 
 class AppTestSTLSTRING:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_stlstring = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -281,10 +280,11 @@
 
 
 class AppTestSTLSTRING:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        cls.w_N = space.wrap(13)
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_N = cls.space.wrap(13)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_stlstring = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_streams.py 
b/pypy/module/cppyy/test/test_streams.py
--- a/pypy/module/cppyy/test/test_streams.py
+++ b/pypy/module/cppyy/test/test_streams.py
@@ -1,12 +1,9 @@
 import py, os, sys
-from pypy.conftest import gettestobjspace
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("std_streamsDict.so"))
 
-space = gettestobjspace(usemodules=['cppyy'])
-
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
@@ -15,10 +12,10 @@
         raise OSError("'make' failed (see stderr)")
 
 class AppTestSTDStreams:
+    spaceconfig = dict(usemodules=['cppyy'])
+
     def setup_class(cls):
-        cls.space = space
-        env = os.environ
-        cls.w_test_dct  = space.wrap(test_dct)
+        cls.w_test_dct  = cls.space.wrap(test_dct)
         cls.w_streams = cls.space.appexec([], """():
             import cppyy
             return cppyy.load_reflection_info(%r)""" % (test_dct, ))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to