I use unittest
(actually unittest2
) for Python testing, together with Python Mock for mocking objects and nose to run all tests in a single pass.
Using a method very similar to robert's answer, I have (today!) released a package that enables colour output in unittest
test results. I have called it colour-runner.
To install it, run:
pip install colour-runner
Then, where you were using unittest.TextTestRunner
, use colour_runner.runner.ColourTextTestRunner
instead.
See how it looks with verbosity=1...and verbosity=2
I've also found another colouring plugin for nose: YANC at https://pypi.python.org/pypi/yanc
Works for me with Python 3.5 and nose 1.3.7 (I couldn't get any of the other options for nose listed above to work)
pytest can do this with no changes needed for unit tests.
Now install pytest.
pip install --user pytest
And run the tests to see the color!
I'm having good success with nosetests and rednose. It's still maintained at the time of writing this.
In python 2.x you could try pyrg. Does not work in Python 3 though.
Try rudolf plugin for nosetests.