Skip to content

Commit 0f543e3

Browse files
committed
made assertions more robust
1 parent 89b68c6 commit 0f543e3

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/functional/test_new_resolver.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
import pytest
88

9+
from tests.conftest import ScriptFactory
910
from tests.lib import (
1011
PipTestEnvironment,
1112
create_basic_sdist_for_package,
1213
create_basic_wheel_for_package,
1314
create_test_package_with_setup,
1415
)
1516
from tests.lib.direct_url import get_created_direct_url
17+
from tests.lib.venv import VirtualEnvironment
1618
from tests.lib.wheel import make_wheel
1719

1820
if TYPE_CHECKING:
@@ -2313,7 +2315,11 @@ def test_new_resolver_dont_backtrack_on_extra_if_base_constrained_in_requirement
23132315
@pytest.mark.parametrize("swap_order", (True, False))
23142316
@pytest.mark.parametrize("two_extras", (True, False))
23152317
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,
23172323
) -> None:
23182324
"""
23192325
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(
23232329
:param swap_order: swap the order the install specifiers appear in
23242330
:param two_extras: also add an extra for the second specifier
23252331
"""
2332+
script: PipTestEnvironment = script_factory(
2333+
tmpdir.joinpath("workspace"),
2334+
virtualenv,
2335+
{**os.environ, "PIP_RESOLVER_DEBUG": "1"},
2336+
)
23262337
create_basic_wheel_for_package(script, "dep", "1.0")
23272338
create_basic_wheel_for_package(
23282339
script, "pkg", "1.0", extras={"ext1": ["dep"], "ext2": ["dep"]}
@@ -2348,9 +2359,13 @@ def test_new_resolver_dont_backtrack_on_conflicting_constraints_on_extras(
23482359
assert (
23492360
"pkg-2.0" not in result.stdout or "pkg-1.0" not in result.stdout
23502361
), "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+
)
23512366
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"
23542369
assert (
23552370
"conflict is caused by" in result.stdout
23562371
), "Resolver should be trivially able to find conflict cause"

0 commit comments

Comments
 (0)