[pypy-commit] pypy default: Really skip the cppyy tests (tested on tannit where gcc is old)

arigo pypy.commits at gmail.com
Mon Jan 2 09:30:25 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r89292:1717aa219d47
Date: 2017-01-02 15:29 +0100
http://bitbucket.org/pypy/pypy/changeset/1717aa219d47/

Log:	Really skip the cppyy tests (tested on tannit where gcc is old)

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,12 +2,6 @@
 
 @py.test.mark.tryfirst
 def pytest_runtest_setup(item):
-    if 'linux' in sys.platform:
-        # tests require minimally std=c++11
-        cc_info = py.process.cmdexec('gcc -v --help')
-        if not '-std=c++11' in cc_info:
-            py.test.skip('skipping tests because gcc does not support C++11')
-
     if py.path.local.sysfind('genreflex') is None:
         import pypy.module.cppyy.capi.loadable_capi as lcapi
         if 'dummy' in lcapi.reflection_library:
diff --git a/pypy/module/cppyy/test/support.py b/pypy/module/cppyy/test/support.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/cppyy/test/support.py
@@ -0,0 +1,16 @@
+import py, sys, subprocess
+
+currpath = py.path.local(__file__).dirpath()
+
+
+def setup_make(targetname):
+    if sys.platform == 'win32':
+        py.test.skip("win32 not supported so far")
+    import pypy.module.cppyy.capi.loadable_capi as lcapi
+    popen = subprocess.Popen(["make", targetname], cwd=str(currpath),
+                             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    stdout, _ = popen.communicate()
+    if popen.returncode:
+        if '-std=c++11' in stdout:
+            py.test.skip("gcc does not seem to support -std=c++11")
+        raise OSError("'make' failed:\n%s" % (stdout,))
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,18 +1,15 @@
 import py, os, sys
+import subprocess
 
 from pypy.module.cppyy import interp_cppyy, executor
+from .support import setup_make
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("example01Dict.so"))
 
 def setup_module(mod):
-    if sys.platform == 'win32':
-        py.test.skip("win32 not supported so far")
-    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)")
+    setup_make("example01Dict.so")
 
 class TestCPPYYImplementation:
     def test01_class_query(self, space):
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,15 +1,12 @@
 import py, os, sys
+from .support import setup_make
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("datatypesDict.so"))
 
 def setup_module(mod):
-    if sys.platform == 'win32':
-        py.test.skip("win32 not supported so far")
-    err = os.system("cd '%s' && make datatypesDict.so" % currpath)
-    if err:
-        raise OSError("'make' failed (see stderr)")
+    setup_make("datatypesDict.so")
 
 class AppTestDATATYPES:
     spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
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,17 +1,14 @@
 import py, os, sys
 
 from pypy.module.cppyy import interp_cppyy, executor
+from .support import setup_make
 
 
 currpath = py.path.local(__file__).dirpath()
 test_dct = str(currpath.join("example01Dict.so"))
 
 def setup_module(mod):
-    if sys.platform == 'win32':
-        py.test.skip("win32 not supported so far")
-    err = os.system("cd '%s' && make example01Dict.so" % currpath)
-    if err:
-        raise OSError("'make' failed (see stderr)")
+    setup_make("example01Dict.so")
 
 class AppTestPYTHONIFY:
     spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])


More information about the pypy-commit mailing list