欢迎来到代码驿站!

Python代码

当前位置:首页 > 软件编程 > Python代码

Python HTMLTestRunner库安装过程解析

时间:2022-01-04 10:56:06|栏目:Python代码|点击:

安装 HTMLTestRunner 库的方法非常简单,直接 pip 就可以了

pip install html-testRunner

在 https://pypi.org/ 中可以直接搜索到,并且官方还提供了详细的文档,操作起来非常的简单

官方示例代码:

import HtmlTestRunner
import unittest


class TestStringMethods(unittest.TestCase):

  def test_upper(self):
    self.assertEqual('foo'.upper(), 'FOO')

  def test_error(self):
    """ This test should be marked as error one. """
    raise ValueError
  def test_fail(self):
    """ This test should fail. """
    self.assertEqual(1, 2)

  @unittest.skip("This is a skipped test.")
  def test_skip(self):
    """ This test should be skipped. """
    pass
if __name__ == '__main__':
  unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='example_dir'))

这是运行后,生成的 HTML 网页

上一篇:python交互式图形编程实例(二)

栏    目:Python代码

下一篇:Django压缩静态文件的实现方法详析

本文标题:Python HTMLTestRunner库安装过程解析

本文地址:http://www.codeinn.net/misctech/189045.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有