File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -172,23 +172,26 @@ def wrap_pyfunc_with_instrumentation(
172172 lib : LibType ,
173173 nodeid : str ,
174174 config : pytest .Config ,
175- fn : Callable [P , T ],
175+ testfunction : Callable [P , T ],
176176) -> Callable [P , T ]:
177- @functools .wraps (fn )
177+ @functools .wraps (testfunction )
178178 def wrapper (* args : P .args , ** kwargs : P .kwargs ) -> T :
179+ def __codspeed_root_frame__ ():
180+ return testfunction (* args , ** kwargs )
181+
179182 is_gc_enabled = gc .isenabled ()
180183 if is_gc_enabled :
181184 gc .collect ()
182185 gc .disable ()
183186 try :
184187 if SUPPORTS_PERF_TRAMPOLINE :
185188 # Warmup CPython performance map cache
186- fn ( * args , ** kwargs )
189+ __codspeed_root_frame__ ( )
187190
188191 lib .zero_stats ()
189192 lib .start_instrumentation ()
190193 try :
191- return fn ( * args , ** kwargs )
194+ return __codspeed_root_frame__ ( )
192195 finally :
193196 lib .stop_instrumentation ()
194197 uri = get_git_relative_uri (nodeid , config .rootpath )
Original file line number Diff line number Diff line change @@ -306,8 +306,10 @@ def fixtured_child():
306306
307307 with open (perf_filepath ) as perf_file :
308308 lines = perf_file .readlines ()
309+
309310 assert any (
310- "py::_run_with_instrumentation.<locals>.__codspeed_root_frame__" in line
311+ "py::wrap_pyfunc_with_instrumentation.<locals>.wrapper.<locals>.__codspeed_root_frame__"
312+ in line
311313 for line in lines
312314 ), "No root frame found in perf map"
313315 assert any (
You can’t perform that action at this time.
0 commit comments