We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50b8084 commit cc7c1a7Copy full SHA for cc7c1a7
docs/guides/tools/tracer.md
@@ -365,15 +365,15 @@ with maybe_timer("optional_timing"):
365
366
Test code with timers by checking log output:
367
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:
+def test_timer_logging(caplog):
+ with caplog.at_level(logging.DEBUG):
374
with Timer("test_operation"):
375
pass # Instant operation
376
+ assert "test_operation" in caplog.text
+ assert "executed in" in caplog.text
+ assert "ms" in caplog.text
+
377
assert "test_operation" in cm.output[0]
378
assert "executed in" in cm.output[0]
379
assert "ms" in cm.output[0]
0 commit comments