From 17610a3f09791c3b6dcda56e998ae48262092a87 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 18:57:08 +0000 Subject: [PATCH 01/11] Update test_terminal.py Assert output includes `- Captured stdout call -` --- testing/test_terminal.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index cfc668fa6ad..14a8d406f39 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1586,6 +1586,22 @@ def test_func(): assert "FAILURES" not in s 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!" + p = pytester.makepyfile( + f""" + import pytest + def test_fail(): + print('{output_to_capture}') + assert False + """ + ) + result = pytester.runpytest("--tb=line") + bn = p.name + result.stdout.fnmatch_lines(["*- Captured stdout call -*"]) + s = result.stdout.str() + assert output_to_capture in s def test_tb_crashline(self, pytester: Pytester, option) -> None: p = pytester.makepyfile( From a779953ddbef45d78f73372d7e0488aaa0023588 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 18:59:48 +0000 Subject: [PATCH 02/11] Update terminal.py add outrep summary to report when the formatting style is set to `line` --- src/_pytest/terminal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index e65279dcfab..158558b4571 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -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: From 16f51474a7a6a47f92a385dd52d6efd0a60f762a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:22:17 +0000 Subject: [PATCH 03/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- testing/test_terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 14a8d406f39..0bc07414a0f 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1586,7 +1586,7 @@ def test_func(): assert "FAILURES" not in s 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!" p = pytester.makepyfile( From 43eae288306fba548f94394b9c0b17a1699273e1 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:25:35 +0000 Subject: [PATCH 04/11] Update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 5849228200b..83509281035 100644 --- a/AUTHORS +++ b/AUTHORS @@ -501,6 +501,7 @@ Yusuke Kadowaki Yutian Li Yuval Shimon Zac Hatfield-Dodds +Zac Palmer Laporte Zach Snicker Zachary Kneupper Zachary OBrien From 7c94d06a9be40a6d7755f122a6476ae7a552f6ce Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:28:03 +0000 Subject: [PATCH 05/11] Create 13865.bugfix.rst --- changelog/13865.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/13865.bugfix.rst diff --git a/changelog/13865.bugfix.rst b/changelog/13865.bugfix.rst new file mode 100644 index 00000000000..69e5b7a5397 --- /dev/null +++ b/changelog/13865.bugfix.rst @@ -0,0 +1 @@ +Add calls to `stdout` test report when the `--tb` option is set to `line`. From 457cda063e18a6ec6fa6edfa73aeb9bfe86b284b Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:32:06 +0000 Subject: [PATCH 06/11] Update test_terminal.py ci test --- testing/test_terminal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 0bc07414a0f..74f83a30120 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1598,7 +1598,6 @@ def test_fail(): """ ) result = pytester.runpytest("--tb=line") - bn = p.name result.stdout.fnmatch_lines(["*- Captured stdout call -*"]) s = result.stdout.str() assert output_to_capture in s From 48200a2c88d5cc04012862d126a582ce567dd532 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:33:50 +0000 Subject: [PATCH 07/11] Update test_terminal.py ci --- testing/test_terminal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 74f83a30120..81d33c273ba 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -65,7 +65,7 @@ def option(request): return request.param -@pytest.mark.parametrize( +@pytest.mark.parametrize(" "input,expected", [ ([DistInfo(project_name="test", version=1)], ["test-1"]), @@ -1589,7 +1589,7 @@ def test_func(): def test_tb_line_show_capture(self, pytester: Pytester, option) -> None: output_to_capture = "help! let me out!" - p = pytester.makepyfile( + pytester.makepyfile( f""" import pytest def test_fail(): From e56081f7eb1c8c8298962e2abdce63af7fa21485 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:37:44 +0000 Subject: [PATCH 08/11] typo --- testing/test_terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 81d33c273ba..f8f73aa9ce2 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -65,7 +65,7 @@ def option(request): return request.param -@pytest.mark.parametrize(" +@pytest.mark.parametrize( "input,expected", [ ([DistInfo(project_name="test", version=1)], ["test-1"]), From d24a30c03580ec899cb6032d015e2b3ff22e2796 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:59:28 +0000 Subject: [PATCH 09/11] Update changelog/13865.bugfix.rst Co-authored-by: Bruno Oliveira --- changelog/13865.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/13865.bugfix.rst b/changelog/13865.bugfix.rst index 69e5b7a5397..f7cd94c2a30 100644 --- a/changelog/13865.bugfix.rst +++ b/changelog/13865.bugfix.rst @@ -1 +1 @@ -Add calls to `stdout` test report when the `--tb` option is set to `line`. +Fixed `--show-capture` with `--tb=line`. From 159c4883b9a36916bf1b1c05e2ac11761a6e4a30 Mon Sep 17 00:00:00 2001 From: zapl <44435064+zaplapl@users.noreply.github.com> Date: Mon, 3 Nov 2025 22:17:43 +0000 Subject: [PATCH 10/11] Update testing/test_terminal.py Co-authored-by: Bruno Oliveira --- testing/test_terminal.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index f8f73aa9ce2..52470235c93 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1598,9 +1598,10 @@ def test_fail(): """ ) result = pytester.runpytest("--tb=line") - result.stdout.fnmatch_lines(["*- Captured stdout call -*"]) - s = result.stdout.str() - assert output_to_capture in s + result.stdout.fnmatch_lines([ + "*- Captured stdout call -*", + output_to_capture + ]) def test_tb_crashline(self, pytester: Pytester, option) -> None: p = pytester.makepyfile( From aa1df8ac8353d4b79cbd7646fe5749afaf763cb9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 22:18:02 +0000 Subject: [PATCH 11/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- testing/test_terminal.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 52470235c93..ee540b65135 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1598,10 +1598,7 @@ def test_fail(): """ ) result = pytester.runpytest("--tb=line") - result.stdout.fnmatch_lines([ - "*- Captured stdout call -*", - output_to_capture - ]) + result.stdout.fnmatch_lines(["*- Captured stdout call -*", output_to_capture]) def test_tb_crashline(self, pytester: Pytester, option) -> None: p = pytester.makepyfile(