Files
hermes-agent/tests/agent/test_session_id_env.py
teknium1 b2ecd3518f test: purge low-value tests, lane py04 (294 removed)
Change-detectors, tautologies, source-reading tests, redundant duplicates,
mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane
ledger (category + reason for every removal).
2026-09-23 03:15:26 -07:00

38 lines
913 B
Python

"""Test that HERMES_SESSION_ID is exposed as an env var and ContextVar."""
import os
import sys
import pytest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../.."))
from run_agent import AIAgent
@pytest.fixture(autouse=True)
def _cleanup_env():
"""Remove HERMES_SESSION_ID before/after each test."""
os.environ.pop("HERMES_SESSION_ID", None)
yield
os.environ.pop("HERMES_SESSION_ID", None)
def test_session_id_env_uses_provided_id():
"""When session_id is passed explicitly, HERMES_SESSION_ID reflects it."""
custom_id = "20260511_120000_abc12345"
agent = AIAgent(
api_key="test-key",
base_url="https://openrouter.ai/api/v1",
session_id=custom_id,
quiet_mode=True,
skip_context_files=True,
skip_memory=True,
)
assert os.environ["HERMES_SESSION_ID"] == custom_id
assert agent.session_id == custom_id