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.
This commit is contained in:
1 parent
74d99f8705
commit
7ba5d75f3a
1 file changed
+19
@@ -0,0 +1,19 @@
|
||||
"""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
|
||||
Reference in new issue
Block a user