Skip to content

Commit 59d66dd

Browse files
committed
refactor(test_sync): Parametrize test_config_variations
1 parent 99f1a67 commit 59d66dd

1 file changed

Lines changed: 30 additions & 16 deletions

File tree

tests/test_sync.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,39 +62,53 @@ def write_config_remote(
6262
)
6363

6464

65-
@pytest.mark.parametrize(
66-
("config_tpl", "remote_list"),
67-
[
68-
[
69-
"""
65+
class ConfigVariationFixture(t.NamedTuple):
66+
test_id: str
67+
config_tpl: str
68+
remote_list: list[str]
69+
70+
71+
CONFIG_VARIATION_FIXTURES = [
72+
ConfigVariationFixture(
73+
test_id="1",
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+
ConfigVariationFixture(
81+
test_id="2",
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+
ConfigVariationFixture(
90+
test_id="3",
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(ConfigVariationFixture._fields),
105+
CONFIG_VARIATION_FIXTURES,
106+
ids=[test.test_id for test in CONFIG_VARIATION_FIXTURES],
94107
)
95108
def test_config_variations(
96109
tmp_path: pathlib.Path,
97110
create_git_remote_repo: CreateProjectCallbackFixtureProtocol,
111+
test_id: str,
98112
config_tpl: str,
99113
capsys: pytest.CaptureFixture[str],
100114
remote_list: list[str],

0 commit comments

Comments
 (0)