How to use the resolvelib.InconsistentCandidate function in resolvelib

To help you get started, we’ve selected a few resolvelib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sarugaku / resolvelib / tests / test_resolvers.py View on Github external
def get_dependencies(self, _):
            return []

        def find_matches(self, r):
            assert r is requirement
            return [candidate]

        def is_satisfied_by(self, r, c):
            assert r is requirement
            assert c is candidate
            return False

    resolver = Resolver(Provider(), BaseReporter())

    with pytest.raises(InconsistentCandidate) as ctx:
        resolver.resolve([requirement])

    assert str(ctx.value) == "Provided candidate 'bar' does not satisfy 'foo'"
    assert ctx.value.candidate is candidate
    assert list(ctx.value.criterion.iter_requirement()) == [requirement]