Skip to content

"--show-capture=no" option still capture teardown logs. #3816

@eskignax

Description

@eskignax

Hello, I wanted to use --show-capture=no option to hide the captured log.

Environment:

  • platform linux -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
  • Running with PyCharm
  • plugins: allure-pytest-2.3.2b1

Without the option the console display:

  • Captured log setup
  • Captured log call
  • Captured log teardown

Using the option the current result is:

  • Captured log setup
  • Captured log call
  • Captured log teardown

The expected result is to not show any captured log at all.

  • Captured log setup
  • Captured log call
  • Captured log teardown

Here some code to reproduce it:

import pytest
import logging


@pytest.fixture(scope="function", autouse="True")
def hook_each_test_(request):
    logging.error("BEFORE (SETUP)")
    yield
    logging.error("AFTER (tearddown)")


def test_allure_error():
    logging.error("IN TEST")
    assert True == False

Result without the option:

=================================== FAILURES ===================================
______________________________ test_allure_error _______________________________

    def test_allure_error():
        logging.error("IN TEST")
>       assert True == False
E       assert True == False

test_slash.py:14: AssertionError
------------------------------ Captured log setup ------------------------------
test_slash.py                7 ERROR    BEFORE (SETUP)
------------------------------ Captured log call -------------------------------
test_slash.py               13 ERROR    IN TEST
---------------------------- Captured log teardown -----------------------------
test_slash.py                9 ERROR    AFTER (tearddown)
=========================== 1 failed in 0.02 seconds ===========================

Result with the option:

=================================== FAILURES ===================================
______________________________ test_allure_error _______________________________

    def test_allure_error():
        logging.error("IN TEST")
>       assert True == False
E       assert True == False

test_slash.py:14: AssertionError
---------------------------- Captured log teardown -----------------------------
test_slash.py                9 ERROR    AFTER (tearddown)
=========================== 1 failed in 0.02 seconds ===========================

Process finished with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: loggingrelated to the logging builtin plugintype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions