Python test.main() Examples

The following are 5 code examples of test.main(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module test , or try the search function .
Example #1
Source File: test_.py    From zxbasic with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #2
Source File: test_.py    From zxbasic with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #3
Source File: test_asm.py    From zxbasic with GNU General Public License v3.0 5 votes vote down vote up
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" 
Example #4
Source File: test_basic.py    From zxbasic with GNU General Public License v3.0 5 votes vote down vote up
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" 
Example #5
Source File: test_prepro.py    From zxbasic with GNU General Public License v3.0 5 votes vote down vote up
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"