一个改进unittest输出的简单模块。
unittest-prettif的Python项目详细描述
单元测试美化
改进unittest输出的简单模块。
您喜欢哪种unittest输出?
如果你喜欢右边的那个,这个模块是给你的。
unittest prettify旨在成为一组工具来改进unittest
库输出。
主要功能
- 更改类和方法级别中的测试描述颜色。
- 支持像Django这样使用
unittest
的库。
安装它
pip install unittest-prettify
使用它
更改整个测试用例的颜色:
test_1()
和test_2()
将从类定义继承绿色。
importunittestfromunittest_prettify.colorizeimport(colorize,GREEN,)@colorize(color=GREEN)classFoo(unittest.TestCase):deftest_1(self):"""This test comment should be with the Class color set as GREEN"""deftest_2(self):"""This test comment should be with the Class color set as GREEN"""
更改特定测试的颜色:
test_1()
将从类定义继承绿色,但是test_2()
将用红色覆盖颜色。
importunittestfromunittest_prettify.colorizeimport(colorize,GREEN,RED,)@colorize(color=GREEN)classFoo(unittest.TestCase):deftest_1(self):"""This test comment should be with the Class color set as GREEN"""@colorize(color=RED)deftest_2(self):"""This test comment should be RED"""