Files
qbot 7ba5d75f3a test: isolate $HOME per test so media fallback stops writing ~/agenthub-media
test_channels_e2e / test_relay_no_stack / test_session_manager drive prompt()
with agents that lack cwd_whitelist, so the ~/agenthub-media fallback created
directories in the real home directory on every run.
2026-10-22 18:54:58 +08:00

20 lines
616 B
Python

"""Shared test isolation.
Several tests drive ``SessionManager.prompt(files=...)`` / ``_media_dir()`` with
agents that have no ``cwd_whitelist``, which makes the fallback path write to
``~/agenthub-media``. Pointing ``HOME`` at a per-test temp dir keeps the suite
from littering the real home directory.
"""
from __future__ import annotations
import pytest
@pytest.fixture(autouse=True)
def isolated_home(tmp_path, monkeypatch):
"""Per-test ``$HOME`` so nothing is written to the real home directory."""
home = tmp_path / "home"
home.mkdir()
monkeypatch.setenv("HOME", str(home))
return home