Skip to content

Commit 2ff09e3

Browse files
committed
refactor(tests): convert test_cli.py tests to use NamedTuple fixtures
1 parent 0494424 commit 2ff09e3

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

tests/cli/test_cli.py

+23-5
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,32 @@ def test_creates_config_dir_not_exists(tmp_path: pathlib.Path) -> None:
3131
assert tmp_path.exists()
3232

3333

34+
class HelpTestFixture(t.NamedTuple):
35+
"""Test fixture for help command tests."""
36+
37+
test_id: str
38+
cli_args: list[str]
39+
40+
41+
HELP_TEST_FIXTURES: list[HelpTestFixture] = [
42+
HelpTestFixture(
43+
test_id="help_long_flag",
44+
cli_args=["--help"],
45+
),
46+
HelpTestFixture(
47+
test_id="help_short_flag",
48+
cli_args=["-h"],
49+
),
50+
]
51+
52+
3453
@pytest.mark.parametrize(
35-
"cli_args",
36-
[
37-
(["--help"]),
38-
(["-h"]),
39-
],
54+
list(HelpTestFixture._fields),
55+
HELP_TEST_FIXTURES,
56+
ids=[test.test_id for test in HELP_TEST_FIXTURES],
4057
)
4158
def test_help(
59+
test_id: str,
4260
cli_args: list[str],
4361
tmp_path: pathlib.Path,
4462
monkeypatch: pytest.MonkeyPatch,

0 commit comments

Comments
 (0)