Is there a way to colorize the Django test output? Basically a Red/Green factor for a pass or failing results?
I am on Mac OS X using Terminal.app
.
With Django's test-execution framework and assorted utilities, you can simulate requests, insert test data, inspect your application's output and generally verify your code is doing what it should be doing. The preferred way to write tests in Django is using the unittest module built-in to the Python standard library.
Writing tests Django's unit tests use a Python standard library module: unittest . This module defines tests using a class-based approach. When you run your tests, the default behavior of the test utility is to find all the test cases (that is, subclasses of unittest.
As discussed above, we should test anything that is part of our design or that is defined by code that we have written, but not libraries/code that is already tested by Django or the Python development team. For example, consider the Author model below.
redgreenunittests is the most simple solution and it works great with python 3.x
Install it
pip install redgreenunittest
add the next line into settings.py
TEST_RUNNER = "redgreenunittest.django.runner.RedGreenDiscoverRunner"
and don't forget to enjoy :)
./manage test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With