diff --git a/tests/test_issue2698_isolated_hermes_home.py b/tests/test_issue2698_isolated_hermes_home.py index b1448a06..2d62c197 100644 --- a/tests/test_issue2698_isolated_hermes_home.py +++ b/tests/test_issue2698_isolated_hermes_home.py @@ -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."""