python unitest基本
2016-03-06 17:06
681 查看
基本
aa
bb
import unittest class OneTest(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.accept_next_alert = True pass def test_testcase(self): pass def tearDown(self): self.assertEqual([],self.verificationErrors) pass if __name__ == "__main__": unittest.main()
aa
suite = unittest.TestSuite() testmodules = ['/home/one/apythonscript','/home/one/anotherscript'] for t in testmodules: try: # If the module defines a suite() function, call it to get the suite. mod = __import__(t, globals(), locals(), ['suite']) suitefn = getattr(mod, 'suite') suite.addTest(suitefn()) except (ImportError, AttributeError): # else, just load all the test cases from the module. suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t)) result = unittest.TextTestRunner().run(suite)
bb
相关文章推荐
- python paramiko基本
- python selenium基本
- 使用pycharm进行win下多个版本python编程&&GTK,py2exe安装
- Python Socket套接字
- windows+python+opencv配置
- Python学习基础:面向对象(1)
- python GUI编程 glade+GTK+py2exe 生成exe文件
- Python 爬虫过程中的中文乱码问题
- Numpy中如何给矩阵增加一行或一列
- Python之常用模块(二)
- [python小记]使用lxml修改xml文件,并遍历目录
- python ConfigParser 参数化配置 学习笔记
- eventlet引发的学习-python:单线程、多线程在IO两方面的性能对比
- Python的基础函数
- Python 2.7.11 字符串操作
- python库
- Python之常用模块(一)
- python学习笔记-Day6(3)
- 四则运算 Python
- Python:使用模块和安装模块: