@@ -62,41 +62,55 @@ def write_config_remote(
62
62
)
63
63
64
64
65
- @pytest .mark .parametrize (
66
- "config_tpl,remote_list" ,
67
- [
68
- [
69
- """
65
+ class ConfigVariationTest (t .NamedTuple ):
66
+ test_id : str
67
+ config_tpl : str
68
+ remote_list : list [str ]
69
+
70
+
71
+ CONFIG_VARIATION_FIXTURES = [
72
+ ConfigVariationTest (
73
+ test_id = "default" ,
74
+ config_tpl = """
70
75
{tmp_path}/study/myrepo:
71
76
{CLONE_NAME}: git+file://{dir}
72
77
""" ,
73
- ["origin" ],
74
- ],
75
- [
76
- """
78
+ remote_list = ["origin" ],
79
+ ),
80
+ ConfigVariationTest (
81
+ test_id = "expanded_repo_style" ,
82
+ config_tpl = """
77
83
{tmp_path}/study/myrepo:
78
84
{CLONE_NAME}:
79
85
repo: git+file://{dir}
80
86
""" ,
81
- ["repo" ],
82
- ],
83
- [
84
- """
87
+ remote_list = ["repo" ],
88
+ ),
89
+ ConfigVariationTest (
90
+ test_id = "expanded_repo_style_with_remote" ,
91
+ config_tpl = """
85
92
{tmp_path}/study/myrepo:
86
93
{CLONE_NAME}:
87
94
repo: git+file://{dir}
88
95
remotes:
89
96
secondremote: git+file://{dir}
90
97
""" ,
91
- ["secondremote" ],
92
- ],
93
- ],
98
+ remote_list = ["secondremote" ],
99
+ ),
100
+ ]
101
+
102
+
103
+ @pytest .mark .parametrize (
104
+ list (ConfigVariationTest ._fields ),
105
+ CONFIG_VARIATION_FIXTURES ,
106
+ ids = [test .test_id for test in CONFIG_VARIATION_FIXTURES ],
94
107
)
95
108
def test_config_variations (
96
109
tmp_path : pathlib .Path ,
110
+ capsys : pytest .CaptureFixture [str ],
97
111
create_git_remote_repo : CreateProjectCallbackFixtureProtocol ,
112
+ test_id : str ,
98
113
config_tpl : str ,
99
- capsys : pytest .CaptureFixture [str ],
100
114
remote_list : list [str ],
101
115
) -> None :
102
116
"""Test config output with variation of config formats"""
@@ -131,39 +145,53 @@ def test_config_variations(
131
145
assert current_remote .fetch_url == repo_url
132
146
133
147
134
- @pytest .mark .parametrize (
135
- "config_tpl,has_extra_remotes" ,
136
- [
137
- [
138
- """
148
+ class UpdatingRemoteFixture (t .NamedTuple ):
149
+ test_id : str
150
+ config_tpl : str
151
+ has_extra_remotes : bool
152
+
153
+
154
+ UPDATING_REMOTE_FIXTURES = [
155
+ UpdatingRemoteFixture (
156
+ test_id = "no_remotes" ,
157
+ config_tpl = """
139
158
{tmp_path}/study/myrepo:
140
159
{CLONE_NAME}: git+file://{dir}
141
160
""" ,
142
- False ,
143
- ],
144
- [
145
- """
161
+ has_extra_remotes = False ,
162
+ ),
163
+ UpdatingRemoteFixture (
164
+ test_id = "no_remotes_expanded_repo_style" ,
165
+ config_tpl = """
146
166
{tmp_path}/study/myrepo:
147
167
{CLONE_NAME}:
148
168
repo: git+file://{dir}
149
169
""" ,
150
- False ,
151
- ],
152
- [
153
- """
170
+ has_extra_remotes = False ,
171
+ ),
172
+ UpdatingRemoteFixture (
173
+ test_id = "has_remotes_expanded_repo_style" ,
174
+ config_tpl = """
154
175
{tmp_path}/study/myrepo:
155
176
{CLONE_NAME}:
156
177
repo: git+file://{dir}
157
178
remotes:
158
179
mirror_repo: git+file://{dir}
159
180
""" ,
160
- True ,
161
- ],
162
- ],
181
+ has_extra_remotes = True ,
182
+ ),
183
+ ]
184
+
185
+
186
+ @pytest .mark .parametrize (
187
+ list (UpdatingRemoteFixture ._fields ),
188
+ UPDATING_REMOTE_FIXTURES ,
189
+ ids = [test .test_id for test in UPDATING_REMOTE_FIXTURES ],
163
190
)
164
191
def test_updating_remote (
165
192
tmp_path : pathlib .Path ,
166
193
create_git_remote_repo : CreateProjectCallbackFixtureProtocol ,
194
+ test_id : str ,
167
195
config_tpl : str ,
168
196
has_extra_remotes : bool ,
169
197
) -> None :
0 commit comments