[pypy-commit] cffi default: Direct tests for close_lib()

arigo pypy.commits at gmail.com
Tue Feb 27 13:57:08 EST 2018


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r3113:191ee1e092eb
Date: 2018-02-27 19:56 +0100
http://bitbucket.org/cffi/cffi/changeset/191ee1e092eb/

Log:	Direct tests for close_lib()

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -406,6 +406,9 @@
     # the next one is from 'libm', not 'libc', but we assume
     # that it is already loaded too, so it should work
     assert x.load_function(BVoidP, 'sqrt')
+    #
+    x.close_lib()
+    py.test.raises(ValueError, x.load_function, BVoidP, 'sqrt')
 
 def test_no_len_on_nonarray():
     p = new_primitive_type("int")
@@ -1221,6 +1224,9 @@
     ll = find_and_load_library('c')
     stderr = ll.read_variable(BVoidP, "stderr")
     assert stderr == cast(BVoidP, _testfunc(8))
+    #
+    ll.close_lib()
+    py.test.raises(ValueError, ll.read_variable, BVoidP, "stderr")
 
 def test_read_variable_as_unknown_length_array():
     ## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
@@ -1247,6 +1253,9 @@
     assert not ll.read_variable(BVoidP, "stderr")
     ll.write_variable(BVoidP, "stderr", stderr)
     assert ll.read_variable(BVoidP, "stderr") == stderr
+    #
+    ll.close_lib()
+    py.test.raises(ValueError, ll.write_variable, BVoidP, "stderr", stderr)
 
 def test_callback():
     BInt = new_primitive_type("int")


More information about the pypy-commit mailing list