pytest-dev / pytest-dev/pytest-html

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

Open
#457 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
779
Forks
260
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command with log.py, --html=report.html, --log-level=CRITICAL, --log-file=debug.log, and --log-file-level=INFO; compare debug.log with the Captured stderr call section in report.html. Done means INFO appears in debug.log but not in the HTML report, while logs at CRITICAL or higher remain included.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.