Skip to content

Feature Request: --capture=hide to hide stdout/stderr from the terminal #1478

@matthiasha

Description

@matthiasha

This code mimics Python code with lots of stdout output:

def test_test():
    print 'bla bla bla\n' * 10
    assert False, 'something failed'

Running pytest with --tb=short, I get the following output:

================= test session starts ==================
platform linux2 -- Python 2.7.9 -- py-1.4.31 -- pytest-2.6.4
plugins: 
collected 1 items

test_test.py F

======================= FAILURES =======================
______________________ test_test _______________________
test_test.py:5: in test_test
    assert False, 'something failed'
E   AssertionError: something failed
E   assert False
----------------- Captured stdout call -----------------
bla bla bla
bla bla bla
bla bla bla
bla bla bla
bla bla bla
bla bla bla
bla bla bla
bla bla bla
bla bla bla
bla bla bla

=============== 1 failed in 0.02 seconds ===============

It would be helpful if I could disable the sections "captured stdout/err call", e.g. with --capture=hide, especially as our code prints hundreds of lines usually. The additional information that --tb=short gives over --tb=line however is very useful for understanding where problems come from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: capturerelated to the capture builtin plugintype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions