Skip to content

Commit 08b14d1

Browse files
TimoLassmannclaude
andcommitted
Remove pytest_benchmark_update_json hook to fix plugin validation error
The hook was causing 'unknown hook' errors when pytest-benchmark wasn't installed. Removed the hook entirely since pytest-benchmark is not a dependency in the workflow. Users can add pytest-benchmark if they need benchmark display functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 201b476 commit 08b14d1

2 files changed

Lines changed: 4 additions & 40 deletions

File tree

.github/workflows/python.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717
- 'CMakeLists.txt'
1818
- 'pyproject.toml'
1919
- '.github/workflows/python.yml'
20+
workflow_dispatch:
2021

2122
jobs:
2223
lint:

tests/python/conftest.py

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -292,43 +292,6 @@ def expected_results():
292292
return EXPECTED_ALIGNMENTS.copy()
293293

294294

295-
# Check if pytest-benchmark is available
296-
try:
297-
import pytest_benchmark
298-
PYTEST_BENCHMARK_AVAILABLE = True
299-
300-
def pytest_benchmark_update_json(config, benchmarks, output_json):
301-
"""Hook to add rich table display for benchmarks."""
302-
if not RICH_AVAILABLE:
303-
return
304-
305-
# Create a rich table for display
306-
console = Console()
307-
table = Table(title="Benchmark Results", show_header=True, header_style="bold magenta")
308-
309-
# Add columns with better fitting widths
310-
table.add_column("Name", style="cyan", no_wrap=True, max_width=25)
311-
table.add_column("Min", justify="right", style="green", max_width=8)
312-
table.add_column("Max", justify="right", style="red", max_width=8)
313-
table.add_column("Mean", justify="right", style="blue", max_width=8)
314-
table.add_column("Median", justify="right", style="blue", max_width=8)
315-
table.add_column("OPS", justify="right", style="yellow", max_width=8)
316-
table.add_column("Rounds", justify="right", style="white", max_width=8)
317-
318-
# Add rows from benchmark data
319-
for bench in benchmarks:
320-
name = bench.name
321-
# Format timing values
322-
min_val = f"{bench.min*1000000:.1f}μs"
323-
max_val = f"{bench.max*1000000:.1f}μs"
324-
mean_val = f"{bench.mean*1000000:.1f}μs"
325-
median_val = f"{bench.median*1000000:.1f}μs"
326-
ops_val = f"{1/bench.mean/1000:.1f}K"
327-
rounds_val = str(bench.rounds)
328-
329-
table.add_row(name, min_val, max_val, mean_val, median_val, ops_val, rounds_val)
330-
331-
console.print(table)
332-
333-
except ImportError:
334-
PYTEST_BENCHMARK_AVAILABLE = False
295+
# Note: pytest_benchmark_update_json hook removed to avoid plugin validation errors
296+
# when pytest-benchmark is not installed. If you need benchmark display functionality,
297+
# install pytest-benchmark: pip install pytest-benchmark

0 commit comments

Comments
 (0)