Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests/functional/test_install_check.py, when run with new resolver #8674

Merged
merged 2 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
20 changes: 10 additions & 10 deletions tests/functional/test_install_check.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from tests.lib import create_test_package_with_setup


def contains_expected_lines(string, expected_lines):
return set(expected_lines) <= set(string.splitlines())
def assert_contains_expected_lines(string, expected_lines):
lines = string.splitlines()
for expected_line in expected_lines:
assert any(line.endswith(expected_line) for line in lines)
pradyunsg marked this conversation as resolved.
Show resolved Hide resolved


def test_check_install_canonicalization(script):
Expand Down Expand Up @@ -38,7 +40,7 @@ def test_check_install_canonicalization(script):
"pkga 1.0 requires SPECIAL.missing, which is not installed.",
]
# Deprecated python versions produce an extra warning on stderr
assert contains_expected_lines(result.stderr, expected_lines)
assert_contains_expected_lines(result.stderr, expected_lines)
assert result.returncode == 0

# Install the second missing package and expect that there is no warning
Expand All @@ -55,7 +57,7 @@ def test_check_install_canonicalization(script):
expected_lines = [
"No broken requirements found.",
]
assert contains_expected_lines(result.stdout, expected_lines)
assert_contains_expected_lines(result.stdout, expected_lines)
assert result.returncode == 0


Expand Down Expand Up @@ -85,12 +87,10 @@ def test_check_install_does_not_warn_for_out_of_graph_issues(script):
result = script.pip(
'install', '--no-index', pkg_conflict_path, allow_stderr_error=True,
)
assert contains_expected_lines(result.stderr, [
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."
),
"broken 1.0 requires conflict<1.0, "
"but you'll have conflict 1.0 which is incompatible."
])

# Install unrelated package
Expand All @@ -105,4 +105,4 @@ def test_check_install_does_not_warn_for_out_of_graph_issues(script):
"broken 1.0 requires missing, which is not installed.",
"broken 1.0 has requirement conflict<1.0, but you have conflict 1.0.",
]
assert contains_expected_lines(result.stdout, expected_lines)
assert_contains_expected_lines(result.stdout, expected_lines)