Skip to content

Commit 6bca8f9

Browse files
authored
tests: verify PEP 610 compliance for vcs urls (#9007)
1 parent 09d2e50 commit 6bca8f9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/installation/test_executor.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,13 @@ def mock_get_cached_archive_func(
939939
download_spy.assert_not_called()
940940

941941

942+
@pytest.mark.parametrize(
943+
"source_url,written_source_url",
944+
[
945+
("https://github.com/demo/demo.git", "https://github.com/demo/demo.git"),
946+
("[email protected]:demo/demo.git", "ssh://[email protected]/demo/demo.git"),
947+
],
948+
)
942949
@pytest.mark.parametrize("is_artifact_cached", [False, True])
943950
def test_executor_should_write_pep610_url_references_for_git(
944951
tmp_venv: VirtualEnv,
@@ -949,6 +956,8 @@ def test_executor_should_write_pep610_url_references_for_git(
949956
wheel: Path,
950957
mocker: MockerFixture,
951958
fixture_dir: FixtureDirGetter,
959+
source_url: str,
960+
written_source_url: str,
952961
is_artifact_cached: bool,
953962
) -> None:
954963
if is_artifact_cached:
@@ -960,7 +969,7 @@ def test_executor_should_write_pep610_url_references_for_git(
960969
clone_spy = mocker.spy(Git, "clone")
961970

962971
source_resolved_reference = "123456"
963-
source_url = "https://github.com/demo/demo.git"
972+
source_url = source_url
964973

965974
package = Package(
966975
"demo",
@@ -971,6 +980,8 @@ def test_executor_should_write_pep610_url_references_for_git(
971980
source_url=source_url,
972981
)
973982

983+
assert package.source_url == written_source_url
984+
974985
chef = Chef(artifact_cache, tmp_venv, Factory.create_pool(config))
975986
chef.set_directory_wheel(wheel)
976987
prepare_spy = mocker.spy(chef, "prepare")
@@ -996,7 +1007,9 @@ def test_executor_should_write_pep610_url_references_for_git(
9961007
prepare_spy.assert_not_called()
9971008
else:
9981009
clone_spy.assert_called_once_with(
999-
url=source_url, source_root=mocker.ANY, revision=source_resolved_reference
1010+
url=package.source_url,
1011+
source_root=mocker.ANY,
1012+
revision=source_resolved_reference,
10001013
)
10011014
prepare_spy.assert_called_once()
10021015
assert prepare_spy.spy_return.exists(), "cached file should not be deleted"

0 commit comments

Comments
 (0)