mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: load credentials from HERMES_HOME .env in trajectory_compressor
This commit is contained in:
parent
8a002d4efc
commit
4b47856f90
2 changed files with 24 additions and 4 deletions
|
|
@ -1,6 +1,9 @@
|
|||
"""Tests for trajectory_compressor.py — config, metrics, and compression logic."""
|
||||
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, patch, MagicMock
|
||||
|
||||
|
|
@ -14,6 +17,20 @@ from trajectory_compressor import (
|
|||
)
|
||||
|
||||
|
||||
def test_import_loads_env_from_hermes_home(tmp_path, monkeypatch):
|
||||
home = tmp_path / ".hermes"
|
||||
home.mkdir()
|
||||
(home / ".env").write_text("OPENROUTER_API_KEY=from-hermes-home\n", encoding="utf-8")
|
||||
|
||||
monkeypatch.setenv("HERMES_HOME", str(home))
|
||||
monkeypatch.delenv("OPENROUTER_API_KEY", raising=False)
|
||||
|
||||
sys.modules.pop("trajectory_compressor", None)
|
||||
importlib.import_module("trajectory_compressor")
|
||||
|
||||
assert os.getenv("OPENROUTER_API_KEY") == "from-hermes-home"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# CompressionConfig
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue