diff --git a/tests/integration/doubles_ssh.py b/tests/integration/doubles_ssh.py index a620212e..0ea8f860 100644 --- a/tests/integration/doubles_ssh.py +++ b/tests/integration/doubles_ssh.py @@ -18,6 +18,7 @@ import sys import tempfile from dataclasses import dataclass +from importlib.metadata import version as installed from pathlib import Path from typing import TYPE_CHECKING @@ -165,14 +166,14 @@ def told(self) -> list[list[str]]: def faked( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, version: str | None = "0.0.0" + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, version: str | None = None ) -> Host: """Puts the stand-in `ssh` first on `PATH`, reaching a machine of its own. Args: tmp_path: The test's own directory. monkeypatch: What puts `PATH` back. - version: What its `hmz` says it is, or None for none at all. + version: What its `hmz` says it is; this one's by default, so nothing is installed. Returns: The machine. @@ -206,7 +207,7 @@ def faked( at.write_text(script) at.chmod(0o755) monkeypatch.setenv("PATH", f"{made}{os.pathsep}{os.environ['PATH']}") - host.installs(version) + host.installs(version or installed("hmz")) return host diff --git a/tests/integration/test_web_remote.py b/tests/integration/test_web_remote.py index 7afa4b76..6e0b90d6 100644 --- a/tests/integration/test_web_remote.py +++ b/tests/integration/test_web_remote.py @@ -14,6 +14,7 @@ import socket import subprocess import time +from importlib.metadata import version from typing import TYPE_CHECKING, Any import pytest @@ -106,7 +107,7 @@ def test_a_page_reads_and_writes_a_daemon_on_another_machine(host: Host) -> None assert listed.status == 200, listed.body assert str(host.home) in str(listed.json()) state = browser.get("/api/daemons/box/state").json() - assert state == {"state": "up", "detail": "", "version": "0.0.0"} + assert state == {"state": "up", "detail": "", "version": version("hmz")} # Written there, and not here. kept = host.home / "project" kept.mkdir()