mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Present a message upon first backtrack
This commit is contained in:
parent
9a1f790951
commit
f3307a5103
|
@ -21,6 +21,11 @@ class PipReporter(BaseReporter):
|
||||||
self.backtracks_by_package = defaultdict(int) # type: DefaultDict[str, int]
|
self.backtracks_by_package = defaultdict(int) # type: DefaultDict[str, int]
|
||||||
|
|
||||||
self._messages_at_backtrack = {
|
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: (
|
8: (
|
||||||
"pip is looking at multiple versions of this package to determine "
|
"pip is looking at multiple versions of this package to determine "
|
||||||
"which version is compatible with other requirements. "
|
"which version is compatible with other requirements. "
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ def test_new_resolver_prefers_installed_in_upgrade_if_latest(script):
|
||||||
assert_installed(script, pkg="2")
|
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):
|
def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N):
|
||||||
# Generate a set of wheels that will definitely cause backtracking.
|
# Generate a set of wheels that will definitely cause backtracking.
|
||||||
for index in range(1, N+1):
|
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")
|
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
|
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
|
assert "press Ctrl + C" in result.stdout
|
||||||
|
|
Loading…
Reference in a new issue