diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 51d21cb33f2..7e034eb9aed 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -324,6 +324,8 @@ def pytest_runtest_logfinish(self, nodeid): _PROGRESS_LENGTH = len(' [100%]') def _get_progress_information_message(self): + if self.config.getoption('capture') == 'no': + return '' collected = self._session.testscollected if collected: progress = len(self._progress_nodeids_reported) * 100 // collected diff --git a/changelog/3203.bugfix.rst b/changelog/3203.bugfix.rst new file mode 100644 index 00000000000..88f357722e8 --- /dev/null +++ b/changelog/3203.bugfix.rst @@ -0,0 +1 @@ +Removed progress information when capture option is ``no``. diff --git a/testing/test_terminal.py b/testing/test_terminal.py index d7fabd05589..ff4296925b8 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1046,6 +1046,9 @@ def test_capture_no(self, many_tests_files, testdir): r'test_foobar.py \.{5}', ]) + output = testdir.runpytest('--capture=no') + assert "%]" not in output.stdout.str() + class TestProgressWithTeardown(object): """Ensure we show the correct percentages for tests that fail during teardown (#3088)"""