I'm trying to get a colored output (red or green) when running my Django tests with the native Django test runner.
I'm running a poetry virtualenv (python 3.11.6) with Django (5.0.3) and colorama (0.4.6) in a zsh on MacOS but the output remains colourless.
Following the Django documentation, I've set export DJANGO_COLORS="error=yellow/blue,blink;notice=magenta"
in my zsh before calling python manage.py test apps.myapp
. Yet, the output remains colourless. Same result when adding the --force-color
option.
However, spinning up the same virtualenv and executing
from colorama import Fore, Style
print(Fore.RED + 'This is red text' + Style.RESET_ALL)
returns a red text (as expected).
What do I have to do to get a colored output from the native Django test runner without switching to a different one?