Skip to content

Commit 6c3b2ba

Browse files
committed
make parametrize nicer
1 parent 813afbc commit 6c3b2ba

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

testing/test_config.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,29 +97,20 @@ def test_append_parse_args(
9797
assert config.option.tbstyle == "short"
9898
assert config.option.verbose
9999

100-
@pytest.mark.parametrize(
101-
"opts, expected",
102-
[
103-
("-rfE", "fE"),
104-
("--report-chars=fE", "fE"),
105-
("-rA", "A"),
106-
("--report-chars=A", "A"),
107-
("-rfs", "fs"),
108-
("--report-chars=fs", "fs"),
109-
],
110-
)
100+
@pytest.mark.parametrize("flag", ("-r", "--report-chars="))
101+
@pytest.mark.parametrize("value", ("fE", "A", "fs"))
111102
def test_report_chars_option(
112103
self,
113104
pytester: Pytester,
114105
tmp_path: Path,
115106
monkeypatch: MonkeyPatch,
116-
opts: str,
117-
expected: str,
107+
flag: str,
108+
value: str,
118109
) -> None:
119110
"""Test that -r/--report-chars is parsed correctly."""
120-
monkeypatch.setenv("PYTEST_ADDOPTS", opts)
111+
monkeypatch.setenv("PYTEST_ADDOPTS", flag + value)
121112
config = pytester.parseconfig(tmp_path)
122-
assert config.option.reportchars == expected
113+
assert config.option.reportchars == value
123114

124115
def test_tox_ini_wrong_version(self, pytester: Pytester) -> None:
125116
pytester.makefile(

0 commit comments

Comments
 (0)