pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

Logs that are redirected to files are equally included in the HTML report

Open harmin-parra opened this issue 4 years ago • 1 comments

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.log successfully created with the intended log content (OK)
  • File report.html includes INFO logs in the Captured stderr call section (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

harmin-parra avatar May 20 '21 14:05 harmin-parra

We didn't have this behavior with pytest-5.4.3 and pytest-html-2.1.1

harmin-parra avatar May 21 '21 06:05 harmin-parra