Exemple #1
0
def test_all(quiet=False,
             generate_output=False,
             stop_on_failure=False,
             start_at=0):
    if not quiet:
        print("Testing %s" % version_string)

    try:
        index = 0
        count = failed = skipped = 0
        failed_symbols = set()
        output_xml = {}
        output_tex = {}
        for tests in documentation.get_tests():
            sub_count, sub_failed, sub_skipped, symbols, index = test_tests(
                tests,
                index,
                quiet=quiet,
                stop_on_failure=stop_on_failure,
                start_at=start_at)
            if generate_output:
                create_output(tests, output_xml, output_tex)
            count += sub_count
            failed += sub_failed
            skipped += sub_skipped
            failed_symbols.update(symbols)
            if sub_failed and stop_on_failure:
                break
        builtin_count = len(builtins)
    except KeyboardInterrupt:
        print("\nAborted.\n")
        return

    if failed > 0:
        print(sep)
    print(
        "%d Tests for %d built-in symbols, %d passed, %d failed, %d skipped." %
        (count, builtin_count, count - failed - skipped, failed, skipped))
    if failed_symbols:
        if stop_on_failure:
            print("(not all tests are accounted for due to --stop-on-failure)")
        print("Failed:")
        for part, chapter, section in sorted(failed_symbols):
            print('  - %s in %s / %s' % (section, part, chapter))

    if failed == 0:
        print('\nOK')

        if generate_output:
            print('Save XML')
            with open_ensure_dir(settings.DOC_XML_DATA, 'wb') as output_file:
                pickle.dump(output_xml, output_file, 0)

            print('Save TEX')
            with open_ensure_dir(settings.DOC_TEX_DATA, 'wb') as output_file:
                pickle.dump(output_tex, output_file, 0)
    else:
        print('\nFAILED')
        return sys.exit(1)  # Travis-CI knows the tests have failed
Exemple #2
0
def test_all(quiet=False, generate_output=False, stop_on_failure=False,
             start_at=0):
    if not quiet:
        print("Testing %s" % version_string)

    try:
        index = 0
        count = failed = skipped = 0
        failed_symbols = set()
        output_xml = {}
        output_tex = {}
        for tests in documentation.get_tests():
            sub_count, sub_failed, sub_skipped, symbols, index = test_tests(
                tests, index, quiet=quiet, stop_on_failure=stop_on_failure,
                start_at=start_at)
            if generate_output:
                create_output(tests, output_xml, output_tex)
            count += sub_count
            failed += sub_failed
            skipped += sub_skipped
            failed_symbols.update(symbols)
            if sub_failed and stop_on_failure:
                break
        builtin_count = len(builtins)
    except KeyboardInterrupt:
        print("\nAborted.\n")
        return

    if failed > 0:
        print(sep)
    print("%d Tests for %d built-in symbols, %d passed, %d failed, %d skipped." % (
        count, builtin_count, count - failed - skipped, failed, skipped))
    if failed_symbols:
        if stop_on_failure:
            print("(not all tests are accounted for due to --stop-on-failure)")
        print("Failed:")
        for part, chapter, section in sorted(failed_symbols):
            print('  - %s in %s / %s' % (section, part, chapter))

    if failed == 0:
        print('\nOK')

        if generate_output:
            print('Save XML')
            with open_ensure_dir(settings.DOC_XML_DATA, 'wb') as output_file:
                pickle.dump(output_xml, output_file, 0)

            print('Save TEX')
            with open_ensure_dir(settings.DOC_TEX_DATA, 'wb') as output_file:
                pickle.dump(output_tex, output_file, 0)
    else:
        print('\nFAILED')
        return sys.exit(1)      # Travis-CI knows the tests have failed
Exemple #3
0
def test_all(quiet=False, generate_output=False):
    if not quiet:
        print "Testing %s" % get_version_string(False)

    try:
        index = 0
        count = failed = 0
        failed_symbols = set()
        output_xml = {}
        output_tex = {}
        for tests in documentation.get_tests():
            sub_count, sub_failed, symbols, index = test_tests(tests,
                                                               index,
                                                               quiet=quiet)
            if generate_output:
                create_output(tests, output_xml, output_tex)
            count += sub_count
            failed += sub_failed
            failed_symbols.update(symbols)
        builtin_count = len(builtins)
    except KeyboardInterrupt:
        print "\nAborted.\n"
        return

    if failed > 0:
        print '%s' % sep
    print "%d Tests for %d built-in symbols, %d passed, %d failed." % (
        count, builtin_count, count - failed, failed)
    if failed_symbols:
        print "Failed:"
        for part, chapter, section in sorted(failed_symbols):
            print '  - %s in %s / %s' % (section, part, chapter)

    if failed == 0:
        print '\nOK'

        if generate_output:
            print 'Save XML'
            with open_ensure_dir(settings.DOC_XML_DATA,
                                 'w') as output_xml_file:
                pickle.dump(output_xml, output_xml_file, 0)

            print 'Save TEX'
            with open_ensure_dir(settings.DOC_TEX_DATA,
                                 'w') as output_tex_file:
                pickle.dump(output_tex, output_tex_file, 0)
    else:
        print '\nFAILED'
        return sys.exit(1)  # Travis-CI knows the tests have failed
Exemple #4
0
def test_section(section, quiet=False):
    failed = 0
    index = 0
    print 'Testing section %s' % section
    for tests in documentation.get_tests():
        if tests.section == section or tests.section == '$' + section:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index, quiet=quiet):
                    failed += 1
        
    print ''
    if failed > 0:
        print '%d test%s failed.' % (failed, 's' if failed != 1 else '')
    else:
        print 'OK'
Exemple #5
0
def test_section(section, quiet=False):
    failed = 0
    index = 0
    print 'Testing section %s' % section
    for tests in documentation.get_tests():
        if tests.section == section or tests.section == '$' + section:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index, quiet=quiet):
                    failed += 1

    print ''
    if failed > 0:
        print '%d test%s failed.' % (failed, 's' if failed != 1 else '')
    else:
        print 'OK'
Exemple #6
0
def test_section(section, quiet=False):
    failed = 0
    index = 0
    print "Testing section %s" % section
    for tests in documentation.get_tests():
        if tests.section == section or tests.section == "$" + section:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index, quiet=quiet):
                    failed += 1

    print ""
    if failed > 0:
        print "%d test%s failed." % (failed, "s" if failed != 1 else "")
    else:
        print "OK"
Exemple #7
0
def test_symbol(symbol):
    failed = 0
    index = 0
    print 'Testing symbol %s' % symbol
    for tests in documentation.get_tests():
        if tests.section == symbol or tests.section == '$' + symbol:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index):
                    failed += 1
            break
        
    print ''
    if failed > 0:
        print '%d test%s failed.' % (failed, 's' if failed != 1 else '')
    else:
        print 'OK'
Exemple #8
0
def test_all(quiet=False, generate_output=False):
    if not quiet:
        print "Testing %s" % get_version_string(False)

    try:
        index = 0
        count = failed = 0
        failed_symbols = set()
        output_xml = {}
        output_tex = {}
        for tests in documentation.get_tests():
            sub_count, sub_failed, symbols, index = test_tests(
                tests, index, quiet=quiet)
            if generate_output:
                create_output(tests, output_xml, output_tex)
            count += sub_count
            failed += sub_failed
            failed_symbols.update(symbols)
        builtin_count = len(builtins)
    except KeyboardInterrupt:
        print "\nAborted.\n"
        return

    if failed > 0:
        print '%s' % sep
    print "%d Tests for %d built-in symbols, %d passed, %d failed." % (
        count, builtin_count, count - failed, failed)
    if failed_symbols:
        print "Failed:"
        for part, chapter, section in sorted(failed_symbols):
            print '  - %s in %s / %s' % (section, part, chapter)

    if failed == 0:
        print '\nOK'

        if generate_output:
            print 'Save XML'
            with open_ensure_dir(settings.DOC_XML_DATA, 'w') as output_file:
                pickle.dump(output_xml, output_file, 0)

            print 'Save TEX'
            with open_ensure_dir(settings.DOC_TEX_DATA, 'w') as output_file:
                pickle.dump(output_tex, output_file, 0)
    else:
        print '\nFAILED'
        return sys.exit(1)      # Travis-CI knows the tests have failed
Exemple #9
0
def test_symbol(symbol):
    failed = 0
    index = 0
    print 'Testing symbol %s' % symbol
    for tests in documentation.get_tests():
        if tests.section == symbol or tests.section == '$' + symbol:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index):
                    failed += 1
            break

    print ''
    if failed > 0:
        print '%d test%s failed.' % (failed, 's' if failed != 1 else '')
    else:
        print 'OK'
Exemple #10
0
def test_section(section, quiet=False, stop_on_failure=False):
    failed = 0
    index = 0
    print('Testing section %s' % section)
    for tests in documentation.get_tests():
        if tests.section == section or tests.section == '$' + section:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index, quiet=quiet):
                    failed += 1
                    if stop_on_failure:
                        break

    print()
    if failed > 0:
        print('%d test%s failed.' % (failed, 's' if failed != 1 else ''))
    else:
        print('OK')
Exemple #11
0
def test_section(section, quiet=False, stop_on_failure=False):
    failed = 0
    index = 0
    print('Testing section %s' % section)
    for tests in documentation.get_tests():
        if tests.section == section or tests.section == '$' + section:
            for test in tests.tests:
                index += 1
                if not test_case(test, tests, index, quiet=quiet):
                    failed += 1
                    if stop_on_failure:
                        break

    print()
    if failed > 0:
        print('%d test%s failed.' % (failed, 's' if failed != 1 else ''))
    else:
        print('OK')
Exemple #12
0
def test_section(section, quiet=False, stop_on_failure=False):
    failed = 0
    index = 0
    print("Testing section %s" % section)
    for tests in documentation.get_tests():
        if tests.section == section or tests.section == '$' + section:
            found = True
            for test in tests.tests:
                if test.ignore:
                    continue
                index += 1
                if not test_case(test, tests, index, quiet=quiet):
                    failed += 1
                    if stop_on_failure:
                        break

    print()
    if failed > 0:
        print("%d test%s failed." % (failed, "s" if failed != 1 else ""))
    else:
        print("OK")
Exemple #13
0
def test_all():
    try:
        index = 0
        count = failed = 0
        failed_symbols = set()
        output_xml = {}
        output_tex = {}
        for tests in documentation.get_tests():
            sub_count, sub_failed, symbols, index = test_tests(tests, index)
            create_output(tests, output_xml, output_tex)
            count += sub_count
            failed += sub_failed
            failed_symbols.update(symbols)
        builtin_count = len(builtins)
    except KeyboardInterrupt:
        print "\nAborted.\n"
        return

    if failed > 0:
        print '%s' % sep
    print "%d Tests for %d built-in symbols, %d passed, %d failed." % (
        count, builtin_count, count - failed, failed)
    if failed_symbols:
        print "Failed:"
        for part, chapter, section in sorted(failed_symbols):
            print '  - %s in %s / %s' % (section, part, chapter)

    if failed == 0:
        print '\nOK'

        print 'Save XML'
        with open(settings.DOC_XML_DATA, 'w') as output_xml_file:
            pickle.dump(output_xml, output_xml_file, 0)

        print 'Save TEX'
        with open(settings.DOC_TEX_DATA, 'w') as output_tex_file:
            pickle.dump(output_tex, output_tex_file, 0)
    else:
        print '\nFAILED'
Exemple #14
0
def test_all():    
    try:
        index = 0
        count = failed = 0
        failed_symbols = set()
        output_xml = {}
        output_tex = {}
        for tests in documentation.get_tests():
            sub_count, sub_failed, symbols, index = test_tests(tests, index)
            create_output(tests, output_xml, output_tex)
            count += sub_count
            failed += sub_failed
            failed_symbols.update(symbols)
        builtin_count = len(builtins)
    except KeyboardInterrupt:
        print "\nAborted.\n"
        return
        
    if failed > 0:
        print '%s' % sep
    print "%d Tests for %d built-in symbols, %d passed, %d failed." % (count, builtin_count, count - failed, failed)
    if failed_symbols:
        print "Failed:"
        for part, chapter, section in sorted(failed_symbols):
            print '  - %s in %s / %s' % (section, part, chapter)
    
    if failed == 0:
        print '\nOK'
        
        print 'Save XML'
        with open(settings.DOC_XML_DATA, 'w') as output_xml_file:
            pickle.dump(output_xml, output_xml_file, 0)
            
        print 'Save TEX'
        with open(settings.DOC_TEX_DATA, 'w') as output_tex_file:
            pickle.dump(output_tex, output_tex_file, 0)
    else:
        print '\nFAILED'