[pypy-commit] cffi default: Test for load_library(None).

arigo noreply at buildbot.pypy.org
Wed Aug 8 17:28:37 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r792:37c5822f06aa
Date: 2012-08-08 17:20 +0200
http://bitbucket.org/cffi/cffi/changeset/37c5822f06aa/

Log:	Test for load_library(None).

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -26,7 +26,10 @@
 
 def find_and_load_library(name, is_global=0):
     import ctypes.util
-    path = ctypes.util.find_library(name)
+    if name is None:
+        path = None
+    else:
+        path = ctypes.util.find_library(name)
     return load_library(path, is_global)
 
 def test_load_library():
@@ -297,6 +300,13 @@
     p = newp(BIntPtrPtr, q)
     assert p[0][0] == 43
 
+def test_load_standard_library():
+    x = find_and_load_library(None)
+    BVoidP = new_pointer_type(new_void_type())
+    assert x.load_function(BVoidP, 'strcpy')
+    py.test.raises(KeyError, x.load_function,
+                   BVoidP, 'xxx_this_function_does_not_exist')
+
 def test_hash_differences():
     BChar = new_primitive_type("char")
     BInt = new_primitive_type("int")


More information about the pypy-commit mailing list