pytest-html
pytest-html copied to clipboard
Logs that are redirected to files are equally included in the HTML report
log.py
import logging
def test_log():
logging.info("Hello world")
Execute:
pytest log.py --html=report.html --log-level=CRITICAL --log-file=debug.log --log-file-level=INFO
Actual result :
- File
debug.logsuccessfully created with the intended log content (OK) - File
report.htmlincludes INFO logs in theCaptured stderr callsection (NOK)
------------------------------Captured stderr call------------------------------
INFO:root:Hello world
Expected result :
File report.html doesn't include INFO logs (only CRITICAL or higher levels)
Same result if I add the following pytest.ini file
[pytest]
log_cli=false
log_cli_level = CRITICAL
Environment: Python 3.8.5 pytest-6.2.2 pytest-html-3.1.1
We didn't have this behavior with pytest-5.4.3 and pytest-html-2.1.1