Skip to content

Commit 9708a09

Browse files
committed
perf: change log_cli_level from DEBUG to WARNING
DEBUG forced all loggers to emit during tests, bypassing the cached no-op optimization and inflating benchmark numbers. WARNING is the sensible default; pass `-o log_cli_level=DEBUG` when debug logs are needed.
1 parent 65e46e4 commit 9708a09

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ timeout 120 uv run pytest -n 4
127127

128128
Testes normally run under 60s (~40s on average), so take a closer look if they take longer, it can be a regression.
129129

130+
### Debug logging
131+
132+
`log_cli_level` defaults to `WARNING` in `pyproject.toml`. The engine caches a no-op
133+
for `logger.debug` at init time — running tests with `DEBUG` would bypass this
134+
optimization and inflate benchmark numbers. To enable debug logs for a specific run:
135+
136+
```bash
137+
uv run pytest -o log_cli_level=DEBUG tests/test_something.py
138+
```
139+
130140
When analyzing warnings or extensive output, run the tests **once** saving the output to a file
131141
(`> /tmp/pytest-output.txt 2>&1`), then analyze the file — instead of running the suite
132142
repeatedly with different greps.

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ markers = [
8888
]
8989
python_files = ["tests.py", "test_*.py", "*_tests.py"]
9090
xfail_strict = true
91-
log_cli_level = "DEBUG"
91+
# Log level WARNING by default; the engine caches a no-op for logger.debug at
92+
# init time, so DEBUG here would bypass that optimization and slow benchmarks.
93+
# To enable DEBUG logging for a specific test run:
94+
# uv run pytest -o log_cli_level=DEBUG
95+
log_cli_level = "WARNING"
9296
log_cli_format = "%(relativeCreated)6.0fms %(threadName)-18s %(name)-35s %(message)s"
9397
log_cli_date_format = "%H:%M:%S"
9498
asyncio_default_fixture_loop_scope = "module"

0 commit comments

Comments
 (0)