Make -r letters "s" and "S" aliases
Similar reasons as the previous commit
This commit is contained in:
parent
59067ad33d
commit
fa51a26743
|
@ -172,10 +172,11 @@ def getreportopt(config: Config) -> str:
|
||||||
reportchars += "w"
|
reportchars += "w"
|
||||||
elif config.option.disable_warnings and "w" in reportchars:
|
elif config.option.disable_warnings and "w" in reportchars:
|
||||||
reportchars = reportchars.replace("w", "")
|
reportchars = reportchars.replace("w", "")
|
||||||
|
aliases = {"F", "S"}
|
||||||
for char in reportchars:
|
for char in reportchars:
|
||||||
# f and F are aliases
|
# handle old aliases
|
||||||
if char == "F":
|
if char in aliases:
|
||||||
char = "f"
|
char = char.lower()
|
||||||
if char == "a":
|
if char == "a":
|
||||||
reportopts = "sxXwEf"
|
reportopts = "sxXwEf"
|
||||||
elif char == "A":
|
elif char == "A":
|
||||||
|
@ -989,7 +990,6 @@ class TerminalReporter:
|
||||||
"X": show_xpassed,
|
"X": show_xpassed,
|
||||||
"f": partial(show_simple, "failed"),
|
"f": partial(show_simple, "failed"),
|
||||||
"s": show_skipped,
|
"s": show_skipped,
|
||||||
"S": show_skipped,
|
|
||||||
"p": partial(show_simple, "passed"),
|
"p": partial(show_simple, "passed"),
|
||||||
"E": partial(show_simple, "error"),
|
"E": partial(show_simple, "error"),
|
||||||
} # type: Mapping[str, Callable[[List[str]], None]]
|
} # type: Mapping[str, Callable[[List[str]], None]]
|
||||||
|
|
|
@ -755,6 +755,7 @@ class TestTerminalFunctional:
|
||||||
result.stdout.fnmatch_lines(["collected 3 items", "hello from hook: 3 items"])
|
result.stdout.fnmatch_lines(["collected 3 items", "hello from hook: 3 items"])
|
||||||
|
|
||||||
def test_summary_f_alias(self, testdir):
|
def test_summary_f_alias(self, testdir):
|
||||||
|
"""Test that 'f' and 'F' report chars are aliases and don't show up twice in the summary (#6334)"""
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
def test():
|
def test():
|
||||||
|
@ -766,6 +767,22 @@ class TestTerminalFunctional:
|
||||||
result.stdout.fnmatch_lines([expected])
|
result.stdout.fnmatch_lines([expected])
|
||||||
assert result.stdout.lines.count(expected) == 1
|
assert result.stdout.lines.count(expected) == 1
|
||||||
|
|
||||||
|
def test_summary_s_alias(self, testdir):
|
||||||
|
"""Test that 's' and 'S' report chars are aliases and don't show up twice in the summary"""
|
||||||
|
testdir.makepyfile(
|
||||||
|
"""
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.mark.skip
|
||||||
|
def test():
|
||||||
|
pass
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
result = testdir.runpytest("-rsS")
|
||||||
|
expected = "SKIPPED [1] test_summary_s_alias.py:3: unconditional skip"
|
||||||
|
result.stdout.fnmatch_lines([expected])
|
||||||
|
assert result.stdout.lines.count(expected) == 1
|
||||||
|
|
||||||
|
|
||||||
def test_fail_extra_reporting(testdir, monkeypatch):
|
def test_fail_extra_reporting(testdir, monkeypatch):
|
||||||
monkeypatch.setenv("COLUMNS", "80")
|
monkeypatch.setenv("COLUMNS", "80")
|
||||||
|
|
Loading…
Reference in New Issue