More work with cleanup of unit tests

This commit is contained in:
Griatch 2023-12-02 21:46:04 +01:00
parent 48fdc2c935
commit 0f39677b46
2 changed files with 6 additions and 3 deletions

View file

@ -6,13 +6,13 @@ Unit tests for the LLM Client and npc.
from anything import Something from anything import Something
from django.test import override_settings from django.test import override_settings
from evennia.utils.create import create_object 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 mock import Mock, patch
from .llm_npc import LLMNPC from .llm_npc import LLMNPC
class TestLLMClient(EvenniaTestCase): class TestLLMClient(BaseEvenniaTestCase):
@override_settings(LLM_PROMPT_PREFIX="You are a test bot.", TEST_ENVIRONMENT=True) @override_settings(LLM_PROMPT_PREFIX="You are a test bot.", TEST_ENVIRONMENT=True)
@patch("evennia.contrib.rpg.llm.llm_npc.task.deferLater") @patch("evennia.contrib.rpg.llm.llm_npc.task.deferLater")
def test_npc_at_talked_to(self, mock_deferLater): def test_npc_at_talked_to(self, mock_deferLater):

View file

@ -97,7 +97,7 @@ DEFAULT_SETTING_RESETS = dict(
BASE_GUEST_TYPECLASS="evennia.accounts.accounts.DefaultGuest", BASE_GUEST_TYPECLASS="evennia.accounts.accounts.DefaultGuest",
# a special setting boolean TEST_ENVIRONMENT is set by the test runner # a special setting boolean TEST_ENVIRONMENT is set by the test runner
# while the test suite is running. # while the test suite is running.
TEST_ENVIRONMENT=True TEST_ENVIRONMENT=True,
) )
DEFAULT_SETTINGS = {**all_from_module(settings_default), **DEFAULT_SETTING_RESETS} 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): class EvenniaTestCase(TestCase):
""" """