| 148 | |
| 149 | |
| 150 | def 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 | |
| 165 | def test_with_statement_at_level_logging_disabled( |