Skip to content

Commit 546d564

Browse files
committed
refactor(tests): convert test_import_tmuxinator.py test to use NamedTuple fixtures
1 parent ac2a322 commit 546d564

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

tests/workspace/test_import_tmuxinator.py

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,44 @@
1111
from tmuxp.workspace import importers, validation
1212

1313

14+
class TmuxinatorConfigTestFixture(t.NamedTuple):
15+
"""Test fixture for tmuxinator config conversion tests."""
16+
17+
test_id: str
18+
tmuxinator_yaml: str
19+
tmuxinator_dict: dict[str, t.Any]
20+
tmuxp_dict: dict[str, t.Any]
21+
22+
23+
TMUXINATOR_CONFIG_TEST_FIXTURES: list[TmuxinatorConfigTestFixture] = [
24+
TmuxinatorConfigTestFixture(
25+
test_id="basic_config",
26+
tmuxinator_yaml=fixtures.test1.tmuxinator_yaml,
27+
tmuxinator_dict=fixtures.test1.tmuxinator_dict,
28+
tmuxp_dict=fixtures.test1.expected,
29+
),
30+
TmuxinatorConfigTestFixture(
31+
test_id="legacy_tabs_config", # older vers use `tabs` instead of `windows`
32+
tmuxinator_yaml=fixtures.test2.tmuxinator_yaml,
33+
tmuxinator_dict=fixtures.test2.tmuxinator_dict,
34+
tmuxp_dict=fixtures.test2.expected,
35+
),
36+
TmuxinatorConfigTestFixture(
37+
test_id="sample_config", # Test importing <spec/fixtures/sample.yml>
38+
tmuxinator_yaml=fixtures.test3.tmuxinator_yaml,
39+
tmuxinator_dict=fixtures.test3.tmuxinator_dict,
40+
tmuxp_dict=fixtures.test3.expected,
41+
),
42+
]
43+
44+
1445
@pytest.mark.parametrize(
15-
("tmuxinator_yaml", "tmuxinator_dict", "tmuxp_dict"),
16-
[
17-
(
18-
fixtures.test1.tmuxinator_yaml,
19-
fixtures.test1.tmuxinator_dict,
20-
fixtures.test1.expected,
21-
),
22-
(
23-
fixtures.test2.tmuxinator_yaml,
24-
fixtures.test2.tmuxinator_dict,
25-
fixtures.test2.expected,
26-
), # older vers use `tabs` instead of `windows`
27-
(
28-
fixtures.test3.tmuxinator_yaml,
29-
fixtures.test3.tmuxinator_dict,
30-
fixtures.test3.expected,
31-
), # Test importing <spec/fixtures/sample.yml>
32-
],
46+
list(TmuxinatorConfigTestFixture._fields),
47+
TMUXINATOR_CONFIG_TEST_FIXTURES,
48+
ids=[test.test_id for test in TMUXINATOR_CONFIG_TEST_FIXTURES],
3349
)
3450
def test_config_to_dict(
51+
test_id: str,
3552
tmuxinator_yaml: str,
3653
tmuxinator_dict: dict[str, t.Any],
3754
tmuxp_dict: dict[str, t.Any],

0 commit comments

Comments
 (0)