From 370daf0441dd70dc082490de80ead536c82566c0 Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Sat, 16 Dec 2017 14:52:30 +0200 Subject: [PATCH] Use classic console output when -s is used Fixes #3038 --- _pytest/terminal.py | 3 ++- changelog/3038.feature | 1 + testing/test_terminal.py | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/3038.feature diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 1aba5e845..b20bf5ea8 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -153,7 +153,8 @@ class TerminalReporter: self.hasmarkup = self._tw.hasmarkup self.isatty = file.isatty() self._progress_items_reported = 0 - self._show_progress_info = self.config.getini('console_output_style') == 'progress' + self._show_progress_info = (self.config.getoption('capture') != 'no' and + self.config.getini('console_output_style') == 'progress') def hasopt(self, char): char = {'xfailed': 'x', 'skipped': 's'}.get(char, char) diff --git a/changelog/3038.feature b/changelog/3038.feature new file mode 100644 index 000000000..107dc6fed --- /dev/null +++ b/changelog/3038.feature @@ -0,0 +1 @@ +Use classic console output when -s is used. diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 97c2f71fb..0db56f6f9 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1037,3 +1037,11 @@ class TestProgress: r'\[gw\d\] \[\s*\d+%\] PASSED test_foo.py::test_foo\[1\]', r'\[gw\d\] \[\s*\d+%\] PASSED test_foobar.py::test_foobar\[1\]', ]) + + def test_capture_no(self, many_tests_file, testdir): + output = testdir.runpytest('-s') + output.stdout.re_match_lines([ + r'test_bar.py \.{10}', + r'test_foo.py \.{5}', + r'test_foobar.py \.{5}', + ])