MCPcopy
hub / github.com/pytest-dev/pytest / test_with_statement_at_level

Function test_with_statement_at_level

testing/logging/test_fixture.py:150–162  ·  view source on GitHub ↗
(caplog: pytest.LogCaptureFixture)

Source from the content-addressed store, hash-verified

148
149
150def test_with_statement_at_level(caplog: pytest.LogCaptureFixture) -> None:
151 with caplog.at_level(logging.INFO):
152 logger.debug("handler DEBUG level")
153 logger.info("handler INFO level")
154
155 with caplog.at_level(logging.CRITICAL, logger=sublogger.name):
156 sublogger.warning("logger WARNING level")
157 sublogger.critical("logger CRITICAL level")
158
159 assert "DEBUG" not in caplog.text
160 assert "INFO" in caplog.text
161 assert "WARNING" not in caplog.text
162 assert "CRITICAL" in caplog.text
163
164
165def test_with_statement_at_level_logging_disabled(

Callers

nothing calls this directly

Calls 1

at_levelMethod · 0.80

Tested by

no test coverage detected