本文整理匯總了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"