From 956121ff53a689d5bd7471af9772bd0c5dc1dbd5 Mon Sep 17 00:00:00 2001 From: ross-p-smith Date: Mon, 20 May 2024 19:00:05 +0000 Subject: [PATCH] Clear the cache after each test --- .../functional/tests/backend_api/default/conftest.py | 8 ++++++++ code/tests/utilities/helpers/test_config_helper.py | 1 + 2 files changed, 9 insertions(+) diff --git a/code/tests/functional/tests/backend_api/default/conftest.py b/code/tests/functional/tests/backend_api/default/conftest.py index 27f4dadd5..4c8aac922 100644 --- a/code/tests/functional/tests/backend_api/default/conftest.py +++ b/code/tests/functional/tests/backend_api/default/conftest.py @@ -48,3 +48,11 @@ def manage_app(app_port: int, app_config: AppConfig): app_config.remove_from_environment() EnvHelper.clear_instance() ConfigHelper.clear_config() + + +@pytest.fixture(autouse=True) +def reset_default_config(): + """ + Reset the default config after each test + """ + ConfigHelper.clear_config() diff --git a/code/tests/utilities/helpers/test_config_helper.py b/code/tests/utilities/helpers/test_config_helper.py index d764b9be8..4bd4568f7 100644 --- a/code/tests/utilities/helpers/test_config_helper.py +++ b/code/tests/utilities/helpers/test_config_helper.py @@ -142,6 +142,7 @@ def reset_default_config(): ConfigHelper.get_active_config_or_default.cache_clear() yield ConfigHelper._default_config = None + ConfigHelper.get_active_config_or_default.cache_clear() def test_active_config_or_default_is_cached(env_helper_mock: MagicMock):