提交 f1b48497 authored 作者: Frederic Bastien's avatar Frederic Bastien

now you must give the --debug option to be in debug mode. This will be usefull…

now you must give the --debug option to be in debug mode. This will be usefull as the file that don't use this main, will have the same default and we should be able to use it everywhere without trouble.
上级 172d2351
import unittest
import unittest,sys
def main(modulename):
debug = False
if 0:
unittest.main()
elif 1:
elif len(sys.argv)==2 and sys.argv[1]=="--debug":
module = __import__(modulename)
tests = unittest.TestLoader().loadTestsFromModule(module)
tests.debug()
elif len(sys.argv)==1:
module = __import__(modulename)
tests = unittest.TestLoader().loadTestsFromModule(module)
unittest.TextTestRunner(verbosity=2).run(tests)
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>
print "options: [--debug]"
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论