evennia.commands.default.tests

This is part of the Evennia unittest framework, for testing the stability and integrity of the codebase during updates. This module test the default command set. It is instantiated by the evennia/objects/tests.py module, which in turn is run by as part of the main test suite started with

> python game/manage.py test.

class evennia.commands.default.tests.CommandTest(methodName='runTest')[source]

Bases: evennia.utils.test_resources.EvenniaTest

Tests a command

call(cmdobj, args, msg=None, cmdset=None, noansi=True, caller=None, receiver=None, cmdstring=None, obj=None, inputs=None, raw_string=None)[source]

Test a command by assigning all the needed properties to cmdobj and running

cmdobj.at_pre_cmd() cmdobj.parse() cmdobj.func() cmdobj.at_post_cmd()

The msgreturn value is compared to eventual output sent to caller.msg in the game

Returns

msg (str) – The received message that was sent to the caller.

class evennia.commands.default.tests.TestGeneral(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_look()[source]
test_look_no_location()[source]
test_look_nonexisting()[source]
test_home()[source]
test_go_home()[source]
test_no_home()[source]
test_inventory()[source]
test_pose()[source]
test_nick()[source]
test_nick_list()[source]
test_get_and_drop()[source]
test_give()[source]
test_mux_command()[source]
test_say()[source]
test_whisper()[source]
test_access()[source]
class evennia.commands.default.tests.TestHelp(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_help()[source]
test_set_help()[source]
class evennia.commands.default.tests.TestSystem(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_py()[source]
test_scripts()[source]
test_objects()[source]
test_about()[source]
test_server_load()[source]
class evennia.commands.default.tests.TestAdmin(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_emit()[source]
test_perm()[source]
test_wall()[source]
test_ban()[source]
test_force()[source]
class evennia.commands.default.tests.TestAccount(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_ooc_look()[source]
test_ooc()[source]
test_ic()[source]
test_ic__other_object()[source]
test_ic__nonaccess()[source]
test_password()[source]
test_option()[source]
test_who()[source]
test_quit()[source]
test_sessions()[source]
test_color_test()[source]
test_char_create()[source]
test_char_delete()[source]
test_quell()[source]
class evennia.commands.default.tests.TestBuilding(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_create()[source]
test_examine()[source]
test_set_obj_alias()[source]
test_copy()[source]
test_attribute_commands()[source]
test_nested_attribute_commands()[source]
test_split_nested_attr()[source]
test_do_nested_lookup()[source]
test_name()[source]
test_desc()[source]
test_empty_desc()[source]

empty desc sets desc as ‘’

test_desc_default_to_room()[source]

no rhs changes room’s desc

test_destroy()[source]
test_destroy_sequence()[source]
test_dig()[source]
test_tunnel()[source]
test_tunnel_exit_typeclass()[source]
test_exit_commands()[source]
test_set_home()[source]
test_list_cmdsets()[source]
test_typeclass()[source]
test_lock()[source]
test_find()[source]
test_script()[source]
test_teleport()[source]
test_tag()[source]
test_spawn()[source]
class evennia.commands.default.tests.TestComms(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

setUp()[source]

Sets up testing environment

test_toggle_com()[source]
test_channels()[source]
test_all_com()[source]
test_clock()[source]
test_cdesc()[source]
test_cemit()[source]
test_cwho()[source]
test_page()[source]
test_cboot()[source]
test_cdestroy()[source]
class evennia.commands.default.tests.TestBatchProcess(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_batch_commands()[source]
class evennia.commands.default.tests.CmdInterrupt(**kwargs)[source]

Bases: evennia.commands.command.Command

Base command

Usage:

command [args]

This is the base command class. Inherit from this to create new commands.

The cmdhandler makes the following variables available to the command methods (so you can always assume them to be there): self.caller - the game object calling the command self.cmdstring - the command name used to trigger this command (allows

you to know which alias was used, for example)

cmd.args - everything supplied to the command following the cmdstring

(this is usually what is parsed in self.parse())

cmd.cmdset - the cmdset from which this command was matched (useful only

seldomly, notably for help-type commands, to create dynamic help entries and lists)

cmd.obj - the object on which this command is defined. If a default command,

this is usually the same as caller.

cmd.rawstring - the full raw string input, including any args and no parsing.

The following class properties can/should be defined on your child class:

key - identifier for command (e.g. “look”) aliases - (optional) list of aliases (e.g. [“l”, “loo”]) locks - lock string (default is “cmd:all()”) help_category - how to organize this help entry in help system

(default is “General”)

auto_help - defaults to True. Allows for turning off auto-help generation arg_regex - (optional) raw string regex defining how the argument part of

the command should look in order to match for this command (e.g. must it be a space between cmdname and arg?)

auto_help_display_key - (optional) if given, this replaces the string shown

in the auto-help listing. This is particularly useful for system-commands whose actual key is not really meaningful.

(Note that if auto_help is on, this initial string is also used by the system to create the help entry for the command, so it’s a good idea to format it similar to this one). This behavior can be changed by overriding the method ‘get_help’ of a command: by default, this method returns cmd.__doc__ (that is, this very docstring, or the docstring of your command). You can, however, extend or replace this without disabling auto_help.

key = 'interrupt'
parse()[source]

Once the cmdhandler has identified this as the command we want, this function is run. If many of your commands have a similar syntax (for example ‘cmd arg1 = arg2’) you should simply define this once and just let other commands of the same form inherit from this. See the docstring of this module for which object properties are available to use (notably self.args).

func()[source]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
class evennia.commands.default.tests.TestInterruptCommand(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_interrupt_command()[source]
class evennia.commands.default.tests.TestUnconnectedCommand(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_info_command()[source]
class evennia.commands.default.tests.TestSystemCommands(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_simple_defaults()[source]
test_multimatch()[source]
test_channelcommand(mock_channeldb)[source]