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
36 changes: 36 additions & 0 deletions tests/unit/test_mcp_dev_client_persistent_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from dataclasses import replace

import pytest
from polystore.imagej_distribution import (
FijiArchiveDistribution,
ImageJArchiveDownloadPolicy,
)

import openhcs.mcp.dev_client as dev_client
from openhcs.pyqt_gui.config import (
Expand Down Expand Up @@ -57,6 +61,38 @@ def test_child_environment_does_not_invent_ui_config_override(monkeypatch) -> No
assert UIConfigCacheEnvironment.cache_file_path_key not in environment


def test_fresh_child_consumes_declared_imagej_cache_and_download_policy(
tmp_path, monkeypatch
) -> None:
cache_root = tmp_path / "shared-imagej-bundles"
monkeypatch.setenv(
FijiArchiveDistribution.cache_root_environment_key, str(cache_root)
)
monkeypatch.setenv(
ImageJArchiveDownloadPolicy.allow_download_environment_key, "false"
)
result = subprocess.run(
[
sys.executable,
"-c",
(
"import json; "
"from polystore.imagej_distribution import "
"FijiArchiveDistribution, ImageJArchiveDownloadPolicy; "
"print(json.dumps([str(FijiArchiveDistribution.cache_root_from_environment()), "
"ImageJArchiveDownloadPolicy.from_environment().allow_download]))"
),
],
env=dev_client.McpDevServerSpec(sys.executable).environment(),
capture_output=True,
text=True,
check=True,
timeout=30,
)
assert json.loads(result.stdout) == [str(cache_root), False]
assert not cache_root.exists()


def test_multi_call_command_honors_its_declared_timeout_floor() -> None:
parser = dev_client._build_parser()
default_args = parser.parse_args(
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_process_environment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from pathlib import PureWindowsPath

from polystore.imagej_distribution import (
FijiArchiveDistribution,
ImageJArchiveDownloadPolicy,
)

from openhcs.agent.runtime_platform import WindowsAgentRuntimePlatformAuthority
from openhcs.resources.brand import BRAND_PRODUCT_NAME
from openhcs.utils.environment import OpenHCSProcessEnvironment
Expand All @@ -11,6 +16,8 @@ def test_process_environment_owns_inherited_mode_selectors() -> None:
OpenHCSProcessEnvironment.headless_key,
OpenHCSProcessEnvironment.numba_cache_key,
OpenHCSProcessEnvironment.use_threading_key,
FijiArchiveDistribution.cache_root_environment_key,
ImageJArchiveDownloadPolicy.allow_download_environment_key,
)


Expand Down
Loading