Skip to content

Commit b0c83a0

Browse files
committed
test(git): Use both constructors via parametrize
1 parent f6754e1 commit b0c83a0

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

tests/test_git.py

+24-5
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,36 @@ def test_git_get_url_and_rev_from_pip_url():
165165
assert rev == "eucalyptus"
166166

167167

168-
def test_remotes_preserves_git_ssh(repos_path, git_remote):
168+
@pytest.mark.parametrize(
169+
# Postpone evaluation of options so fixture variables can interpolate
170+
"constructor,lazy_constructor_options",
171+
[
172+
[
173+
GitRepo,
174+
lambda git_remote, repo_dir, **kwargs: {
175+
"url": f"file://{git_remote}",
176+
"repo_dir": str(repo_dir),
177+
},
178+
],
179+
[
180+
create_repo_from_pip_url,
181+
lambda git_remote, repo_dir, **kwargs: {
182+
"pip_url": f"git+file://{git_remote}",
183+
"repo_dir": repo_dir,
184+
},
185+
],
186+
],
187+
)
188+
def test_remotes_preserves_git_ssh(
189+
repos_path, git_remote, constructor, lazy_constructor_options
190+
):
169191
# Regression test for #14
170192
repo_name = "myexamplegit"
171193
repo_dir = repos_path / repo_name
172194
remote_name = "myremote"
173195
remote_url = "git+ssh://git@github.com/tony/AlgoXY.git"
196+
git_repo = constructor(**lazy_constructor_options(**locals()))
174197

175-
git_repo = GitRepo(
176-
url=f"file://{git_remote}",
177-
repo_dir=str(repo_dir),
178-
)
179198
git_repo.obtain()
180199
git_repo.set_remote(name=remote_name, url=remote_url)
181200

0 commit comments

Comments
 (0)