Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ Yusuke Kadowaki
Yutian Li
Yuval Shimon
Zac Hatfield-Dodds
Zac Palmer Laporte
Zach Snicker
Zachary Kneupper
Zachary OBrien
Expand Down
1 change: 1 addition & 0 deletions changelog/13865.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed `--show-capture` with `--tb=line`.
1 change: 1 addition & 0 deletions src/_pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@ def summary_failures_combined(
if style == "line":
for rep in reports:
line = self._getcrashline(rep)
self._outrep_summary(rep)
self.write_line(line)
else:
for rep in reports:
Expand Down
13 changes: 13 additions & 0 deletions testing/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,19 @@ def test_func():
assert "--calling--" not in s
assert "IndexError" not in s

def test_tb_line_show_capture(self, pytester: Pytester, option) -> None:
output_to_capture = "help! let me out!"
pytester.makepyfile(
f"""
import pytest
def test_fail():
print('{output_to_capture}')
assert False
"""
)
result = pytester.runpytest("--tb=line")
result.stdout.fnmatch_lines(["*- Captured stdout call -*", output_to_capture])

def test_tb_crashline(self, pytester: Pytester, option) -> None:
p = pytester.makepyfile(
"""
Expand Down