From 87a24d3b18643b7cbde75fc69cbdb33c74d41fd5 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Sat, 24 Feb 2024 03:04:33 +0100 Subject: [PATCH 1/2] tests: verify PEP 610 compliance for vcs urls --- tests/installation/test_executor.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index b7c7f6a8ed8..7b142564b48 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -928,6 +928,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"), + ("git@github.com:demo/demo.git", "ssh://git@github.com/demo/demo.git"), + ], +) @pytest.mark.parametrize("is_artifact_cached", [False, True]) def test_executor_should_write_pep610_url_references_for_git( tmp_venv: VirtualEnv, @@ -939,6 +946,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: @@ -950,7 +959,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", @@ -961,6 +970,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") @@ -986,7 +997,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" From 1877c57715dcc655029e1bf004e98d35ae429379 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Sat, 24 Feb 2024 03:07:38 +0100 Subject: [PATCH 2/2] [temporary] bump to development version of core Use version from python-poetry/poetry-core#701 for testing. --- poetry.lock | 16 ++++++++++------ pyproject.toml | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index eb64ca8d021..7fe894ae450 100644 --- a/poetry.lock +++ b/poetry.lock @@ -927,11 +927,15 @@ name = "poetry-core" version = "1.9.0" description = "Poetry PEP 517 Build Backend" optional = false -python-versions = ">=3.8,<4.0" -files = [ - {file = "poetry_core-1.9.0-py3-none-any.whl", hash = "sha256:4e0c9c6ad8cf89956f03b308736d84ea6ddb44089d16f2adc94050108ec1f5a1"}, - {file = "poetry_core-1.9.0.tar.gz", hash = "sha256:fa7a4001eae8aa572ee84f35feb510b321bd652e5cf9293249d62853e1f935a2"}, -] +python-versions = "^3.8" +files = [] +develop = false + +[package.source] +type = "git" +url = "https://github.com/abn/poetry-core.git" +reference = "vcs-normalize-source-url" +resolved_reference = "346e6fc0b7cc2ffd13856597d0f87a2d2136230e" [[package]] name = "poetry-plugin-export" @@ -1591,4 +1595,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "22ab2dd364a5da8611c9a5e7a1ae2c9faa1588d9d717c071ffa421f4338edf40" +content-hash = "a7969d7f24cdc9ab3f1ed0bd756c77b7b8839fd7a587eca861945522c9b9e0e7" diff --git a/pyproject.toml b/pyproject.toml index 9ceac74d1bd..86a8a925cb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ Changelog = "https://python-poetry.org/history/" [tool.poetry.dependencies] python = "^3.8" -poetry-core = "1.9.0" +poetry-core = { git = "https://github.com/abn/poetry-core.git", branch = "vcs-normalize-source-url" } poetry-plugin-export = "^1.6.0" build = "^1.0.3" cachecontrol = { version = "^0.14.0", extras = ["filecache"] }