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

@ -17,7 +17,7 @@
# This creates a red button
@create button:examples.red_button.RedButton
@create button:tutorial_examples.red_button.RedButton
# This comment ends input for @create
# Next command:

View file

@ -11,16 +11,16 @@ Create this button with
Note that you must drop the button before you can see its messages!
"""
import random
from evennia import Object
from contrib.examples import red_button_scripts as scriptexamples
from contrib.examples import cmdset_red_button as cmdsetexamples
from evennia import DefaultObject
from contrib.tutorial_examples import red_button_scripts as scriptexamples
from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples
#
# Definition of the object itself
#
class RedButton(Object):
class RedButton(DefaultObject):
"""
This class describes an evil red button. It will use the script
definition in contrib/examples/red_button_scripts to blink at regular

View file

@ -7,7 +7,7 @@ on uses of scripts are included.
"""
from evennia import Script
from contrib.examples import cmdset_red_button as cmdsetexamples
from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples
#
# Scripts as state-managers

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()