django-click
django-click copied to clipboard
stdout does not work on `call_command`
Assuming we have a command named foo
...
import io
buffer = io.StringIO()
from django.core.management import call_command
call_command("foo", stdout=buffer)
out = buffer.getvalue()
assert "whatever" in out
This is not possible with django-click, instead saying:
TypeError: Unknown option(s) for dumb command: stdout. Valid options are: color, h, help, pythonpath, settings, traceback, v, verbosity, version.
Environment
- Django 3.2.5
- Python 3.8
- Poetry 1.1.7
- Pytest 6.2.4
- Pytest Django 4.4.0
- (if relevant) Ubuntu 20.04