Add one more constraint test
@@ -531,12 +531,21 @@ def test_new_resolver_handles_prerelease(
assert_installed(script, pkg=expected_version)
-def test_new_resolver_constraints(script):
+@pytest.mark.parametrize(
+ "constraints",
+ [
+ ["pkg<2.0", "constraint_only<1.0"],
+ # This also tests the pkg constraint don't get merged with the
+ # requirement prematurely. (pypa/pip#8134)
+ ["pkg<2.0"],
+ ]
+)
+def test_new_resolver_constraints(script, constraints):
create_basic_wheel_for_package(script, "pkg", "1.0")
create_basic_wheel_for_package(script, "pkg", "2.0")
create_basic_wheel_for_package(script, "pkg", "3.0")
constraints_file = script.scratch_path / "constraints.txt"
- constraints_file.write_text("pkg<2.0\nconstraint_only<1.0")
+ constraints_file.write_text("\n".join(constraints))
script.pip(
"install", "--unstable-feature=resolver",
"--no-cache-dir", "--no-index",
