@@ -62,41 +62,55 @@ def write_config_remote(
6262 )
6363
6464
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 = """
7075 {tmp_path}/study/myrepo:
7176 {CLONE_NAME}: git+file://{dir}
7277 """ ,
73- ["origin" ],
74- ],
75- [
76- """
78+ remote_list = ["origin" ],
79+ ),
80+ ConfigVariationTest (
81+ test_id = "expanded_repo_style" ,
82+ config_tpl = """
7783 {tmp_path}/study/myrepo:
7884 {CLONE_NAME}:
7985 repo: git+file://{dir}
8086 """ ,
81- ["repo" ],
82- ],
83- [
84- """
87+ remote_list = ["repo" ],
88+ ),
89+ ConfigVariationTest (
90+ test_id = "expanded_repo_style_with_remote" ,
91+ config_tpl = """
8592 {tmp_path}/study/myrepo:
8693 {CLONE_NAME}:
8794 repo: git+file://{dir}
8895 remotes:
8996 secondremote: git+file://{dir}
9097 """ ,
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 ],
94107)
95108def test_config_variations (
96109 tmp_path : pathlib .Path ,
110+ capsys : pytest .CaptureFixture [str ],
97111 create_git_remote_repo : CreateProjectCallbackFixtureProtocol ,
112+ test_id : str ,
98113 config_tpl : str ,
99- capsys : pytest .CaptureFixture [str ],
100114 remote_list : list [str ],
101115) -> None :
102116 """Test config output with variation of config formats"""
@@ -131,39 +145,53 @@ def test_config_variations(
131145 assert current_remote .fetch_url == repo_url
132146
133147
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 = """
139158 {tmp_path}/study/myrepo:
140159 {CLONE_NAME}: git+file://{dir}
141160 """ ,
142- False ,
143- ],
144- [
145- """
161+ has_extra_remotes = False ,
162+ ),
163+ UpdatingRemoteFixture (
164+ test_id = "no_remotes_expanded_repo_style" ,
165+ config_tpl = """
146166 {tmp_path}/study/myrepo:
147167 {CLONE_NAME}:
148168 repo: git+file://{dir}
149169 """ ,
150- False ,
151- ],
152- [
153- """
170+ has_extra_remotes = False ,
171+ ),
172+ UpdatingRemoteFixture (
173+ test_id = "has_remotes_expanded_repo_style" ,
174+ config_tpl = """
154175 {tmp_path}/study/myrepo:
155176 {CLONE_NAME}:
156177 repo: git+file://{dir}
157178 remotes:
158179 mirror_repo: git+file://{dir}
159180 """ ,
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 ],
163190)
164191def test_updating_remote (
165192 tmp_path : pathlib .Path ,
166193 create_git_remote_repo : CreateProjectCallbackFixtureProtocol ,
194+ test_id : str ,
167195 config_tpl : str ,
168196 has_extra_remotes : bool ,
169197) -> None :
0 commit comments