Skip to content

Commit 04b913a

Browse files
committed
Update plugin.py
1 parent 23a7db3 commit 04b913a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

codeflash/benchmarking/plugin/plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,12 @@ def wrapped_func(*args, **kwargs): # noqa: ANN002, ANN003, ANN202
251251

252252
def _run_benchmark(self, func, *args, **kwargs): # noqa: ANN001, ANN002, ANN003, ANN202
253253
"""Actual benchmark implementation."""
254+
node_path = getattr(self.request.node, "path", None) or getattr(self.request.node, "fspath", None)
255+
if node_path is None:
256+
raise RuntimeError("Unable to determine test file path from pytest node")
257+
254258
benchmark_module_path = module_name_from_file_path(
255-
Path(str(self.request.node.fspath)), Path(codeflash_benchmark_plugin.project_root), traverse_up=True
259+
Path(str(node_path)), Path(codeflash_benchmark_plugin.project_root), traverse_up=True
256260
)
257261

258262
benchmark_function_name = self.request.node.name

0 commit comments

Comments
 (0)