Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions tests/integration/doubles_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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


Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_web_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import socket
import subprocess
import time
from importlib.metadata import version
from typing import TYPE_CHECKING, Any

import pytest
Expand Down Expand Up @@ -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()
Expand Down
Loading