Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r809:5ddad9498d4a Date: 2012-08-12 13:31 +0200 http://bitbucket.org/cffi/cffi/changeset/5ddad9498d4a/
Log: intermediate checkin diff --git a/testing/test_verify.py b/testing/test_verify.py --- a/testing/test_verify.py +++ b/testing/test_verify.py @@ -28,18 +28,26 @@ assert hasattr(lib, '_cffi_python_module') == (not expected_generic) assert hasattr(lib, '_cffi_generic_module') == expected_generic -def test_missing_function_compile_error(): +def test_missing_function(ffi=None): # uses the FFI hacked above with '-Werror' - ffi = FFI() + if ffi is None: + ffi = FFI() ffi.cdef("void some_completely_unknown_function();") - py.test.raises(VerificationError, ffi.verify) + try: + lib = ffi.verify() + except VerificationError: + pass # expected case: we get a VerificationError + else: + # but depending on compiler and loader details, maybe + # 'lib' could actually be imported but will fail if we + # actually try to call the unknown function... + lib.some_completely_unknown_function() + # ^^ crashes completely?? 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) + test_missing_function(ffi=cffi.FFI()) def test_simple_case(): ffi = FFI() _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit