Commands¶
These fixtures are related to Django management commands.
- pytest_djangoapp.fixtures.commands.command_makemigrations(conf_app_name)¶
Allows to run makemigrations command.
Note
This command can be useful to generate migrations for your application (without a project creation).
Example:
def test_makemigrations(command_makemigrations): command_makemigrations()
- Parameters:
app – Application name to run ‘makemigrations’ for. * By default, a name from ‘conf_app_name’ fixture is used. * If empty string, command is run for any application.
args – Additional arguments to pass to the command.
- 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 – Command name to run.
args – Required arguments to pass to a command.
options – Optional arguments to pass to a command.
- Returns:
Command output.