Skip to content

Commit

Permalink
install report: added experimental status warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Jul 14, 2022
1 parent 19564a2 commit d11f3c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@ def run(self, options: Values, args: List[str]) -> int:
)

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())
Expand Down
12 changes: 11 additions & 1 deletion tests/functional/test_install_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit d11f3c3

Please sign in to comment.