[pypy-commit] cffi cffi-1.0: Fix tests

arigo noreply at buildbot.pypy.org
Sat May 9 19:15:40 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1952:89045df4c441
Date: 2015-05-09 19:16 +0200
http://bitbucket.org/cffi/cffi/changeset/89045df4c441/

Log:	Fix tests

diff --git a/_cffi1/test_verify1.py b/_cffi1/test_verify1.py
--- a/_cffi1/test_verify1.py
+++ b/_cffi1/test_verify1.py
@@ -1037,9 +1037,11 @@
         }
         int (*foo)(struct foo_s s) = &foo1;
     """)
-    e = py.test.raises(TypeError, "lib.foo")    # lazily
-    msg ='cannot pass as an argument a struct that was completed with verify()'
-    assert msg in str(e.value)
+    e = py.test.raises(NotImplementedError, lib.foo, "?")
+    msg = ("ctype 'struct foo_s' not supported as argument (it is a struct "
+           'declared with "...;", but the C calling convention may depend '
+           'on the missing fields)')
+    assert str(e.value) == msg
 
 def test_func_returns_struct():
     ffi = FFI()
@@ -2137,7 +2139,7 @@
         "ctype 'Data' (size 4) not supported as return value")
     e = py.test.raises(NotImplementedError, barptr)
     assert str(e.value) == (
-        "ctype 'MyStr' not supported as argument or return value "
+        "ctype 'MyStr' not supported as return value "
         "(it is a struct with bit fields)")
 
 def test_verify_extra_arguments():
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -1050,7 +1050,7 @@
     ffi = FFI()
     ffi.cdef("struct foo_s { long a; ...; };\n"
              "int (*foo)(struct foo_s);")
-    e = py.test.raises(TypeError, ffi.verify, """
+    lib = ffi.verify("""
         struct foo_s {
             double b;
             long a;
@@ -1060,8 +1060,11 @@
         }
         int (*foo)(struct foo_s s) = &foo1;
     """)
-    msg ='cannot pass as an argument a struct that was completed with verify()'
-    assert msg in str(e.value)
+    e = py.test.raises(NotImplementedError, lib.foo, "?")
+    msg = ("ctype 'struct foo_s' not supported as argument (it is a struct "
+           'declared with "...;", but the C calling convention may depend '
+           'on the missing fields)')
+    assert str(e.value) == msg
 
 def test_func_returns_struct():
     ffi = FFI()
@@ -2143,7 +2146,7 @@
         "ctype 'Data' (size 4) not supported as return value")
     e = py.test.raises(NotImplementedError, barptr)
     assert str(e.value) == (
-        "ctype 'MyStr' not supported as argument or return value "
+        "ctype 'MyStr' not supported as return value "
         "(it is a struct with bit fields)")
 
 def test_verify_extra_arguments():


More information about the pypy-commit mailing list