Add the UnixCommand, to parse unix-like command options

This commit is contained in:
Vincent Le Goff 2017-06-17 16:35:57 -07:00
parent 74cf15b257
commit d6f2d6a305
3 changed files with 271 additions and 21 deletions

View file

@ -73,6 +73,9 @@ class CommandTest(EvenniaTest):
cmdobj.parse()
cmdobj.func()
cmdobj.at_post_cmd()
except InterruptCommand:
pass
finally:
# 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]
@ -88,11 +91,8 @@ class CommandTest(EvenniaTest):
retval = sep1 + msg.strip() + sep2 + returned_msg + sep3
raise AssertionError(retval)
else:
returned_msg = "\n".join(stored_msg)
returned_msg = "\n".join(str(msg) for msg in stored_msg)
returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
except InterruptCommand:
pass
finally:
receiver.msg = old_msg
return returned_msg