cmd2_ext_test

External Test Plugin

class cmd2_ext_test.ExternalTestMixin(*args, **kwargs)

A cmd2 plugin (mixin class) that exposes an interface to execute application commands from python

app_cmd(command: str, echo: bool | None = None) CommandResult

Run the application command

Parameters:
  • command – The application command as it would be written on the cmd2 application prompt

  • echo – Flag whether the command’s output should be echoed to stdout/stderr

Returns:

A CommandResult object that captures stdout, stderr, and the command’s result object

fixture_setup()

Replicates the behavior of cmdloop() preparing the state of the application :type self: cmd2.Cmd

fixture_teardown()

Replicates the behavior of cmdloop() tearing down the application