1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

install report: added experimental status warning

This commit is contained in:
Stéphane Bidoul 2022-07-14 17:49:49 +02:00
parent 16029fbcc9
commit 074c6b5cad
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
2 changed files with 17 additions and 1 deletions

View file

@ -371,6 +371,12 @@ class InstallCommand(RequirementCommand):
)
if options.json_report_file:
logger.warning(
"--report is currently an experimental option. "
"The output format may change in a future release "
"without prior warning."
)
report = InstallationReport(requirement_set.requirements_to_install)
if options.json_report_file == "-":
print_json(data=report.to_dict())

View file

@ -26,6 +26,7 @@ def test_install_report_basic(
str(shared_data.root / "packages/"),
"--report",
str(report_path),
allow_stderr_warning=True,
)
report = json.loads(report_path.read_text())
assert "install" in report
@ -58,6 +59,7 @@ def test_install_report_dep(
str(shared_data.root / "packages/"),
"--report",
str(report_path),
allow_stderr_warning=True,
)
report = json.loads(report_path.read_text())
assert len(report["install"]) == 2
@ -76,6 +78,7 @@ def test_install_report_index(script: PipTestEnvironment, tmp_path: Path) -> Non
"Paste[openid]==1.7.5.1",
"--report",
str(report_path),
allow_stderr_warning=True,
)
report = json.loads(report_path.read_text())
assert len(report["install"]) == 2
@ -111,6 +114,7 @@ def test_install_report_vcs_and_wheel_cache(
str(cache_dir),
"--report",
str(report_path),
allow_stderr_warning=True,
)
report = json.loads(report_path.read_text())
assert len(report["install"]) == 1
@ -138,6 +142,7 @@ def test_install_report_vcs_and_wheel_cache(
str(cache_dir),
"--report",
str(report_path),
allow_stderr_warning=True,
)
assert "Using cached pip_test_package" in result.stdout
report = json.loads(report_path.read_text())
@ -171,6 +176,7 @@ def test_install_report_vcs_editable(
"#egg=pip-test-package",
"--report",
str(report_path),
allow_stderr_warning=True,
)
report = json.loads(report_path.read_text())
assert len(report["install"]) == 1
@ -197,8 +203,12 @@ def test_install_report_to_stdout(
str(shared_data.root / "packages/"),
"--report",
"-",
allow_stderr_warning=True,
)
assert result.stderr == (
"WARNING: --report is currently an experimental option. "
"The output format may change in a future release without prior warning.\n"
)
assert not result.stderr
report = json.loads(result.stdout)
assert "install" in report
assert len(report["install"]) == 1