-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: verify PEP 610 compliance for vcs urls (#9007)
- Loading branch information
Showing
1 changed file
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -939,6 +939,13 @@ def mock_get_cached_archive_func( | |
download_spy.assert_not_called() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"source_url,written_source_url", | ||
[ | ||
("https://github.com/demo/demo.git", "https://github.com/demo/demo.git"), | ||
("[email protected]:demo/demo.git", "ssh://[email protected]/demo/demo.git"), | ||
], | ||
) | ||
@pytest.mark.parametrize("is_artifact_cached", [False, True]) | ||
def test_executor_should_write_pep610_url_references_for_git( | ||
tmp_venv: VirtualEnv, | ||
|
@@ -949,6 +956,8 @@ def test_executor_should_write_pep610_url_references_for_git( | |
wheel: Path, | ||
mocker: MockerFixture, | ||
fixture_dir: FixtureDirGetter, | ||
source_url: str, | ||
written_source_url: str, | ||
is_artifact_cached: bool, | ||
) -> None: | ||
if is_artifact_cached: | ||
|
@@ -960,7 +969,7 @@ def test_executor_should_write_pep610_url_references_for_git( | |
clone_spy = mocker.spy(Git, "clone") | ||
|
||
source_resolved_reference = "123456" | ||
source_url = "https://github.com/demo/demo.git" | ||
source_url = source_url | ||
|
||
package = Package( | ||
"demo", | ||
|
@@ -971,6 +980,8 @@ def test_executor_should_write_pep610_url_references_for_git( | |
source_url=source_url, | ||
) | ||
|
||
assert package.source_url == written_source_url | ||
|
||
chef = Chef(artifact_cache, tmp_venv, Factory.create_pool(config)) | ||
chef.set_directory_wheel(wheel) | ||
prepare_spy = mocker.spy(chef, "prepare") | ||
|
@@ -996,7 +1007,9 @@ def test_executor_should_write_pep610_url_references_for_git( | |
prepare_spy.assert_not_called() | ||
else: | ||
clone_spy.assert_called_once_with( | ||
url=source_url, source_root=mocker.ANY, revision=source_resolved_reference | ||
url=package.source_url, | ||
source_root=mocker.ANY, | ||
revision=source_resolved_reference, | ||
) | ||
prepare_spy.assert_called_once() | ||
assert prepare_spy.spy_return.exists(), "cached file should not be deleted" | ||
|