From 5494275d0a75a06ac31bda2bde961c5eded7e555 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Sun, 12 Dec 2021 08:18:28 +0000 Subject: [PATCH] Test that the resolver skips packages, as instructed by constraints --- tests/functional/test_new_resolver.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py index 1ccd2035d9d..5a0a480e298 100644 --- a/tests/functional/test_new_resolver.py +++ b/tests/functional/test_new_resolver.py @@ -2327,3 +2327,26 @@ def test_new_resolver_do_not_backtrack_on_build_failure( ) assert "egg_info" in result.stderr + + +def test_new_resolver_works_when_failing_package_builds_are_disallowed( + script: PipTestEnvironment, +) -> None: + create_basic_wheel_for_package(script, "pkg2", "1.0", depends=["pkg1"]) + create_basic_sdist_for_package(script, "pkg1", "2.0", fails_egg_info=True) + create_basic_wheel_for_package(script, "pkg1", "1.0") + constraints_file = script.scratch_path / "constraints.txt" + constraints_file.write_text("pkg1 != 2.0") + + script.pip( + "install", + "--no-cache-dir", + "--no-index", + "--find-links", + script.scratch_path, + "-c", + constraints_file, + "pkg2", + ) + + script.assert_installed(pkg2="1.0", pkg1="1.0")