Commit 4da3bcb3 by Randy Döring Committed by GitHub

Do not write PEP610 URL reference for cached packages installed from a private source (#5362)

parent e1b8dd9c
......@@ -725,11 +725,11 @@ class Executor:
package = operation.package
if not package.source_url:
if not package.source_url or package.source_type == "legacy":
# Since we are installing from our own distribution cache
# pip will write a `direct_url.json` file pointing to the cache
# distribution.
# That's not what we want so we remove the direct_url.json file,
# That's not what we want, so we remove the direct_url.json file,
# if it exists.
for (
direct_url_json
......
......@@ -411,6 +411,42 @@ def verify_installed_distribution(
assert not direct_url_file.exists()
@pytest.mark.parametrize(
"package",
[
Package("demo", "0.1.0"), # PyPI
Package( # private source
"demo",
"0.1.0",
source_type="legacy",
source_url="http://localhost:3141/root/pypi/+simple",
source_reference="private",
),
],
)
def test_executor_should_not_write_pep610_url_references_for_cached_package(
package: Package,
mocker: MockerFixture,
fixture_dir: FixtureDirGetter,
tmp_venv: VirtualEnv,
pool: Pool,
config: Config,
io: BufferedIO,
):
link_cached = Link(
fixture_dir("distributions")
.joinpath("demo-0.1.0-py2.py3-none-any.whl")
.as_uri()
)
mocker.patch(
"poetry.installation.executor.Executor._download", return_value=link_cached
)
executor = Executor(tmp_venv, pool, config, io)
executor.execute([Install(package)])
verify_installed_distribution(tmp_venv, package)
def test_executor_should_write_pep610_url_references_for_files(
tmp_venv: VirtualEnv, pool: Pool, config: Config, io: BufferedIO
):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment