⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.py

📁 利用C
💻 PY
字号:
"""Run all unit tests."""__author__ = "Anders Logg (logg@simula.no)"__date__ = "2006-08-09 -- 2007-08-03"__copyright__ = "Copyright (C) 2006-2007 Anders Logg"__license__  = "GNU LGPL Version 2.1"import sysfrom os import systemfrom commands import getoutputimport re# Tests to run#tests = ["function", "graph", "mesh"]tests = ["function", "mesh", "meshconvert"]# FIXME: Graph tests disabled for now since SCOTCH is now required# Run testsfailed = []for test in tests:    print "Running unit tests for %s" % test    print "----------------------------------------------------------------------"    print "C++:   ",    output = getoutput("cd %s/cpp && ./test" % test)    if "OK" in output:        num_tests = int(re.search("OK \((\d+)\)", output).groups()[0])        print "OK (%d tests)" % num_tests    else:        print "*** Failed"        failed += [(test, "C++", output)]        print "Python:",    output = getoutput("cd %s/python && python ./test.py" % test)    if "OK" in output:        num_tests = int(re.search("Ran (\d+) test", output).groups()[0])        print "OK (%d tests)" % num_tests    else:        print "*** Failed"        failed += [(test, "Python", output)]    print ""# Print output for failed testsfor (test, interface, output) in failed:    print "One or more unit tests failed for %s (%s):" % (test, interface)    print output# Return error code if tests failedsys.exit(len(failed) != 0)

⌨️ 快捷键说明

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