15
15
import pathlib
16
16
17
17
18
- @pytest .mark .parametrize ("cli_args" , [(["import" ])])
18
+ class ImportTestFixture (t .NamedTuple ):
19
+ """Test fixture for basic tmuxp import command tests."""
20
+
21
+ test_id : str
22
+ cli_args : list [str ]
23
+
24
+
25
+ IMPORT_TEST_FIXTURES : list [ImportTestFixture ] = [
26
+ ImportTestFixture (
27
+ test_id = "basic_import" ,
28
+ cli_args = ["import" ],
29
+ ),
30
+ ]
31
+
32
+
33
+ @pytest .mark .parametrize (
34
+ list (ImportTestFixture ._fields ),
35
+ IMPORT_TEST_FIXTURES ,
36
+ ids = [test .test_id for test in IMPORT_TEST_FIXTURES ],
37
+ )
19
38
def test_import (
39
+ test_id : str ,
20
40
cli_args : list [str ],
21
41
tmp_path : pathlib .Path ,
22
42
monkeypatch : pytest .MonkeyPatch ,
@@ -29,24 +49,40 @@ def test_import(
29
49
assert "teamocil" in result .out
30
50
31
51
52
+ class ImportTeamocilTestFixture (t .NamedTuple ):
53
+ """Test fixture for tmuxp import teamocil command tests."""
54
+
55
+ test_id : str
56
+ cli_args : list [str ]
57
+ inputs : list [str ]
58
+
59
+
60
+ IMPORT_TEAMOCIL_TEST_FIXTURES : list [ImportTeamocilTestFixture ] = [
61
+ ImportTeamocilTestFixture (
62
+ test_id = "import_teamocil_config_file" ,
63
+ cli_args = ["import" , "teamocil" , "./.teamocil/config.yaml" ],
64
+ inputs = ["\n " , "y\n " , "./la.yaml\n " , "y\n " ],
65
+ ),
66
+ ImportTeamocilTestFixture (
67
+ test_id = "import_teamocil_config_file_exists" ,
68
+ cli_args = ["import" , "teamocil" , "./.teamocil/config.yaml" ],
69
+ inputs = ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
70
+ ),
71
+ ImportTeamocilTestFixture (
72
+ test_id = "import_teamocil_config_name" ,
73
+ cli_args = ["import" , "teamocil" , "config" ],
74
+ inputs = ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
75
+ ),
76
+ ]
77
+
78
+
32
79
@pytest .mark .parametrize (
33
- ("cli_args" , "inputs" ),
34
- [
35
- (
36
- ["import" , "teamocil" , "./.teamocil/config.yaml" ],
37
- ["\n " , "y\n " , "./la.yaml\n " , "y\n " ],
38
- ),
39
- (
40
- ["import" , "teamocil" , "./.teamocil/config.yaml" ],
41
- ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
42
- ),
43
- (
44
- ["import" , "teamocil" , "config" ],
45
- ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
46
- ),
47
- ],
80
+ list (ImportTeamocilTestFixture ._fields ),
81
+ IMPORT_TEAMOCIL_TEST_FIXTURES ,
82
+ ids = [test .test_id for test in IMPORT_TEAMOCIL_TEST_FIXTURES ],
48
83
)
49
84
def test_import_teamocil (
85
+ test_id : str ,
50
86
cli_args : list [str ],
51
87
inputs : list [str ],
52
88
tmp_path : pathlib .Path ,
@@ -76,24 +112,40 @@ def test_import_teamocil(
76
112
assert new_config_yaml .exists ()
77
113
78
114
115
+ class ImportTmuxinatorTestFixture (t .NamedTuple ):
116
+ """Test fixture for tmuxp import tmuxinator command tests."""
117
+
118
+ test_id : str
119
+ cli_args : list [str ]
120
+ inputs : list [str ]
121
+
122
+
123
+ IMPORT_TMUXINATOR_TEST_FIXTURES : list [ImportTmuxinatorTestFixture ] = [
124
+ ImportTmuxinatorTestFixture (
125
+ test_id = "import_tmuxinator_config_file" ,
126
+ cli_args = ["import" , "tmuxinator" , "./.tmuxinator/config.yaml" ],
127
+ inputs = ["\n " , "y\n " , "./la.yaml\n " , "y\n " ],
128
+ ),
129
+ ImportTmuxinatorTestFixture (
130
+ test_id = "import_tmuxinator_config_file_exists" ,
131
+ cli_args = ["import" , "tmuxinator" , "./.tmuxinator/config.yaml" ],
132
+ inputs = ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
133
+ ),
134
+ ImportTmuxinatorTestFixture (
135
+ test_id = "import_tmuxinator_config_name" ,
136
+ cli_args = ["import" , "tmuxinator" , "config" ],
137
+ inputs = ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
138
+ ),
139
+ ]
140
+
141
+
79
142
@pytest .mark .parametrize (
80
- ("cli_args" , "inputs" ),
81
- [
82
- (
83
- ["import" , "tmuxinator" , "./.tmuxinator/config.yaml" ],
84
- ["\n " , "y\n " , "./la.yaml\n " , "y\n " ],
85
- ),
86
- (
87
- ["import" , "tmuxinator" , "./.tmuxinator/config.yaml" ],
88
- ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
89
- ),
90
- (
91
- ["import" , "tmuxinator" , "config" ],
92
- ["\n " , "y\n " , "./exists.yaml\n " , "./la.yaml\n " , "y\n " ],
93
- ),
94
- ],
143
+ list (ImportTmuxinatorTestFixture ._fields ),
144
+ IMPORT_TMUXINATOR_TEST_FIXTURES ,
145
+ ids = [test .test_id for test in IMPORT_TMUXINATOR_TEST_FIXTURES ],
95
146
)
96
147
def test_import_tmuxinator (
148
+ test_id : str ,
97
149
cli_args : list [str ],
98
150
inputs : list [str ],
99
151
tmp_path : pathlib .Path ,
0 commit comments