pyro-mcp/tests/test_package_surface.py
Thales Maciel 287f6d100f Add stopped-workspace disk export and inspection
Finish the 3.1.0 secondary disk-tools milestone so stable workspaces can be
stopped, inspected offline, exported as raw ext4 images, and started again
without changing the primary workspace-first interaction model.

Add workspace stop/start plus workspace disk export/list/read across the CLI,
SDK, and MCP, backed by a new offline debugfs inspection helper and guest-only
validation. Scrub runtime-only guest state before disk inspection/export, and
fix the real guest reliability gaps by flushing the filesystem on stop and
removing stale Firecracker socket files before restart.

Update the docs, examples, changelog, and roadmap to mark 3.1.0 done, and
cover the new lifecycle/disk paths with API, CLI, manager, contract, and
package-surface tests.

Validation: uv lock; UV_CACHE_DIR=.uv-cache make check; UV_CACHE_DIR=.uv-cache
make dist-check; real guest-backed smoke for create, shell/service activity,
stop, workspace disk list/read/export, start, exec, and delete.
2026-03-12 20:57:16 -03:00

67 lines
2.1 KiB
Python

from __future__ import annotations
from importlib.metadata import PackageNotFoundError
from typing import Any, cast
import pyro_mcp as package_module
def test_resolve_version_prefers_pyproject_version(monkeypatch: Any) -> None:
monkeypatch.setattr(package_module, "version", lambda _name: "9.9.9")
assert package_module._resolve_version() == package_module.__version__ # noqa: SLF001
def test_resolve_version_falls_back_to_unknown_without_metadata(monkeypatch: Any) -> None:
class _FakePyprojectPath:
def exists(self) -> bool:
return False
class _FakeResolvedPath:
@property
def parents(self) -> dict[int, Any]:
return {2: self}
def __truediv__(self, _other: str) -> _FakePyprojectPath:
return _FakePyprojectPath()
class _FakePathFactory:
def __init__(self, _value: str) -> None:
return None
def resolve(self) -> _FakeResolvedPath:
return _FakeResolvedPath()
monkeypatch.setattr(
package_module,
"version",
lambda _name: (_ for _ in ()).throw(PackageNotFoundError()),
)
monkeypatch.setattr(package_module, "Path", cast(Any, _FakePathFactory))
assert package_module._resolve_version() == "0+unknown" # noqa: SLF001
def test_resolve_version_falls_back_to_installed_version(monkeypatch: Any) -> None:
class _FakePyprojectPath:
def exists(self) -> bool:
return False
class _FakeResolvedPath:
@property
def parents(self) -> dict[int, Any]:
return {2: self}
def __truediv__(self, _other: str) -> _FakePyprojectPath:
return _FakePyprojectPath()
class _FakePathFactory:
def __init__(self, _value: str) -> None:
return None
def resolve(self) -> _FakeResolvedPath:
return _FakeResolvedPath()
monkeypatch.setattr(package_module, "version", lambda _name: "9.9.9")
monkeypatch.setattr(package_module, "Path", cast(Any, _FakePathFactory))
assert package_module._resolve_version() == "9.9.9" # noqa: SLF001