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.
FWIW, I think this sounds really useful. I often did some change which caused a lot of tests (which also print hundreds of lines each) to fail, and hiding the captured output would've given me a nicer overview of what could be going wrong.
I agree it might be useful.
Currently though capture actually configures which capture method to use: no capture, file descriptor or sys. We probably should separate "capture method" from "how to display captured output" options, so I suggest we use another option for that. Also, I imagine we could also have the option of redirecting captured output to a file in addition to showing/hiding it.
It might be super useful for me, we test an application with lots of logging and it gets super tiring to find the test traceback under the captured stdout/stderr outputs.
In my ideal, there'd be an equivalent to --tb=no for captured output; something like --stdout=no
Please, review:
https://github.com/pytest-dev/pytest/pull/3176
Most helpful comment
It might be super useful for me, we test an application with lots of logging and it gets super tiring to find the test traceback under the captured
stdout/stderroutputs.