本文整理汇总了Python中test.main方法的典型用法代码示例。如果您正苦于以下问题:Python test.main方法的具体用法?Python test.main怎么用?Python test.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test
的用法示例。
在下文中一共展示了test.main方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_file
# 需要导入模块: import test [as 别名]
# 或者: from test import main [as 别名]
def process_file(fname, params=None):
if params is None:
params = ['-S', '-q']
try:
current_path = os.path.abspath(os.getcwd())
test.set_temp_dir()
test.FOUT = OutputProxy()
if os.path.dirname(fname):
os.chdir(os.path.abspath(os.path.dirname(fname)))
fname = os.path.basename(fname)
else:
os.chdir(os.path.realpath(os.path.dirname(__file__)))
test.main(params + [fname])
os.chdir(current_path)
finally:
os.rmdir(test.TEMP_DIR)
test.TEMP_DIR = None
示例2: main
# 需要导入模块: import test [as 别名]
# 或者: from test import main [as 别名]
def main():
current_path = os.path.abspath(os.getcwd())
os.chdir(os.path.realpath(os.path.dirname(__file__) or os.curdir))
result = doctest.testfile('test_errmsg.txt') # evaluates to True on failure
if not result.failed:
result = doctest.testfile('test_cmdline.txt') # Evaluates to True on failure
os.chdir(current_path)
return int(result.failed)
示例3: test_asm
# 需要导入模块: import test [as 别名]
# 或者: from test import main [as 别名]
def test_asm(fname):
options = ['-d', '-e', '/dev/null', fname]
if os.path.basename(fname).startswith('zxnext_'):
options.extend(['-O=-N'])
test.main(options)
if test.COUNTER == 0:
return
sys.stderr.write("Total: %i, Failed: %i (%3.2f%%)\n" %
(test.COUNTER, test.FAILED, 100.0 * test.FAILED / float(test.COUNTER)))
assert test.EXIT_CODE == 0, "ASM program test failed"
示例4: test_basic
# 需要导入模块: import test [as 别名]
# 或者: from test import main [as 别名]
def test_basic(fname):
test.main(['-d', '-e', '/dev/null', fname])
if test.COUNTER == 0:
return
sys.stderr.write("Total: %i, Failed: %i (%3.2f%%)\n" %
(test.COUNTER, test.FAILED, 100.0 * test.FAILED / float(test.COUNTER)))
assert test.EXIT_CODE == 0, "BASIC program test failed"
示例5: test_prepro
# 需要导入模块: import test [as 别名]
# 或者: from test import main [as 别名]
def test_prepro(fname):
test.main(['-d', '-e', '/dev/null', fname])
if test.COUNTER == 0:
return
sys.stderr.write("Total: %i, Failed: %i (%3.2f%%)\n" %
(test.COUNTER, test.FAILED, 100.0 * test.FAILED / float(test.COUNTER)))
assert test.EXIT_CODE == 0, "Preprocessor test failed"