Reworked Evennia now passes the unit tests

This commit is contained in:
Griatch 2015-01-09 00:10:18 +01:00
parent d0ef05202d
commit 515ce71d65
9 changed files with 17 additions and 14 deletions

View file

@ -33,6 +33,7 @@ Msg = None
# commands
Command = None
CmdSet = None
default_cmds = None
syscmdkeys = None
@ -68,7 +69,6 @@ except IOError:
__version__ += " (unknown version)"
del os
def init():
"""
This is called only after Evennia has fully initialized all its models.
@ -83,7 +83,7 @@ def init():
global DefaultPlayer, DefaultObject, DefaultGuest, DefaultCharacter, \
DefaultRoom, DefaultExit, DefaultChannel, Script
global ObjectDB, PlayerDB, ScriptDB, ChannelDB, Msg
global Command, default_cmds, syscmdkeys
global Command, CmdSet, default_cmds, syscmdkeys
global search_object, search_script, search_player, search_channel, search_help
global create_object, create_script, create_player, create_channel, create_message
global lockfuncs, tickerhandler, logger, utils, gametime, ansi, spawn, managers
@ -106,6 +106,7 @@ def init():
# commands
from commands.command import Command
from commands.cmdset import CmdSet
# search functions
from utils.search import search_object
@ -256,4 +257,3 @@ def init():
syscmdkeys = SystemCmds()
del SystemCmds
del _EvContainer

View file

@ -162,11 +162,12 @@ class CmdPy(MuxCommand):
# check if caller is a player
# import useful variables
import ev
import evennia
available_vars = {'self': caller,
'me': caller,
'here': hasattr(caller, "location") and caller.location or None,
'ev': ev,
'evennia': evennia,
'ev': evennia,
'inherits_from': utils.inherits_from}
try:

View file

@ -15,6 +15,8 @@ main test suite started with
import re
from django.conf import settings
from django.utils.unittest import TestCase
import evennia
evennia.init()
from evennia.server.serversession import ServerSession
from evennia.objects.objects import DefaultObject, DefaultCharacter
from evennia.players.players import DefaultPlayer
@ -232,7 +234,7 @@ from evennia.commands.default import building
class TestBuilding(CommandTest):
CID = 6
def test_cmds(self):
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new DefaultObject: TestObj1.")
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new Object: TestObj1.")
self.call(building.CmdExamine(), "TestObj1", "Name/key: TestObj1")
self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Alias(es) for 'TestObj1' set to testobj1b.")
self.call(building.CmdCopy(), "TestObj1 = TestObj2;TestObj2b, TestObj3;TestObj3b", "Copied TestObj1 to 'TestObj3' (aliases: ['TestObj3b']")
@ -283,5 +285,5 @@ class TestBatchProcess(CommandTest):
CID = 8
def test_cmds(self):
# cannot test batchcode here, it must run inside the server process
self.call(batchprocess.CmdBatchCommands(), "examples.batch_cmds", "Running Batchcommand processor Automatic mode for examples.batch_cmds")
self.call(batchprocess.CmdBatchCommands(), "contrib.tutorial_examples.batch_cmds", "Running Batchcommand processor Automatic mode for contrib.tutorial_examples.batch_cmds")
#self.call(batchprocess.CmdBatchCode(), "examples.batch_code", "")

View file

@ -109,7 +109,7 @@ class DefaultChannel(ChannelDB):
"""
self.attributes.clear()
self.aliases.clear()
super(Channel, self).delete()
super(DefaultChannel, self).delete()
from evennia.comms.channelhandler import CHANNELHANDLER
CHANNELHANDLER.update()