def test_dlclose():
    import _cffi_backend
    from re_python_pysrc import ffi
    lib = ffi.dlopen(extmod)
    ffi.dlclose(lib)
    e = py.test.raises(ffi.error, ffi.dlclose, lib)
    assert str(e.value).startswith(
        "library '%s' is already closed" % (extmod,))
    e = py.test.raises(ffi.error, getattr, lib, 'add42')
    assert str(e.value) == (
        "library '%s' has been closed" % (extmod,))
dataset/ETHPy150Open johncsnyder/SwiftKitten/cffi/testing/cffi1/test_re_python.py/test_dlclose/original