Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A simple module to improve the unittest output.

Project description

unittest prettify

license pypi version python versions Build Status Code covarage

A simple module to improve the unittest output.

Which unittest output do you prefer?

If you prefer the one in the right side, this module is for you.

unittest prettify aims to be a set of tools to improve the unittest lib output.

Main features

  • Change the test description color in both class and method levels.
  • Support to libraries which use unittest as bese such as Django.

Installing it

pip install unittest-prettify 

Using it

Changing the color for a whole test case:

The test_1() and test_2() will inherit the green color from the class definition.

import unittest
from unittest_prettify.colorize import (
    colorize,
    GREEN,
)

@colorize(color=GREEN)
class Foo(unittest.TestCase):
    def test_1(self):
        """This test comment should be with the Class color set as GREEN"""

    def test_2(self):
        """This test comment should be with the Class color set as GREEN"""

Changing the color for a specific test:

The test_1() will inherit the green color from the class definition, but test_2() will overwrite the color by red.

import unittest
from unittest_prettify.colorize import (
    colorize,
    GREEN,
    RED,
)

@colorize(color=GREEN)
class Foo(unittest.TestCase):
    def test_1(self):
        """This test comment should be with the Class color set as GREEN"""

    @colorize(color=RED)
    def test_2(self):
        """This test comment should be RED"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for unittest-prettify, version 1.0.post4
Filename, size File type Python version Upload date Hashes
Filename, size unittest_prettify-1.0.post4-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size unittest-prettify-1.0.post4.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page