Present a message upon first backtrack

上级 9a1f7909
......@@ -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. "
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册