Present a message upon first backtrack

This commit is contained in:
Pradyun Gedam 2020-10-26 16:37:10 +05:30
parent 9a1f790951
commit f3307a5103
No known key found for this signature in database
GPG Key ID: FF99710C4332258E
2 changed files with 11 additions and 3 deletions

View File

@ -21,6 +21,11 @@ class PipReporter(BaseReporter):
self.backtracks_by_package = defaultdict(int) # type: DefaultDict[str, int]
self._messages_at_backtrack = {
1: (
"pip is looking at multiple versions of this package to determine "
"which version is compatible with other requirements. "
"This could take a while."
),
8: (
"pip is looking at multiple versions of this package to determine "
"which version is compatible with other requirements. "

View File

@ -1048,7 +1048,7 @@ def test_new_resolver_prefers_installed_in_upgrade_if_latest(script):
assert_installed(script, pkg="2")
@pytest.mark.parametrize("N", [10, 20])
@pytest.mark.parametrize("N", [2, 10, 20])
def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N):
# Generate a set of wheels that will definitely cause backtracking.
for index in range(1, N+1):
@ -1087,7 +1087,10 @@ def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N):
)
assert_installed(script, A="1.0.0", B="1.0.0", C="1.0.0")
if N >= 8: # this number is hard-coded in the code too.
# These numbers are hard-coded in the code.
if N >= 1:
assert "This could take a while." in result.stdout
if N >= 13: # this number is hard-coded in the code too.
if N >= 8:
assert result.stdout.count("This could take a while.") >= 2
if N >= 13:
assert "press Ctrl + C" in result.stdout