當前位置: 首頁>>代碼示例>>Python>>正文


Python test.main方法代碼示例

本文整理匯總了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 
開發者ID:boriel,項目名稱:zxbasic,代碼行數:20,代碼來源:test_.py

示例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) 
開發者ID:boriel,項目名稱:zxbasic,代碼行數:10,代碼來源:test_.py

示例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" 
開發者ID:boriel,項目名稱:zxbasic,代碼行數:15,代碼來源:test_asm.py

示例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" 
開發者ID:boriel,項目名稱:zxbasic,代碼行數:10,代碼來源:test_basic.py

示例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" 
開發者ID:boriel,項目名稱:zxbasic,代碼行數:10,代碼來源:test_prepro.py


注:本文中的test.main方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。