("CDLL", "PyDLL", "WinDLL", "OleDLL", "cdll.LoadLibrary")),
):
for funcname in funcnames:
testname = "test_%s_%s__%s" % (name, funcname.replace(".", "_"), libname)
source =
%s
lib = %s(%%(soname)r)
% (import_, prefix+funcname) + _template_ctypes_test
// For test_source() to be able to get the real name of the
// test-case, this function has to be named "func" and have a
// local variable `__test_name__` containing the testname.
@skip_if_lib_missing(libname, reason)
def func(pyi_builder, __test_name__=testname,
libname=libname, source=source):
// evaluate the soname here, so the test-code contains a constant
soname = ctypes.util.find_library(libname)
source = source +_template_ctypes_test
pyi_builder.test_source(source % locals())
if funcname in ("WinDLL", "OleDLL"):
// WinDLL, OleDLL only work on windows.
func = skipif_notwin(func)
globals()[testname] = func
del func
// TODO: Add test-cases forthe prefabricated library loaders supporting
After Change
libname = "gs"
reason = "libgs.so (Ghostscript)"
parameters = []
for prefix in ("", "ctypes."):
for funcname in ("CDLL", "PyDLL", "WinDLL", "OleDLL", "cdll.LoadLibrary"):
params = (prefix+funcname, libname, reason)
if funcname in ("WinDLL", "OleDLL"):