Author: Matti Picus <[email protected]>
Branch: py3.5
Changeset: r92876:955b8000658b
Date: 2017-10-29 21:01 +0200
http://bitbucket.org/pypy/pypy/changeset/955b8000658b/

Log:    merge py3.5-appexec which will now raise on improper use of appexec
        in app tests

diff --git a/pypy/module/_socket/test/test_sock_app.py 
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -729,7 +729,12 @@
     def setup_class(cls):
         if not hasattr(os, 'getpid'):
             pytest.skip("AF_NETLINK needs os.getpid()")
-        w_ok = space.appexec([], "(): import _socket; " +
+        
+        if cls.runappdirect:
+            import _socket
+            w_ok = hasattr(_socket, 'AF_NETLINK')
+        else:
+            w_ok = space.appexec([], "(): import _socket; " +
                                  "return hasattr(_socket, 'AF_NETLINK')")
         if not space.is_true(w_ok):
             pytest.skip("no AF_NETLINK on this platform")
@@ -737,7 +742,8 @@
 
     def test_connect_to_kernel_netlink_routing_socket(self):
         import _socket, os
-        s = _socket.socket(_socket.AF_NETLINK, _socket.SOCK_DGRAM, 
_socket.NETLINK_ROUTE)
+        s = _socket.socket(_socket.AF_NETLINK, _socket.SOCK_DGRAM,
+                           _socket.NETLINK_ROUTE)
         assert s.getsockname() == (0, 0)
         s.bind((0, 0))
         a, b = s.getsockname()
@@ -749,7 +755,11 @@
     def setup_class(cls):
         if not hasattr(os, 'getuid') or os.getuid() != 0:
             pytest.skip("AF_PACKET needs to be root for testing")
-        w_ok = space.appexec([], "(): import _socket; " +
+        if cls.runappdirect:
+            import _socket
+            w_ok = hasattr(_socket, 'AF_PACKET')
+        else:
+            w_ok = space.appexec([], "(): import _socket; " +
                                  "return hasattr(_socket, 'AF_PACKET')")
         if not space.is_true(w_ok):
             pytest.skip("no AF_PACKET on this platform")
diff --git a/pypy/tool/pytest/apptest.py b/pypy/tool/pytest/apptest.py
--- a/pypy/tool/pytest/apptest.py
+++ b/pypy/tool/pytest/apptest.py
@@ -239,7 +239,7 @@
         space = gettestobjspace()
         filename = self._getdynfilename(target)
         func = app2interp_temp(src, filename=filename)
-        print "executing", func
+        # print "executing", func
         self.execute_appex(space, func, space)
 
     def repr_failure(self, excinfo):
diff --git a/pypy/tool/pytest/objspace.py b/pypy/tool/pytest/objspace.py
--- a/pypy/tool/pytest/objspace.py
+++ b/pypy/tool/pytest/objspace.py
@@ -100,6 +100,8 @@
         return list(itr)
 
     def is_true(self, obj):
+        if isinstance(obj, tuple) and isinstance(obj[0], py.code.Source):
+            raise ValueError('bool(appexec object) unknown')
         return bool(obj)
 
     def is_none(self, obj):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to