"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/mixology/solutions/providers/test_python_requirement_solution_provider.py" between
poetry-1.1.15.tar.gz and poetry-1.2.0.tar.gz

About: Poetry is a tool for dependency management and packaging in Python.

test_python_requirement_solution_provider.py  (poetry-1.1.15):test_python_requirement_solution_provider.py  (poetry-1.2.0)
import pytest from __future__ import annotations
from poetry.core.packages.dependency import Dependency from poetry.core.packages.dependency import Dependency
from poetry.mixology.failure import SolveFailure from poetry.mixology.failure import SolveFailure
from poetry.mixology.incompatibility import Incompatibility from poetry.mixology.incompatibility import Incompatibility
from poetry.mixology.incompatibility_cause import NoVersionsCause from poetry.mixology.incompatibility_cause import NoVersionsCause
from poetry.mixology.incompatibility_cause import PythonCause from poetry.mixology.incompatibility_cause import PythonCause
from poetry.mixology.term import Term from poetry.mixology.term import Term
from poetry.puzzle.exceptions import SolverProblemError from poetry.puzzle.exceptions import SolverProblemError
from poetry.utils._compat import PY36
@pytest.mark.skipif(
not PY36, reason="Error solutions are only available for Python ^3.6"
)
def test_it_can_solve_python_incompatibility_solver_errors(): def test_it_can_solve_python_incompatibility_solver_errors():
from poetry.mixology.solutions.providers import PythonRequirementSolutionPro vider from poetry.mixology.solutions.providers import PythonRequirementSolutionPro vider
from poetry.mixology.solutions.solutions import PythonRequirementSolution from poetry.mixology.solutions.solutions import PythonRequirementSolution
incompatibility = Incompatibility( incompatibility = Incompatibility(
[Term(Dependency("foo", "^1.0"), True)], PythonCause("^3.5", ">=3.6") [Term(Dependency("foo", "^1.0"), True)], PythonCause("^3.5", ">=3.6")
) )
exception = SolverProblemError(SolveFailure(incompatibility)) exception = SolverProblemError(SolveFailure(incompatibility))
provider = PythonRequirementSolutionProvider() provider = PythonRequirementSolutionProvider()
assert provider.can_solve(exception) assert provider.can_solve(exception)
assert isinstance(provider.get_solutions(exception)[0], PythonRequirementSol ution) assert isinstance(provider.get_solutions(exception)[0], PythonRequirementSol ution)
@pytest.mark.skipif(
not PY36, reason="Error solutions are only available for Python ^3.6"
)
def test_it_cannot_solve_other_solver_errors(): def test_it_cannot_solve_other_solver_errors():
from poetry.mixology.solutions.providers import PythonRequirementSolutionPro vider from poetry.mixology.solutions.providers import PythonRequirementSolutionPro vider
incompatibility = Incompatibility( incompatibility = Incompatibility(
[Term(Dependency("foo", "^1.0"), True)], NoVersionsCause() [Term(Dependency("foo", "^1.0"), True)], NoVersionsCause()
) )
exception = SolverProblemError(SolveFailure(incompatibility)) exception = SolverProblemError(SolveFailure(incompatibility))
provider = PythonRequirementSolutionProvider() provider = PythonRequirementSolutionProvider()
assert not provider.can_solve(exception) assert not provider.can_solve(exception)
 End of changes. 5 change blocks. 
8 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)