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
13 changes: 13 additions & 0 deletions python/packages/foundry_hosting/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) Microsoft. All rights reserved.

"""Fixtures for Foundry Hosting tests."""

from pathlib import Path

import pytest


@pytest.fixture(autouse=True)
def isolate_local_agentserver_state_root(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
"""Give each test an independent local AgentServer state root."""
monkeypatch.setenv("AGENTSERVER_STATE_ROOT", str(tmp_path / "agentserver-state"))
9 changes: 9 additions & 0 deletions python/packages/foundry_hosting/tests/test_state_store.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) Microsoft. All rights reserved.
import os
from collections.abc import Callable
from dataclasses import dataclass
from pathlib import Path
from types import SimpleNamespace
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
Expand Down Expand Up @@ -72,6 +74,13 @@ def _platform_context(call_id: str = "call-1", user_id: str = "user-1") -> Found
return FoundryAgentRequestContext(call_id=call_id, user_id=user_id)


def test_local_agentserver_state_root_is_test_scoped(tmp_path: Path) -> None:
"""Independent tests must not share the local fallback state directory."""
state_root = Path(os.environ["AGENTSERVER_STATE_ROOT"])

assert state_root.is_relative_to(tmp_path)


def test_storage_providers_use_public_abstraction() -> None:
assert issubclass(CheckpointStoreProvider, ContextScopedStoreProvider)
assert not issubclass(CheckpointStoreProvider, StoreProvider)
Expand Down
Loading