Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r70766:2a3916aaa1b8
Date: 2014-04-18 19:38 -0700
http://bitbucket.org/pypy/pypy/changeset/2a3916aaa1b8/

Log:    rejig test skipping and use of dummy backend

diff --git a/pypy/module/cppyy/test/Makefile b/pypy/module/cppyy/test/Makefile
--- a/pypy/module/cppyy/test/Makefile
+++ b/pypy/module/cppyy/test/Makefile
@@ -5,8 +5,10 @@
 
 ifneq (${REFLEXHOME},)
   ROOTSYS := ${REFLEXHOME}
+else ifneq (${ROOTSYS},)
+  ROOTSYS := ${ROOTSYS}
 else
-  ROOTSYS := ${ROOTSYS}
+  DUMMY := t
 endif
 
 ifeq ($(DUMMY),t)
diff --git a/pypy/module/cppyy/test/conftest.py 
b/pypy/module/cppyy/test/conftest.py
--- a/pypy/module/cppyy/test/conftest.py
+++ b/pypy/module/cppyy/test/conftest.py
@@ -2,32 +2,38 @@
 
 @py.test.mark.tryfirst
 def pytest_runtest_setup(item):
-    print item
     if py.path.local.sysfind('genreflex') is None:
-        #py.test.skip("genreflex is not installed")
-
-        # build the dummy CAPI
-
-        import os
-        from rpython.translator.tool.cbuild import ExternalCompilationInfo
-        from rpython.translator import platform
-
-        from rpython.rtyper.lltypesystem import rffi
-
-        pkgpath = py.path.local(__file__).dirpath().join(os.pardir)
-        srcpath = pkgpath.join('src')
-        incpath = pkgpath.join('include')
-
-        eci = ExternalCompilationInfo(
-            separate_module_files=[srcpath.join('dummy_backend.cxx')],
-            include_dirs=[incpath],
-            use_cpp_linker=True,
-        )
-
-        soname = platform.platform.compile(
-            [], eci,
-            outputfilename='libcppyy_backend',
-            standalone=False)
+        if not item.location[0] in ['test_helper.py', 'test_cppyy.py'] or \
+           (item.location[0] == 'test_cppyy.py' and not 
'TestCPPYYImplementation' in item.location[2]):
+            py.test.skip("genreflex is not installed")
 
         import pypy.module.cppyy.capi.loadable_capi as lcapi
-        lcapi.reflection_library = str(soname)
+        try:
+            import ctypes
+            ctypes.CDLL(lcapi.reflection_library)
+        except Exception, e:
+            import os
+            from rpython.translator.tool.cbuild import ExternalCompilationInfo
+            from rpython.translator import platform
+
+            from rpython.rtyper.lltypesystem import rffi
+
+            pkgpath = py.path.local(__file__).dirpath().join(os.pardir)
+            srcpath = pkgpath.join('src')
+            incpath = pkgpath.join('include')
+
+            eci = ExternalCompilationInfo(
+                separate_module_files=[srcpath.join('dummy_backend.cxx')],
+                include_dirs=[incpath],
+                use_cpp_linker=True,
+            )
+
+            soname = platform.platform.compile(
+                [], eci,
+                outputfilename='libcppyy_backend',
+                standalone=False)
+
+            lcapi.reflection_library = str(soname)
+
+        lcapi.isdummy = True
+
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,7 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
 
 currpath = py.path.local(__file__).dirpath()
 
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,8 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
-
 from pypy.module.cppyy import capi
 
 
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,9 +1,5 @@
 import py, os, sys
 
-isdummy = ''
-if py.path.local.sysfind('genreflex') is None:
-    isdummy = 'DUMMY=t'
-
 from pypy.module.cppyy import interp_cppyy, executor
 
 
@@ -13,7 +9,8 @@
 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
-    err = os.system("cd '%s' && make %s example01Dict.so" % (currpath, 
isdummy))
+    import pypy.module.cppyy.capi.loadable_capi as lcapi
+    err = os.system("cd '%s' && make example01Dict.so" % currpath)
     if err:
         raise OSError("'make' failed (see stderr)")
 
@@ -36,9 +33,6 @@
     spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
 
     def setup_class(cls):
-        if isdummy:
-            py.test.skip('skipping further tests in dummy mode')
-
         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,8 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-     py.test.skip("genreflex is not installed")
-
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator import platform
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,7 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("datatypesDict.so"))
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,8 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
-
 from pypy.module.cppyy import capi
 
 
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,7 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("operatorsDict.so"))
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,7 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("overloadsDict.so"))
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,8 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
-
 from pypy.module.cppyy import interp_cppyy, executor
 
 
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,8 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
-
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("stltypesDict.so"))
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,8 +1,5 @@
 import py, os, sys
 
-if py.path.local.sysfind('genreflex') is None:
-    py.test.skip("genreflex is not installed")
-
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("std_streamsDict.so"))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to