Modules resolve the manifest with uv pip compile before syncing, so listed packages bring their dependencies
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import shutil
|
||||
import subprocess
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
@@ -77,6 +78,40 @@ def test_a_manifest_that_does_not_resolve_leaves_the_venv_alone(venv: Path):
|
||||
assert (venv / ".applied").read_text() == modules._digest("")
|
||||
|
||||
|
||||
def _wheel(directory: Path, name: str, requires: str = "") -> None:
|
||||
"""A wheel with nothing in it but a name and, optionally, one dependency."""
|
||||
info = f"{name}-1.0.dist-info"
|
||||
metadata = f"Metadata-Version: 2.1\nName: {name}\nVersion: 1.0\n"
|
||||
if requires:
|
||||
metadata += f"Requires-Dist: {requires}\n"
|
||||
with zipfile.ZipFile(directory / f"{name}-1.0-py3-none-any.whl", "w") as wheel:
|
||||
wheel.writestr(f"{name}/__init__.py", "")
|
||||
wheel.writestr(f"{info}/METADATA", metadata)
|
||||
wheel.writestr(
|
||||
f"{info}/WHEEL",
|
||||
"Wheel-Version: 1.0\nRoot-Is-Purelib: true\nTag: py3-none-any\n",
|
||||
)
|
||||
wheel.writestr(f"{info}/RECORD", "")
|
||||
|
||||
|
||||
def test_a_listed_package_brings_its_dependencies(
|
||||
venv: Path, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
):
|
||||
wheels = tmp_path / "wheels"
|
||||
wheels.mkdir()
|
||||
_wheel(wheels, "fluksio_top", requires="fluksio_dep")
|
||||
_wheel(wheels, "fluksio_dep")
|
||||
monkeypatch.setenv("UV_OFFLINE", "1")
|
||||
|
||||
ok, output = modules.sync(f"--find-links {wheels}\nfluksio-top\n")
|
||||
|
||||
assert ok, output
|
||||
imported = subprocess.run(
|
||||
[modules.venv_python(), "-c", "import fluksio_dep"], check=False
|
||||
)
|
||||
assert imported.returncode == 0
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Adopting the venv Fluksio was installed into
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user