|
|
|
|
|
by slowking2
1595 days ago
|
|
You can use tempfiles and (on OSX) use the private API of ctypes to dlclose to close the handle. Different call on Windows I think. Something like import _ctypes
import shutil
import tempfile
@pytest.fixture
def libfact():
tmp = tempfile.NamedTemporaryFile(delete=True)
shutil.copy2("./fact.so", tmp.name)
lib = CDLL(tmp.name)
yield lib
_ctypes.dlclose(lib.handle)
EDIT: fixed error mentioned in reply. |
|