mirror of
https://github.com/evennia/evennia.git
synced 2026-03-22 07:46:30 +01:00
Make TestCommand unittest base handle non-text outputfuncs from msg() calls. This is done by primarily using text, and if that is None, by converting the entirety of the alternative kwargs to strings. Implements #1091."
This commit is contained in:
parent
95aa505b45
commit
a467d2984e
1 changed files with 4 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ from mock import Mock
|
|||
from evennia.commands.default.cmdset_character import CharacterCmdSet
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.commands.default import help, general, system, admin, player, building, batchprocess, comms
|
||||
from evennia.utils import ansi
|
||||
from evennia.utils import ansi, utils
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
|
||||
|
||||
|
|
@ -67,8 +67,9 @@ class CommandTest(EvenniaTest):
|
|||
cmdobj.parse()
|
||||
cmdobj.func()
|
||||
cmdobj.at_post_cmd()
|
||||
# clean out prettytable sugar
|
||||
stored_msg = [args[0] if args else kwargs.get("text",kwargs) for name, args, kwargs in receiver.msg.mock_calls]
|
||||
# clean out prettytable sugar. We only operate on text-type
|
||||
stored_msg = [args[0] if args and args[0] else kwargs.get("text",utils.to_str(kwargs, force_string=True))
|
||||
for name, args, kwargs in receiver.msg.mock_calls]
|
||||
returned_msg = "||".join(_RE.sub("", mess) for mess in stored_msg)
|
||||
returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
|
||||
if msg is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue