Skip to content

Remotes: Part 1 (tests) #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(git): Parametrize test_repo_git_obtain_full
  • Loading branch information
tony committed Mar 27, 2022
commit 9f4ceb3fd175e9eb06c09c869d6db966f30c4efc
35 changes: 27 additions & 8 deletions tests/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,33 @@ def test_repo_git_obtain_initial_commit_repo(tmp_path: pathlib.Path):
assert git_repo.get_revision() == "initial"


def test_repo_git_obtain_full(tmp_path: pathlib.Path, git_remote):
git_repo = create_repo_from_pip_url(
**{
"pip_url": f"git+file://{git_remote}",
"repo_dir": tmp_path / "myrepo",
}
)

@pytest.mark.parametrize(
# Postpone evaluation of options so fixture variables can interpolate
"constructor,lazy_constructor_options",
[
[
GitRepo,
lambda git_remote, tmp_path, **kwargs: {
"url": f"file://{git_remote}",
"repo_dir": tmp_path / "myrepo",
},
],
[
create_repo_from_pip_url,
lambda git_remote, tmp_path, **kwargs: {
"pip_url": f"git+file://{git_remote}",
"repo_dir": tmp_path / "myrepo",
},
],
],
)
def test_repo_git_obtain_full(
tmp_path: pathlib.Path,
git_remote,
constructor,
lazy_constructor_options,
):
git_repo: GitRepo = constructor(**lazy_constructor_options(**locals()))
git_repo.obtain()

test_repo_revision = run(["git", "rev-parse", "HEAD"], cwd=git_remote)
Expand Down