[英]How to check test run results in nose2?
使用unittest
我可以检查测试运行期间是否有失败的测试,如下所示:
import unittest
all_tests = unittest.defaultTestLoader.discover('path-to-tests')
results = unittest.TextTestRunner().run(all_tests)
if results.wasSuccessful():
do_something()
else:
do_something_else()
如何对nose2
做同样的nose2
?
终于找到了答案。
import nose2
test_run = nose2.discover(argv = ['-s', 'path-to-tests'], exit = False)
if test_run.result.wasSuccessful():
do_something()
else:
do_something_else()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.