(caplog)
| 83 | |
| 84 | |
| 85 | def 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 | |
| 100 | def test_log_access(caplog): |