6
6
7
7
import pytest
8
8
9
+ from tests .conftest import ScriptFactory
9
10
from tests .lib import (
10
11
PipTestEnvironment ,
11
12
create_basic_sdist_for_package ,
12
13
create_basic_wheel_for_package ,
13
14
create_test_package_with_setup ,
14
15
)
15
16
from tests .lib .direct_url import get_created_direct_url
17
+ from tests .lib .venv import VirtualEnvironment
16
18
from tests .lib .wheel import make_wheel
17
19
18
20
if TYPE_CHECKING :
@@ -2313,7 +2315,11 @@ def test_new_resolver_dont_backtrack_on_extra_if_base_constrained_in_requirement
2313
2315
@pytest .mark .parametrize ("swap_order" , (True , False ))
2314
2316
@pytest .mark .parametrize ("two_extras" , (True , False ))
2315
2317
def test_new_resolver_dont_backtrack_on_conflicting_constraints_on_extras (
2316
- script : PipTestEnvironment , swap_order : bool , two_extras : bool
2318
+ tmpdir : pathlib .Path ,
2319
+ virtualenv : VirtualEnvironment ,
2320
+ script_factory : ScriptFactory ,
2321
+ swap_order : bool ,
2322
+ two_extras : bool ,
2317
2323
) -> None :
2318
2324
"""
2319
2325
Verify that conflicting constraints on the same package with different
@@ -2323,6 +2329,11 @@ def test_new_resolver_dont_backtrack_on_conflicting_constraints_on_extras(
2323
2329
:param swap_order: swap the order the install specifiers appear in
2324
2330
:param two_extras: also add an extra for the second specifier
2325
2331
"""
2332
+ script : PipTestEnvironment = script_factory (
2333
+ tmpdir .joinpath ("workspace" ),
2334
+ virtualenv ,
2335
+ {** os .environ , "PIP_RESOLVER_DEBUG" : "1" },
2336
+ )
2326
2337
create_basic_wheel_for_package (script , "dep" , "1.0" )
2327
2338
create_basic_wheel_for_package (
2328
2339
script , "pkg" , "1.0" , extras = {"ext1" : ["dep" ], "ext2" : ["dep" ]}
@@ -2348,9 +2359,13 @@ def test_new_resolver_dont_backtrack_on_conflicting_constraints_on_extras(
2348
2359
assert (
2349
2360
"pkg-2.0" not in result .stdout or "pkg-1.0" not in result .stdout
2350
2361
), "Should only try one of 1.0, 2.0 depending on order"
2362
+ assert "Reporter.starting()" in result .stdout , (
2363
+ "This should never fail unless the debug reporting format has changed,"
2364
+ " in which case the other assertions in this test need to be reviewed."
2365
+ )
2351
2366
assert (
2352
- "looking at multiple versions " not in result .stdout
2353
- ), "Should not have to look at multiple versions to conclude conflict "
2367
+ "Reporter.rejecting_candidate " not in result .stdout
2368
+ ), "Should be able to conclude conflict before even selecting a candidate "
2354
2369
assert (
2355
2370
"conflict is caused by" in result .stdout
2356
2371
), "Resolver should be trivially able to find conflict cause"
0 commit comments