MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_distinct_keys_each_log

Function test_distinct_keys_each_log

tests/unit/_utils/test_log.py:29–35  ·  view source on GitHub ↗
(caplog: pytest.LogCaptureFixture)

Source from the content-addressed store, hash-verified

27
28
29def test_distinct_keys_each_log(caplog: pytest.LogCaptureFixture) -> None:
30 logger = logging.getLogger('crawlee.tests.log_dedup_distinct')
31 logger_once = LoggerOnce(logger)
32 with caplog.at_level(logging.INFO, logger=logger.name):
33 logger_once.log('msg-a', key='k1')
34 logger_once.log('msg-b', key='k2')
35 assert [r.getMessage() for r in caplog.records] == ['msg-a', 'msg-b']
36
37
38def test_separate_instances_have_independent_state(caplog: pytest.LogCaptureFixture) -> None:

Callers

nothing calls this directly

Calls 2

logMethod · 0.95
LoggerOnceClass · 0.90

Tested by

no test coverage detected