Skip to content
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Joseph Sawaya
Josh Karpel
Joshua Bronson
Julian Valentin
Junhao Liao
Jurko Gospodnetić
Justice Ndou
Justyna Janczyszyn
Expand Down
1 change: 1 addition & 0 deletions changelog/14023.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `--report-chars` long CLI option.
2 changes: 1 addition & 1 deletion doc/en/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2910,7 +2910,7 @@ Output and Reporting

Set verbosity level explicitly. Default: 0.

.. option:: -r CHARS
.. option:: -r CHARS, --report-chars=CHARS

Show extra test summary info as specified by chars:

Expand Down
1 change: 1 addition & 0 deletions src/_pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def pytest_addoption(parser: Parser) -> None:
)
group._addoption( # private to use reserved lower-case short option
"-r",
"--report-chars",
action="store",
dest="reportchars",
default=_REPORTCHARS_DEFAULT,
Expand Down
15 changes: 15 additions & 0 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ def test_append_parse_args(
assert config.option.tbstyle == "short"
assert config.option.verbose

@pytest.mark.parametrize("flag", ("-r", "--report-chars="))
@pytest.mark.parametrize("value", ("fE", "A", "fs"))
def test_report_chars_option(
self,
pytester: Pytester,
tmp_path: Path,
monkeypatch: MonkeyPatch,
flag: str,
value: str,
) -> None:
"""Test that -r/--report-chars is parsed correctly."""
monkeypatch.setenv("PYTEST_ADDOPTS", flag + value)
config = pytester.parseconfig(tmp_path)
assert config.option.reportchars == value

def test_tox_ini_wrong_version(self, pytester: Pytester) -> None:
pytester.makefile(
".ini",
Expand Down