Commands¶
These fixtures are related to Django management commands.
- pytest_djangoapp.fixtures.commands.command_run()¶
Allows management command run.
Example:
def test_this(command_run, capsys): result = command_run('my_command', args=['one'], options={'two': 'three'}) out, err = capsys.readouterr()
Warning
Django < 1.10 will always return None, no matter what command returns.
- Parameters
command_name (str|unicode) – Command name to run.
args (list) – Required arguments to pass to a command.
options (dict) – Optional arguments to pass to a command.
- Returns
Command output.