unittest colored output

前端 未结 9 2100
予麋鹿
予麋鹿 2020-12-13 17:39

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.

9条回答
  •  猫巷女王i
    2020-12-13 17:53

    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

提交回复
热议问题