Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 24 additions & 0 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@ def test_append_parse_args(
assert config.option.tbstyle == "short"
assert config.option.verbose

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

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