Skip to content

Commit a89e75a

Browse files
committed
tests(config variations): Improve assertions of URLs beginning with git+file://
1 parent 574934b commit a89e75a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tests/test_sync.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ConfigVariationTest(t.NamedTuple):
115115
{CLONE_NAME}:
116116
repo: git+file://{dir}
117117
remotes:
118-
git_scheme_repo: git+git@github.com:tony/vcspull.git
118+
git_scheme_repo: [email protected]:tony/vcspull.git
119119
""",
120120
remote_list=["git_scheme_repo"],
121121
),
@@ -153,7 +153,6 @@ def test_config_variations(
153153
assert len(repos) == 1
154154

155155
for repo_dict in repos:
156-
repo_url = repo_dict["url"].replace("git+", "")
157156
repo: GitSync = update_repo(repo_dict)
158157
remotes = repo.remotes() or {}
159158
remote_names = set(remotes.keys())
@@ -171,9 +170,19 @@ def test_config_variations(
171170
and isinstance(repo_dict["remotes"], dict)
172171
and remote_name in repo_dict["remotes"]
173172
):
174-
assert current_remote.fetch_url == repo_dict["remotes"][
175-
remote_name
176-
].fetch_url.replace("git+", "")
173+
if repo_dict["remotes"][remote_name].fetch_url.startswith(
174+
"git+file://"
175+
):
176+
assert current_remote.fetch_url == repo_dict["remotes"][
177+
remote_name
178+
].fetch_url.replace(
179+
"git+", ""
180+
), "Final git remote should chop git+ prefix"
181+
else:
182+
assert (
183+
current_remote.fetch_url
184+
== repo_dict["remotes"][remote_name].fetch_url
185+
)
177186

178187

179188
class UpdatingRemoteFixture(t.NamedTuple):

0 commit comments

Comments
 (0)