首页 > 技术文章 > Python: 关于nose

ilovewindy 2016-11-17 11:31 原文

1. 使用rednose增强输出

pip install rednose
nosetests --rednose tests

2. 使用coverage

pip install coverage
nosetests --with-coverage --cover-html tests

随后可以在cover目录中查看生成的html报表

3. nose测试中默认捕获测试通过的case中的print输出,如果想要输出结果,可以加入以下参数

nosetests --nocapture mytest.py

 

推荐阅读