资源简介
网上流传的HTMLTestRunner生成报告是英文的,而且样式比较难看,比较乱,我进行了简单调整,输出中文格式报告,而且采用bootstrap调整了样式,优化了一下
代码片段和文件信息
# -*- coding: utf-8 -*-
“““
A TestRunner for use with the Python unit testing framework. It
generates a HTML report to show the result at a glance.
The simplest way to use this is to invoke its main method. E.g.
import unittest
import HTMLTestRunner
... define your tests ...
if __name__ == ‘__main__‘:
HTMLTestRunner.main()
For more customization options instantiates a HTMLTestRunner object.
HTMLTestRunner is a counterpart to unittest‘s TextTestRunner. E.g.
# output to a file
fp = file(‘my_report.html‘ ‘wb‘)
runner = HTMLTestRunner.HTMLTestRunner(
stream=fp
title=‘My unit test‘
description=‘This demonstrates the report output by HTMLTestRunner.‘
)
# Use an external stylesheet.
- 上一篇:tensorflow提取图片特征-
- 下一篇:银行卡制作脚本
评论
共有 条评论