Skip to content

Commit cc7c1a7

Browse files
Update docs/guides/tools/tracer.md
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 50b8084 commit cc7c1a7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/guides/tools/tracer.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,15 @@ with maybe_timer("optional_timing"):
365365

366366
Test code with timers by checking log output:
367367

368-
```python
369-
import logging
370-
from tools.tracer import Timer
371-
372-
def test_timer_logging():
373-
with assertLogs(level=logging.DEBUG) as cm:
368+
def test_timer_logging(caplog):
369+
with caplog.at_level(logging.DEBUG):
374370
with Timer("test_operation"):
375371
pass # Instant operation
376372

373+
assert "test_operation" in caplog.text
374+
assert "executed in" in caplog.text
375+
assert "ms" in caplog.text
376+
377377
assert "test_operation" in cm.output[0]
378378
assert "executed in" in cm.output[0]
379379
assert "ms" in cm.output[0]

0 commit comments

Comments
 (0)