fix(test): clear profile cache between tests to prevent cross-test leakage (#2698)

This commit is contained in:
Rod Boev 2026-06-18 20:44:10 -04:00 committed by nesquena-hermes
parent 35eced6f35
commit a40ed2dbb8

View file

@ -13,6 +13,7 @@ from unittest import mock
import pytest
import api.profiles as _profiles_mod
from api.profiles import (
_is_isolated_profile_mode,
list_profiles_api,
@ -21,6 +22,14 @@ from api.profiles import (
)
@pytest.fixture(autouse=True)
def _clear_profile_cache():
"""Clear the profile list cache before and after each test to prevent cross-test leakage."""
_profiles_mod._LIST_PROFILES_CACHE = None
yield
_profiles_mod._LIST_PROFILES_CACHE = None
@pytest.fixture
def temp_hermes_home():
"""Create a temporary .hermes directory structure for testing."""