testall.py

来自「Wxpython Implemented on Windows CE, Sou」· Python 代码 · 共 26 行

PY
26
字号
#!/usr/bin/env python

__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id: testall.py,v 1.2 2003/11/12 21:28:52 RD Exp $"
__revision__ = "$Revision: 1.2 $"[11:-2]


import unittest
import glob
import os


def suite():
    """Return a test suite containing all test cases in all test modules. 
    Searches the current directory for any modules matching test_*.py."""
    suite = unittest.TestSuite()
    for filename in glob.glob('test_*.py'):
        module = __import__(os.path.splitext(filename)[0])
        suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(module))
    return suite


if __name__ == '__main__':
    unittest.main(defaultTest='suite')

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?