Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions sdk/python/tests/unit/infra/test_dependency_conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,29 @@

class TestDependencyConflicts:
def test_install_kserve_with_feast(self):
"""Test installing KServe in the current environment where Feast is already installed.
Ensures no dependency conflict errors occur.
"""Resolve KServe against the environment Feast is installed in.

``--dry-run`` makes pip resolve the full dependency set and report what
it would install, without installing anything. Resolution is the part
this test cares about: pip exits non-zero when the versions cannot be
satisfied together, which is the conflict being guarded against.

Installing for real would mutate the interpreter running the suite.
Feast pins ``psutil==5.9.0`` while KServe requires ``psutil>=5.9.6``, so
pip has to uninstall psutil before reinstalling it, and the unit suite
runs under ``pytest -n 8`` against a single environment. Any test that
imports psutil during that window fails, including every test that
shells out to the CLI, since ``feast.metrics`` imports it at module
scope. It also left the environment inconsistent for the next run.
"""
# Command to install KServe
command = [sys.executable, "-m", "pip", "install", "kserve==0.15.2"]
command = [
sys.executable,
"-m",
"pip",
"install",
"--dry-run",
"kserve==0.15.2",
]

process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
Expand All @@ -26,7 +44,10 @@ def test_install_kserve_with_feast(self):
logger.debug(out)
logger.debug(err)

# Assertions
assert exit_code == 0
conflict_occured = "dependency conflicts" in err and "ERROR" not in err
assert not conflict_occured, "Dependency conflict detected during installation"
# pip reports an unsatisfiable set on stdout and exits non-zero, so the
# exit code is the assertion that matters; the message is for the
# failure output.
assert exit_code == 0, (
f"pip could not resolve kserve==0.15.2 against the current "
f"environment:\n{out}\n{err}"
)
Loading