Skip to content

Commit 61017a9

Browse files
committed
refactor(test_updating_remote): Use NamedTuple parameterize style
1 parent e47d3b3 commit 61017a9

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

tests/test_sync.py

+30-16
Original file line numberDiff line numberDiff line change
@@ -156,39 +156,53 @@ def test_config_variations(
156156
assert current_remote.fetch_url == repo_url
157157

158158

159-
@pytest.mark.parametrize(
160-
"config_tpl,has_extra_remotes",
161-
[
162-
[
163-
"""
159+
class UpdatingRemoteFixture(t.NamedTuple):
160+
test_id: str
161+
config_tpl: str
162+
has_extra_remotes: bool
163+
164+
165+
UPDATING_REMOTE_FIXTURES = [
166+
UpdatingRemoteFixture(
167+
test_id="one",
168+
config_tpl="""
164169
{tmp_path}/study/myrepo:
165170
{CLONE_NAME}: git+file://{dir}
166171
""",
167-
False,
168-
],
169-
[
170-
"""
172+
has_extra_remotes=False,
173+
),
174+
UpdatingRemoteFixture(
175+
test_id="second",
176+
config_tpl="""
171177
{tmp_path}/study/myrepo:
172178
{CLONE_NAME}:
173179
repo: git+file://{dir}
174180
""",
175-
False,
176-
],
177-
[
178-
"""
181+
has_extra_remotes=False,
182+
),
183+
UpdatingRemoteFixture(
184+
test_id="three",
185+
config_tpl="""
179186
{tmp_path}/study/myrepo:
180187
{CLONE_NAME}:
181188
repo: git+file://{dir}
182189
remotes:
183190
mirror_repo: git+file://{dir}
184191
""",
185-
True,
186-
],
187-
],
192+
has_extra_remotes=True,
193+
),
194+
]
195+
196+
197+
@pytest.mark.parametrize(
198+
list(UpdatingRemoteFixture._fields),
199+
UPDATING_REMOTE_FIXTURES,
200+
ids=[test.test_id for test in UPDATING_REMOTE_FIXTURES],
188201
)
189202
def test_updating_remote(
190203
tmp_path: pathlib.Path,
191204
create_git_remote_repo: CreateProjectCallbackFixtureProtocol,
205+
test_id: str,
192206
config_tpl: str,
193207
has_extra_remotes: bool,
194208
) -> None:

0 commit comments

Comments
 (0)