Skip to content

Commit c7c120f

Browse files
committed
terminal: handle "capture" option not being available
This is the case with `-p no:capture` now.
1 parent 415899d commit c7c120f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/_pytest/terminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def __init__(self, config, file=None):
246246
def _determine_show_progress_info(self):
247247
"""Return True if we should display progress information based on the current config"""
248248
# do not show progress if we are not capturing output (#3038)
249-
if self.config.getoption("capture") == "no":
249+
if self.config.getoption("capture", "no") == "no":
250250
return False
251251
# do not show progress if we are showing fixture setup/teardown
252252
if self.config.getoption("setupshow"):
@@ -456,7 +456,7 @@ def pytest_runtest_logfinish(self, nodeid):
456456
self._tw.write(msg + "\n", cyan=True)
457457

458458
def _get_progress_information_message(self):
459-
if self.config.getoption("capture") == "no":
459+
if self.config.getoption("capture", "no") == "no":
460460
return ""
461461
collected = self._session.testscollected
462462
if self.config.getini("console_output_style") == "count":

testing/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ def pytest_addoption(parser):
11821182
def test_config_does_not_load_blocked_plugin_from_args(testdir):
11831183
"""This tests that pytest's config setup handles "-p no:X"."""
11841184
p = testdir.makepyfile("def test(capfd): pass")
1185-
result = testdir.runpytest(str(p), "-pno:capture", "--tb=native")
1185+
result = testdir.runpytest(str(p), "-pno:capture")
11861186
result.stdout.fnmatch_lines(["E fixture 'capfd' not found"])
11871187
assert result.ret == EXIT_TESTSFAILED
11881188

0 commit comments

Comments
 (0)