Merge pull request #9124 from pradyunsg/nicer-error-message-wording

Update message displayed on conflicts post-resolution
This commit is contained in:
Pradyun Gedam 2020-11-19 10:15:06 +00:00 committed by GitHub
commit 15871707f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -529,14 +529,16 @@ class InstallCommand(RequirementCommand):
parts = [] # type: List[str]
if resolver_variant == "legacy":
parts.append(
"After October 2020 you may experience errors when installing "
"or updating packages. This is because pip will change the "
"way that it resolves dependency conflicts.\n"
"pip's legacy dependency resolver does not consider dependency "
"conflicts when selecting packages. This behaviour is the "
"source of the following dependency conflicts."
)
else:
assert resolver_variant == "2020-resolver"
parts.append(
"We recommend you use --use-feature=2020-resolver to test "
"your packages with the new resolver before it becomes the "
"default.\n"
"pip's dependency resolver does not currently take into account "
"all the packages that are installed. This behaviour is the "
"source of the following dependency conflicts."
)
# NOTE: There is some duplication here, with commands/check.py
@ -557,7 +559,7 @@ class InstallCommand(RequirementCommand):
version = package_set[project_name][0]
for dep_name, dep_version, req in conflicting[project_name]:
message = (
"{name} {version} requires {requirement}, but you'll have "
"{name} {version} requires {requirement}, but {you} have "
"{dep_name} {dep_version} which is incompatible."
).format(
name=project_name,
@ -565,6 +567,7 @@ class InstallCommand(RequirementCommand):
requirement=req,
dep_name=dep_name,
dep_version=dep_version,
you=("you" if resolver_variant == "2020-resolver" else "you'll")
)
parts.append(message)

View File

@ -89,7 +89,7 @@ def test_check_install_does_not_warn_for_out_of_graph_issues(script):
assert_contains_expected_lines(result.stderr, [
"broken 1.0 requires missing, which is not installed.",
"broken 1.0 requires conflict<1.0, "
"but you'll have conflict 1.0 which is incompatible."
"but you have conflict 1.0 which is incompatible."
])
# Install unrelated package