From d03539e34b97bbea259c82e6ccfb2301165c5105 Mon Sep 17 00:00:00 2001 From: Olivia Lynn Date: Mon, 12 Oct 2026 16:34:21 -0700 Subject: [PATCH 1/2] Pass a path, not a file handle, to --benchmark-json pytest-benchmark >= 5 declares --benchmark-json with type=Path and calls open(path, "wb") itself when saving results. The --lbench setup passed an already-open file object, so saving raised a TypeError and pytest-benchmark.json was left empty (0 bytes). Set benchmark_json to the path instead and require pytest-benchmark>=5, whose option handling this relies on. Co-Authored-By: Claude Opus 5.5 --- pyproject.toml | 2 +- src/lbench/pytest/plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 01acf03..45d5500 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dynamic = ["version"] requires-python = ">=3.10" dependencies = [ "pytest", - "pytest-benchmark", + "pytest-benchmark>=5", "typer", "dask[complete]", "dash", diff --git a/src/lbench/pytest/plugin.py b/src/lbench/pytest/plugin.py index fd8c7c4..b98ba51 100644 --- a/src/lbench/pytest/plugin.py +++ b/src/lbench/pytest/plugin.py @@ -39,7 +39,7 @@ def pytest_configure(config: pytest.Config): # configure pytest-benchmark config.option.benchmark_only = True - config.option.benchmark_json = (run_dir / "pytest-benchmark.json").open("wb") # kinda hacky + config.option.benchmark_json = run_dir / "pytest-benchmark.json" terminal = config.pluginmanager.get_plugin("terminalreporter") if terminal: From b7810312e6274f77da43416a4424b294d2aff583 Mon Sep 17 00:00:00 2001 From: Olivia Lynn Date: Mon, 12 Oct 2026 20:08:58 -0400 Subject: [PATCH 2/2] Update pytest-benchmark version requirement --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 45d5500..a4c4257 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dynamic = ["version"] requires-python = ">=3.10" dependencies = [ "pytest", - "pytest-benchmark>=5", + "pytest-benchmark>=5.3.0", "typer", "dask[complete]", "dash",