Skip to content

Commit f3307a5

Browse files
committed
Present a message upon first backtrack
1 parent 9a1f790 commit f3307a5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/pip/_internal/resolution/resolvelib/reporter.py

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ def __init__(self):
2121
self.backtracks_by_package = defaultdict(int) # type: DefaultDict[str, int]
2222

2323
self._messages_at_backtrack = {
24+
1: (
25+
"pip is looking at multiple versions of this package to determine "
26+
"which version is compatible with other requirements. "
27+
"This could take a while."
28+
),
2429
8: (
2530
"pip is looking at multiple versions of this package to determine "
2631
"which version is compatible with other requirements. "

tests/functional/test_new_resolver.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ def test_new_resolver_prefers_installed_in_upgrade_if_latest(script):
10481048
assert_installed(script, pkg="2")
10491049

10501050

1051-
@pytest.mark.parametrize("N", [10, 20])
1051+
@pytest.mark.parametrize("N", [2, 10, 20])
10521052
def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N):
10531053
# Generate a set of wheels that will definitely cause backtracking.
10541054
for index in range(1, N+1):
@@ -1087,7 +1087,10 @@ def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N):
10871087
)
10881088

10891089
assert_installed(script, A="1.0.0", B="1.0.0", C="1.0.0")
1090-
if N >= 8: # this number is hard-coded in the code too.
1090+
# These numbers are hard-coded in the code.
1091+
if N >= 1:
10911092
assert "This could take a while." in result.stdout
1092-
if N >= 13: # this number is hard-coded in the code too.
1093+
if N >= 8:
1094+
assert result.stdout.count("This could take a while.") >= 2
1095+
if N >= 13:
10931096
assert "press Ctrl + C" in result.stdout

0 commit comments

Comments
 (0)