From 0f39677b460114e8099218f4a1b2457eaafc82e8 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 2 Dec 2023 21:46:04 +0100 Subject: [PATCH] More work with cleanup of unit tests --- evennia/contrib/rpg/llm/tests.py | 4 ++-- evennia/utils/test_resources.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/evennia/contrib/rpg/llm/tests.py b/evennia/contrib/rpg/llm/tests.py index 25e69b6dbd..54eb4fb502 100644 --- a/evennia/contrib/rpg/llm/tests.py +++ b/evennia/contrib/rpg/llm/tests.py @@ -6,13 +6,13 @@ Unit tests for the LLM Client and npc. from anything import Something from django.test import override_settings from evennia.utils.create import create_object -from evennia.utils.test_resources import EvenniaTestCase +from evennia.utils.test_resources import BaseEvenniaTestCase from mock import Mock, patch from .llm_npc import LLMNPC -class TestLLMClient(EvenniaTestCase): +class TestLLMClient(BaseEvenniaTestCase): @override_settings(LLM_PROMPT_PREFIX="You are a test bot.", TEST_ENVIRONMENT=True) @patch("evennia.contrib.rpg.llm.llm_npc.task.deferLater") def test_npc_at_talked_to(self, mock_deferLater): diff --git a/evennia/utils/test_resources.py b/evennia/utils/test_resources.py index 84c2d11939..8d2d297809 100644 --- a/evennia/utils/test_resources.py +++ b/evennia/utils/test_resources.py @@ -97,7 +97,7 @@ DEFAULT_SETTING_RESETS = dict( BASE_GUEST_TYPECLASS="evennia.accounts.accounts.DefaultGuest", # a special setting boolean TEST_ENVIRONMENT is set by the test runner # while the test suite is running. - TEST_ENVIRONMENT=True + TEST_ENVIRONMENT=True, ) DEFAULT_SETTINGS = {**all_from_module(settings_default), **DEFAULT_SETTING_RESETS} @@ -548,6 +548,9 @@ class BaseEvenniaTestCase(TestCase): """ + def tearDown(self) -> None: + flush_cache() + class EvenniaTestCase(TestCase): """