[pypy-commit] cffi default: Test and fix (thanks nphg)

arigo noreply at buildbot.pypy.org
Sun Aug 12 13:23:54 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r808:81dfcc881daa
Date: 2012-08-12 13:23 +0200
http://bitbucket.org/cffi/cffi/changeset/81dfcc881daa/

Log:	Test and fix (thanks nphg)

diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py
--- a/cffi/vengine_cpy.py
+++ b/cffi/vengine_cpy.py
@@ -97,7 +97,7 @@
             module = imp.load_dynamic(self.verifier.get_module_name(),
                                       self.verifier.modulefilename)
         except ImportError, e:
-            error = "importing %r: %s" % (self.modulefilename, e)
+            error = "importing %r: %s" % (self.verifier.modulefilename, e)
             raise ffiplatform.VerificationError(error)
         #
         # call loading_cpy_struct() to get the struct layout inferred by
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -28,11 +28,19 @@
     assert hasattr(lib, '_cffi_python_module') == (not expected_generic)
     assert hasattr(lib, '_cffi_generic_module') == expected_generic
 
-def test_missing_function():
+def test_missing_function_compile_error():
+    # uses the FFI hacked above with '-Werror'
     ffi = FFI()
     ffi.cdef("void some_completely_unknown_function();")
     py.test.raises(VerificationError, ffi.verify)
 
+def test_missing_function_import_error():
+    # uses the original FFI that just gives a warning during compilation
+    import cffi
+    ffi = cffi.FFI()
+    ffi.cdef("void some_completely_unknown_function();")
+    py.test.raises(VerificationError, ffi.verify)
+
 def test_simple_case():
     ffi = FFI()
     ffi.cdef("double sin(double x);")


More information about the pypy-commit mailing list