Support reportchars=A (really all, including passed)

This commit is contained in:
Daniel Hahler 2019-04-07 18:03:06 +02:00
parent a7e49e6c07
commit b4b9f788af
2 changed files with 10 additions and 4 deletions

View File

@ -83,7 +83,7 @@ def pytest_addoption(parser):
metavar="chars",
help="show extra test summary info as specified by chars: (f)ailed, "
"(E)rror, (s)kipped, (x)failed, (X)passed, "
"(p)assed, (P)assed with output, (a)ll except passed (p/P). "
"(p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. "
"Warnings are displayed at all times except when "
"--disable-warnings is set.",
)
@ -166,10 +166,13 @@ def getreportopt(config):
reportchars = reportchars.replace("w", "")
if reportchars:
for char in reportchars:
if char not in reportopts and char != "a":
reportopts += char
elif char == "a":
if char == "a":
reportopts = "sxXwEf"
elif char == "A":
reportopts = "sxXwEfpP"
break
elif char not in reportopts:
reportopts += char
return reportopts

View File

@ -838,6 +838,9 @@ def test_getreportopt():
config.option.disable_warnings = False
assert getreportopt(config) == "sfxw"
config.option.reportchars = "A"
assert getreportopt(config) == "sxXwEfpP"
def test_terminalreporter_reportopt_addopts(testdir):
testdir.makeini("[pytest]\naddopts=-rs")