activity-core/tests/test_runtime_paths.py

25 lines
1,005 B
Python
Raw Normal View History

from __future__ import annotations
from activity_core.runtime_paths import resolve_runtime_path
def test_resolve_custodian_uri(monkeypatch) -> None:
monkeypatch.setenv("CUSTODIAN_REPO_ROOT", "/var/custodian")
assert resolve_runtime_path("custodian://memory/working") == (
__import__("pathlib").Path("/var/custodian/memory/working")
)
def test_resolve_activity_core_uri(monkeypatch) -> None:
monkeypatch.setenv("ACTIVITY_CORE_ROOT", "/etc/activity-core")
assert resolve_runtime_path("activity-core://schemas/daily-triage-report.json") == (
__import__("pathlib").Path("/etc/activity-core/schemas/daily-triage-report.json")
)
def test_custodian_repo_relative(monkeypatch) -> None:
from activity_core.runtime_paths import custodian_repo_relative
monkeypatch.setenv("CUSTODIAN_REPO_ROOT", "/var/custodian")
path = __import__("pathlib").Path("/var/custodian/memory/working/note.md")
assert custodian_repo_relative(path) == "memory/working/note.md"