nose的测试报告
有時候我們要讓報告整潔美觀點,以html展示測試結果,我們可以借助pip install nosehtmloutput插件輸出html格式報告
1 from nose.plugins.plugintest import run_buffered as run 2 from htmloutput.htmloutput import HtmlOutput 3 import unittest 4 class mytest(unittest.TestCase): 5 6 def testh1(self): 7 print 1 8 9 def testh2(self): 10 print 2 11 path= os.path.dirname(__file__) 12 outfile = os.path.join(path, 'test.py') 13 run(argv=['nosetests', '-v','--with-html-output','--html-out-file=result.html',outfile],plugins=[HtmlOutput()])輸出html報告展示:
總結
- 上一篇: Linux shell类型
- 下一篇: 商城app实现注册送红包