@pytest.mark.parametrize('funcname,test_id', parameters, ids=ids)
def test_ctypes_in_func_gen(pyi_builder, monkeypatch, funcname, compiled_dylib, test_id):
 soname = compiled_dylib.basename
 source = ((('\n    import ctypes ; from ctypes import *\n    def f():\n      def g():\n        lib = %s(%%(soname)r)\n    ' % funcname) + _template_ctypes_test) + '\n      g()\n    f()\n    ')
 __monkeypatch_resolveCtypesImports(monkeypatch, compiled_dylib.dirname)
 pyi_builder.test_source((source % locals()), test_id=test_id)

@ pytest . mark . parametrize ( 'funcname,test_id' , parameters , ids = ids ) def test_ctypes_in_func_gen ( pyi_builder , monkeypatch , funcname , compiled_dylib , test_id ) : soname = compiled_dylib . basename source = ( ( ( '\n    import ctypes ; from ctypes import *\n    def f():\n      def g():\n        lib = %s(%%(soname)r)\n    ' % funcname ) + _template_ctypes_test ) + '\n      g()\n    f()\n    ' ) __monkeypatch_resolveCtypesImports ( monkeypatch , compiled_dylib . dirname ) pyi_builder . test_source ( ( source % locals ( ) ) , test_id = test_id )
this is much like test_ctypes_gen except that the ctypes calls are in a function .