terminal: handle "capture" option not being available

This is the case with `-p no:capture` now.
This commit is contained in:
Daniel Hahler 2019-03-20 02:27:47 +01:00
parent 415899d428
commit c7c120fba6
2 changed files with 3 additions and 3 deletions

View File

@ -246,7 +246,7 @@ class TerminalReporter(object):
def _determine_show_progress_info(self):
"""Return True if we should display progress information based on the current config"""
# do not show progress if we are not capturing output (#3038)
if self.config.getoption("capture") == "no":
if self.config.getoption("capture", "no") == "no":
return False
# do not show progress if we are showing fixture setup/teardown
if self.config.getoption("setupshow"):
@ -456,7 +456,7 @@ class TerminalReporter(object):
self._tw.write(msg + "\n", cyan=True)
def _get_progress_information_message(self):
if self.config.getoption("capture") == "no":
if self.config.getoption("capture", "no") == "no":
return ""
collected = self._session.testscollected
if self.config.getini("console_output_style") == "count":

View File

@ -1182,7 +1182,7 @@ def test_help_and_version_after_argument_error(testdir):
def test_config_does_not_load_blocked_plugin_from_args(testdir):
"""This tests that pytest's config setup handles "-p no:X"."""
p = testdir.makepyfile("def test(capfd): pass")
result = testdir.runpytest(str(p), "-pno:capture", "--tb=native")
result = testdir.runpytest(str(p), "-pno:capture")
result.stdout.fnmatch_lines(["E fixture 'capfd' not found"])
assert result.ret == EXIT_TESTSFAILED