From 0ef877339a270c760a51c3a61e55c2f4f86f84ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Sat, 1 Aug 2020 16:57:30 +0700 Subject: [PATCH 1/2] Make assertions independent of log prefixes --- ...81396b-ebe4-46a9-b38f-e6b0da97d53a.trivial | 0 tests/functional/test_install_check.py | 20 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 news/2581396b-ebe4-46a9-b38f-e6b0da97d53a.trivial diff --git a/news/2581396b-ebe4-46a9-b38f-e6b0da97d53a.trivial b/news/2581396b-ebe4-46a9-b38f-e6b0da97d53a.trivial new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/functional/test_install_check.py b/tests/functional/test_install_check.py index 88609422bb4..96ed6b6e18a 100644 --- a/tests/functional/test_install_check.py +++ b/tests/functional/test_install_check.py @@ -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) def test_check_install_canonicalization(script): @@ -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 @@ -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 @@ -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 @@ -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) From e48a0cb7cba70d7184f7a08b49163cf5a6451b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Sat, 1 Aug 2020 16:59:07 +0700 Subject: [PATCH 2/2] Remove no-longer-used messages --- src/pip/_internal/commands/install.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 8c2c32fd43f..77ec210d6af 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -21,7 +21,6 @@ from pip._internal.operations.check import check_install_conflicts from pip._internal.req import install_given_reqs from pip._internal.req.req_tracker import get_requirement_tracker -from pip._internal.utils.datetime import today_is_later_than from pip._internal.utils.deprecation import deprecated from pip._internal.utils.distutils_args import parse_distutils_args from pip._internal.utils.filesystem import test_writable_dir @@ -558,19 +557,6 @@ def _warn_about_conflicts(self, conflict_details, new_resolver): "your packages with the new resolver before it becomes the " "default.\n" ) - elif not today_is_later_than(year=2020, month=7, day=31): - # NOTE: trailing newlines here are intentional - parts.append( - "Pip will install or upgrade your package(s) and its " - "dependencies without taking into account other packages you " - "already have installed. This may cause an uncaught " - "dependency conflict.\n" - ) - form_link = "https://forms.gle/cWKMoDs8sUVE29hz9" - parts.append( - "If you would like pip to take your other packages into " - "account, please tell us here: {}\n".format(form_link) - ) # NOTE: There is some duplication here, with commands/check.py for project_name in missing: