pytest-dev / pytest-dev/pytest-html

pytest-html suppresses "Captured log teardown" in terminal output

Open
#446 5 comments 1 reaction 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

"Captured log teardown" section is absent in terminal output if pytest-html plugin is invoked.

pytest-html==3.1.1

Sample code:

import pytest
import logging


@pytest.fixture(autouse=True)
def log_wrapper():
    logging.info('- Setup')
    yield
    logging.info('- Teardown')


def test_setup_teardown():
    assert True

Without pytest-html invoked:

$ pytest -rA --log-level=INFO test_setup_teardown.py
...
======================================== PASSES =========================================
__________________________________ test_setup_teardown __________________________________
---------------------------------- Captured log setup -----------------------------------
INFO     root:test_setup_teardown.py:7 - Setup
--------------------------------- Captured log teardown ---------------------------------
INFO     root:test_setup_teardown.py:9 - Teardown
================================ short test summary info ================================
PASSED test_setup_teardown.py::test_setup_teardown
=================================== 1 passed in 0.01s ===================================

With pytest-html invoked:

$ pytest -rA --log-level=INFO --html report.html test_setup_teardown.py
...
======================================== PASSES =========================================
__________________________________ test_setup_teardown __________________________________
---------------------------------- Captured log setup -----------------------------------
INFO     root:test_setup_teardown.py:7 - Setup
--------- generated html file: file:///Users/alex/pytest-issue/report.html ----------
================================ short test summary info ================================
PASSED test_setup_teardown.py::test_setup_teardown
=================================== 1 passed in 0.01s ===================================

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 difference with the provided test_setup_teardown.py example, running pytest once with and once without --html report.html. Trace pytest-html's reporting and terminal-output integration to identify where teardown log output is lost. Done means the terminal output includes the Captured log teardown section while HTML reporting still works.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.