提交 989ad65e authored 作者: Frederic Bastien's avatar Frederic Bastien

added a main method for test. That way we don't need to change code in each…

added a main method for test. That way we don't need to change code in each test_file.py fi we want to change what it do if we call it directly.
上级 71984e0a
import unittest
def main(modulename):
if 0:
unittest.main()
elif 1:
module = __import__(modulename)
tests = unittest.TestLoader().loadTestsFromModule(module)
tests.debug()
else:
testcases = []
testcases.append(T_function_module)
#<testsuite boilerplate>
testloader = unittest.TestLoader()
suite = unittest.TestSuite()
for testcase in testcases:
suite.addTest(testloader.loadTestsFromTestCase(testcase))
unittest.TextTestRunner(verbosity=2).run(suite)
#</boilerplate>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论