-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
plugin: capturerelated to the capture builtin pluginrelated to the capture builtin plugintopic: tracebacksrelated to displaying and handling of tracebacksrelated to displaying and handling of tracebacks
Description
I'm using pytest version 8.4.2 and it seems when I use --tb=line with --show-capture=stdout I don't get the output but when running with --tb=short I do get the output.
Actual behaviour
# tests/test_demo.py
def test_fail():
print("WILL-SHOW")
assert False
def test_no_print():
assert FalseThen I run pytest -q --tb=line --show-capture=stdout --disable-warnings tests/test_demo.py and I get the following output:
FF [100%]
====================================== FAILURES =======================================
tests/test_demo.py:4: assert False
tests/test_demo.py:7: assert False
=============================== short test summary info ===============================
FAILED tests/test_demo.py::test_fail - assert False
FAILED tests/test_demo.py::test_no_print - assert False
2 failed, 1 warning in 0.02s
But if I run with pytest -q --tb=short --show-capture=stdout --disable-warnings tests/test_demo.py with the short traceback:
$ pytest -q --tb=short --show-capture=stdout --disable-warnings tests/test_demo.py
FF [100%]
====================================== FAILURES =======================================
____________ test_fail ____________
tests/test_demo.py:4: in test_fail
assert False
E assert False
------------------------------ Captured stdout call ---------------------------------
WILL-SHOW
__________ test_no_print __________
tests/test_demo.py:7: in test_no_print
assert False
E assert False
=============================== short test summary info ===============================
FAILED tests/test_demo.py::test_fail - assert False
FAILED tests/test_demo.py::test_no_print - assert False
2 failed, 1 warning in 0.32s
Now I can see the captured stdout call section.
Expected Behaviour
See the captured section no matter the traceback
Metadata
Metadata
Assignees
Labels
plugin: capturerelated to the capture builtin pluginrelated to the capture builtin plugintopic: tracebacksrelated to displaying and handling of tracebacksrelated to displaying and handling of tracebacks