MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_with_statement

Function test_with_statement

testing/logging/test_fixture.py:85–97  ·  view source on GitHub ↗
(caplog)

Source from the content-addressed store, hash-verified

83
84
85def test_with_statement(caplog):
86 with caplog.at_level(logging.INFO):
87 logger.debug("handler DEBUG level")
88 logger.info("handler INFO level")
89
90 with caplog.at_level(logging.CRITICAL, logger=sublogger.name):
91 sublogger.warning("logger WARNING level")
92 sublogger.critical("logger CRITICAL level")
93
94 assert "DEBUG" not in caplog.text
95 assert "INFO" in caplog.text
96 assert "WARNING" not in caplog.text
97 assert "CRITICAL" in caplog.text
98
99
100def test_log_access(caplog):

Callers

nothing calls this directly

Calls 1

at_levelMethod · 0.80

Tested by

no test coverage detected