Skip to content

Commit ce47473

Browse files
committed
cond addopts
1 parent b77f50e commit ce47473

File tree

1 file changed

+5
-4
lines changed
  • codeflash-benchmark/codeflash_benchmark

1 file changed

+5
-4
lines changed

codeflash-benchmark/codeflash_benchmark/plugin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
5252
parser.addoption(
5353
"--codeflash-trace", action="store_true", default=False, help="Enable CodeFlash tracing for benchmarks"
5454
)
55-
# These options are ignored when --codeflash-trace is used
56-
for option, action, default, help_text in benchmark_options:
57-
help_suffix = " (ignored when --codeflash-trace is used)"
58-
parser.addoption(option, action=action, default=default, help=help_text + help_suffix)
55+
# Only add benchmark options if pytest-benchmark is not installed for backward compatibility with existing pytest-benchmark setup
56+
if not PYTEST_BENCHMARK_INSTALLED:
57+
for option, action, default, help_text in benchmark_options:
58+
help_suffix = " (ignored when --codeflash-trace is used)"
59+
parser.addoption(option, action=action, default=default, help=help_text + help_suffix)
5960

6061

6162
@pytest.fixture

0 commit comments

Comments
 (0)