Clean up all test suites

This commit is contained in:
Griatch 2022-01-07 16:12:12 +01:00
parent 0f3b96886c
commit 19f920b6d4
41 changed files with 237 additions and 169 deletions

View file

@ -23,7 +23,7 @@ from unittest.mock import patch, Mock, MagicMock
from evennia import DefaultRoom, DefaultExit, ObjectDB
from evennia.commands.default.cmdset_character import CharacterCmdSet
from evennia.utils.test_resources import EvenniaTest, LocalEvenniaTest
from evennia.utils.test_resources import BaseEvenniaTest, EvenniaTest
from evennia.commands.default import (
help as help_module,
general,
@ -309,14 +309,24 @@ class CommandTestMixin:
return returned_msgs
class EvenniaCommandTest(EvenniaTest, CommandTestMixin):
@patch("evennia.commands.account.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.admin.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.batchprocess.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.building.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.comms.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.general.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.help.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.syscommands.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.system.COMMAND_DEFAULT_CLASS", MuxCommand)
@patch("evennia.commands.unloggedin.COMMAND_DEFAULT_CLASS", MuxCommand)
class EvenniaCommandTest(BaseEvenniaTest, CommandTestMixin):
"""
Commands only using the default settings.
"""
class LocalEvenniaCommandTest(LocalEvenniaTest, CommandTestMixin):
class CommandTest(EvenniaTest, CommandTestMixin):
"""
Parent class to inherit from - makes tests use your own
classes and settings in mygame.
@ -1959,14 +1969,17 @@ class TestBuilding(EvenniaCommandTest):
import evennia.commands.default.comms as cmd_comms # noqa
from evennia.utils.create import create_channel # noqa
from evennia.comms.comms import DefaultChannel # noqa
@patch("evennia.commands.default.comms.CHANNEL_DEFAULT_TYPECLASS", DefaultChannel)
class TestCommsChannel(EvenniaCommandTest):
"""
Test the central `channel` command.
"""
def setUp(self):
super(EvenniaCommandTest, self).setUp()
super().setUp()
self.channel = create_channel(
key="testchannel",
desc="A test channel")
@ -2039,6 +2052,7 @@ class TestCommsChannel(EvenniaCommandTest):
def test_channel__alias__unalias(self):
"""Add and then remove a channel alias"""
# add alias
self.call(
self.cmdchannel(),

View file

@ -4,7 +4,7 @@ Unit testing for the Command system itself.
"""
from django.test import override_settings
from evennia.utils.test_resources import EvenniaTest, TestCase
from evennia.utils.test_resources import BaseEvenniaTest, TestCase
from evennia.commands.cmdset import CmdSet
from evennia.commands.command import Command
from evennia.commands import cmdparser
@ -989,7 +989,7 @@ def _mockdelay(time, func, *args, **kwargs):
return func(*args, **kwargs)
class TestGetAndMergeCmdSets(TwistedTestCase, EvenniaTest):
class TestGetAndMergeCmdSets(TwistedTestCase, BaseEvenniaTest):
"Test the cmdhandler.get_and_merge_cmdsets function."
def setUp(self):
@ -1176,7 +1176,7 @@ class TestCmdParser(TestCase):
)
class TestCmdSetNesting(EvenniaTest):
class TestCmdSetNesting(BaseEvenniaTest):
"""
Test 'nesting' of cmdsets by adding
"""