mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Report requested_extras for direct URLs
This commit is contained in:
parent
55f1251fa2
commit
2f271838e7
3 changed files with 49 additions and 0 deletions
2
news/11946.bugfix.rst
Normal file
2
news/11946.bugfix.rst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Correctly report ``requested_extras`` in the installation report when extras are
|
||||
specified for a local directory installation.
|
|
@ -71,6 +71,7 @@ def make_install_req_from_link(
|
|||
)
|
||||
ireq.original_link = template.original_link
|
||||
ireq.link = link
|
||||
ireq.extras = template.extras
|
||||
return ireq
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import textwrap
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
|
@ -178,6 +179,51 @@ def test_install_report_vcs_editable(
|
|||
assert pip_test_package_report["download_info"]["dir_info"]["editable"] is True
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_install_report_local_path_with_extras(
|
||||
script: PipTestEnvironment, tmp_path: Path, shared_data: TestData
|
||||
) -> None:
|
||||
"""Test report remote editable."""
|
||||
project_path = tmp_path / "pkga"
|
||||
project_path.mkdir()
|
||||
project_path.joinpath("pyproject.toml").write_text(
|
||||
textwrap.dedent(
|
||||
"""\
|
||||
[project]
|
||||
name = "pkga"
|
||||
version = "1.0"
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["simple"]
|
||||
"""
|
||||
)
|
||||
)
|
||||
report_path = tmp_path / "report.json"
|
||||
script.pip(
|
||||
"install",
|
||||
"--dry-run",
|
||||
"--no-build-isolation",
|
||||
"--no-index",
|
||||
"--find-links",
|
||||
str(shared_data.root / "packages/"),
|
||||
"--report",
|
||||
str(report_path),
|
||||
str(project_path) + "[test]",
|
||||
)
|
||||
report = json.loads(report_path.read_text())
|
||||
assert len(report["install"]) == 2
|
||||
pkga_report = report["install"][0]
|
||||
assert pkga_report["metadata"]["name"] == "pkga"
|
||||
assert pkga_report["is_direct"] is True
|
||||
assert pkga_report["requested"] is True
|
||||
assert pkga_report["requested_extras"] == ["test"]
|
||||
simple_report = report["install"][1]
|
||||
assert simple_report["metadata"]["name"] == "simple"
|
||||
assert simple_report["is_direct"] is False
|
||||
assert simple_report["requested"] is False
|
||||
assert "requested_extras" not in simple_report
|
||||
|
||||
|
||||
def test_install_report_to_stdout(
|
||||
script: PipTestEnvironment, shared_data: TestData
|
||||
) -> None:
|
||||
|
|
Loading…
Reference in a new issue