Skip to content

Pytest with -rP parameter does not show the output of teardown #2780

@GeorgeFischhof

Description

@GeorgeFischhof

Pytest with -rP parameter does not show the output of teardown

Hi there,

I was playing with setup and teardown functions to get familar with them, and I found that pytest -rP does not display the output of teardown_module fuction (I tried the following versions: teardown_module function, fixture scope=module with yield)

program:

def setup_module():
    print('\n-----------setup_module----------------\n')

def teardown_module():
    print('\n-----------teardown_module-------------\n')

def test_one():
    print('\n-----------test one-------------\n')

def test_two():
    print('\n-----------test two-------------\n')

result:

pytest --verbose -rP test_setup_teardown.py
============================= test session starts =============================
platform win32 -- Python 3.6.1, pytest-3.2.2, py-1.4.34, pluggy-0.4.0 -- c:\python36\python.exe
cachedir: .cache
rootdir: c:\George\ inifile:
plugins: xdist-1.16.0, assume-1.2
collected 2 items

test_setup_teardown.py::test_one PASSED
test_setup_teardown.py::test_two PASSED

=================================== PASSES ====================================
__________________________________ test_one ___________________________________
---------------------------- Captured stdout setup ----------------------------

-----------setup_module----------------

---------------------------- Captured stdout call -----------------------------

-----------test one-------------

__________________________________ test_two ___________________________________
---------------------------- Captured stdout call -----------------------------

-----------test two-------------

========================== 2 passed in 0.08 seconds ===========================

Output of setup is collected ;-)

pip list:

apipkg (1.4)
asn1crypto (0.22.0)
cffi (1.10.0)
click (6.7)
colorama (0.3.9)
cryptography (1.8.1)
execnet (1.4.1)
Flask (0.12.2)
gTTS (1.2.0)
gTTS-token (1.1.1)
idna (2.5)
itsdangerous (0.24)
Jinja2 (2.9.6)
lxml (3.7.3)
MarkupSafe (1.0)
packaging (16.8)
pip (9.0.1)
puresnmp (1.1.4.post1)
py (1.4.34)
pycparser (2.17)
pyOpenSSL (17.0.0)
pyparsing (2.2.0)
pytest (3.2.2)
pytest-assume (1.2)
pytest-xdist (1.16.0)
pyvmomi (6.5)
requests (2.14.2)
selenium (2.53.6)
setuptools (36.4.0)
six (1.10.0)
splinter (0.7.5)
typing (3.6.1)
waitress (1.0.2)
Werkzeug (0.12.2)

pytest version: 3.2.2
os: windows 7, 64 bit
python: 3.6.1 64 bit

BR,
George

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: capturerelated to the capture 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