Skip to main content

A simple module to improve the unittest output.

Project description

unittest Prettify

license pypi version python versions

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.

It aims to pretiffy the description in the unittest output by colorizing it.

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.

Source Distribution

unittest-prettify-1.0.post2.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

unittest_prettify-1.0.post2-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page