Skip to content

Commit

Permalink
test: "unit test" solving for unsolvable dependencies
Browse files Browse the repository at this point in the history
Also, dial coverage up to 100% again.
  • Loading branch information
bruno-fs committed Aug 9, 2024
1 parent e5de9d0 commit a6b7d90
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ source = ["pybuild_deps", "tests"]

[tool.coverage.report]
show_missing = true
# FixME: dial this back up to 100
fail_under = 98
fail_under = 100
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
Expand Down
14 changes: 13 additions & 1 deletion tests/test_compile_build_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from pybuild_deps.compile_build_dependencies import BuildDependencyCompiler
from pybuild_deps.constants import PIP_CACHE_DIR
from pybuild_deps.exceptions import PyBuildDepsError
from pybuild_deps.exceptions import PyBuildDepsError, UnsolvableDependenciesError


@pytest.fixture
Expand Down Expand Up @@ -41,3 +41,15 @@ def test_dependency_with_complex_setup_py(compiler, caplog):
ireq = install_req_from_req_string("grpcio==1.59.0")
compiler.resolve([ireq])
assert caplog.messages[-1] == "Unable to parse setup.py for package grpcio==1.59.0."


def test_unsolvable_dependencies(compiler):
"""Test trying to solve impossible dependency combinations."""
ireqs = map(install_req_from_req_string, ("setuptools<42", "setuptools>=42"))

expected_error_msg = (
"Impossible to resolve the following dependencies for package 'foo=1.2.3':"
"\nsetuptools<42\nsetuptools>=42"
)
with pytest.raises(UnsolvableDependenciesError, match=expected_error_msg):
compiler._resolve_with_piptools("foo=1.2.3", ireqs)

0 comments on commit a6b7d90

Please sign in to comment.