[pypy-commit] pypy reflex-support: better handling of tests with different backends

wlav noreply at buildbot.pypy.org
Tue Apr 22 19:27:01 CEST 2014


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r70855:a8c7b05f2335
Date: 2014-04-22 10:24 -0700
http://bitbucket.org/pypy/pypy/changeset/a8c7b05f2335/

Log:	better handling of tests with different backends

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
@@ -3,18 +3,25 @@
 @py.test.mark.tryfirst
 def pytest_runtest_setup(item):
     if py.path.local.sysfind('genreflex') is None:
-        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
+        if 'dummy' in lcapi.reflection_library:
+            # run only tests that are covered by the dummy backend and tests
+            # that do not rely on reflex
+            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")
 
+def pytest_configure(config):
+    if py.path.local.sysfind('genreflex') is None:
         import pypy.module.cppyy.capi.loadable_capi as lcapi
         try:
             import ctypes
             ctypes.CDLL(lcapi.reflection_library)
         except Exception, e:
+            # build dummy backend (which has reflex info and calls hard-wired)
             import os
             from rpython.translator.tool.cbuild import ExternalCompilationInfo
-            from rpython.translator import platform
+            from rpython.translator.platform import platform
 
             from rpython.rtyper.lltypesystem import rffi
 
@@ -28,12 +35,9 @@
                 use_cpp_linker=True,
             )
 
-            soname = platform.platform.compile(
+            soname = platform.compile(
                 [], eci,
-                outputfilename='libcppyy_backend',
+                outputfilename='libcppyy_dummy_backend',
                 standalone=False)
 
             lcapi.reflection_library = str(soname)
-
-        lcapi.isdummy = True
-


More information about the pypy-commit mailing list