Skip to content

Commit d1a0d1c

Browse files
committed
refactor(test_updating_remote): Use NamedTuple parameterize style
1 parent b350e44 commit d1a0d1c

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
@@ -145,39 +145,53 @@ def test_config_variations(
145145
assert current_remote.fetch_url == repo_url
146146

147147

148-
@pytest.mark.parametrize(
149-
"config_tpl,has_extra_remotes",
150-
[
151-
[
152-
"""
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="one",
157+
config_tpl="""
153158
{tmp_path}/study/myrepo:
154159
{CLONE_NAME}: git+file://{dir}
155160
""",
156-
False,
157-
],
158-
[
159-
"""
161+
has_extra_remotes=False,
162+
),
163+
UpdatingRemoteFixture(
164+
test_id="second",
165+
config_tpl="""
160166
{tmp_path}/study/myrepo:
161167
{CLONE_NAME}:
162168
repo: git+file://{dir}
163169
""",
164-
False,
165-
],
166-
[
167-
"""
170+
has_extra_remotes=False,
171+
),
172+
UpdatingRemoteFixture(
173+
test_id="three",
174+
config_tpl="""
168175
{tmp_path}/study/myrepo:
169176
{CLONE_NAME}:
170177
repo: git+file://{dir}
171178
remotes:
172179
mirror_repo: git+file://{dir}
173180
""",
174-
True,
175-
],
176-
],
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],
177190
)
178191
def test_updating_remote(
179192
tmp_path: pathlib.Path,
180193
create_git_remote_repo: CreateProjectCallbackFixtureProtocol,
194+
test_id: str,
181195
config_tpl: str,
182196
has_extra_remotes: bool,
183197
) -> None:

0 commit comments

Comments
 (0)