Skip to content

Commit e3cfe9f

Browse files
committed
Update plugin.py
1 parent b13f218 commit e3cfe9f

File tree

1 file changed

+29
-1
lines changed
  • codeflash-benchmark/codeflash_benchmark

1 file changed

+29
-1
lines changed

codeflash-benchmark/codeflash_benchmark/plugin.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,35 @@
88

99
PYTEST_BENCHMARK_INSTALLED = importlib.util.find_spec("pytest_benchmark") is not None
1010

11+
benchmark_options = [
12+
("--benchmark-columns", "store", None, "Benchmark columns"),
13+
("--benchmark-group-by", "store", None, "Benchmark group by"),
14+
("--benchmark-name", "store", None, "Benchmark name pattern"),
15+
("--benchmark-sort", "store", None, "Benchmark sort column"),
16+
("--benchmark-json", "store", None, "Benchmark JSON output file"),
17+
("--benchmark-save", "store", None, "Benchmark save name"),
18+
("--benchmark-warmup", "store", None, "Benchmark warmup"),
19+
("--benchmark-warmup-iterations", "store", None, "Benchmark warmup iterations"),
20+
("--benchmark-min-time", "store", None, "Benchmark minimum time"),
21+
("--benchmark-max-time", "store", None, "Benchmark maximum time"),
22+
("--benchmark-min-rounds", "store", None, "Benchmark minimum rounds"),
23+
("--benchmark-timer", "store", None, "Benchmark timer"),
24+
("--benchmark-calibration-precision", "store", None, "Benchmark calibration precision"),
25+
("--benchmark-disable", "store_true", False, "Disable benchmarks"),
26+
("--benchmark-skip", "store_true", False, "Skip benchmarks"),
27+
("--benchmark-only", "store_true", False, "Only run benchmarks"),
28+
("--benchmark-verbose", "store_true", False, "Verbose benchmark output"),
29+
("--benchmark-histogram", "store", None, "Benchmark histogram"),
30+
("--benchmark-compare", "store", None, "Benchmark compare"),
31+
("--benchmark-compare-fail", "store", None, "Benchmark compare fail threshold"),
32+
]
33+
1134

1235
def pytest_configure(config: pytest.Config) -> None:
1336
"""Register the benchmark marker and disable conflicting plugins."""
1437
config.addinivalue_line("markers", "benchmark: mark test as a benchmark that should be run with codeflash tracing")
1538

1639
if config.getoption("--codeflash-trace") and PYTEST_BENCHMARK_INSTALLED:
17-
config.option.benchmark_disable = True
1840
config.pluginmanager.set_blocked("pytest_benchmark")
1941
config.pluginmanager.set_blocked("pytest-benchmark")
2042

@@ -23,6 +45,12 @@ def pytest_addoption(parser: pytest.Parser) -> None:
2345
parser.addoption(
2446
"--codeflash-trace", action="store_true", default=False, help="Enable CodeFlash tracing for benchmarks"
2547
)
48+
# These options are ignored when --codeflash-trace is used
49+
for option, action, default, help_text in benchmark_options:
50+
help_suffix = (
51+
" (ignored when --codeflash-trace is used)" if "disable" not in option and "skip" not in option else ""
52+
)
53+
parser.addoption(option, action=action, default=default, help=help_text + help_suffix)
2654

2755

2856
@pytest.fixture

0 commit comments

Comments
 (0)