示例#1
0
    enabled_and_not_available_engine_names = filter(lambda x: not x in enabled_and_available_engine_names, enabled_engine_names)

    if args.list_engines:
        print "All:                   {}\n" \
              "Enabled:               {}\n" \
              "Available:             {}\n" \
              "Enabled and Available: {}".format(
              ", ".join(all_engine_names),
              ", ".join(enabled_engine_names),
              ", ".join(filter(lambda e: getattr(Engines, e).available(), all_engine_names)),
              ", ".join(enabled_and_available_engine_names),
        )
    else:
        if args.engine:
            engine_name = args.engine
            test_result = run_tests(md_testsuite.io_iterator(), engine_name, len(engine_name), args)
            print "\nExtensions:\n"
            test_result_extension = run_tests(md_testsuite.io_iterator_engine(engine_name),
                    engine_name, len(engine_name), args)
            print format_error_ios_and_summaries(test_result, test_result_extension)
        else:
            if disabled_by_conf:
                print "Disabled engines:              {}".format(", ".join(disabled_by_conf))
                newline = True
            if enabled_and_not_available_engine_names:
                print "Enabled engines not available: {}".format(", ".join(enabled_and_not_available_engine_names))
                newline = True
            if newline:
                print
            if enabled_and_available_engine_names:
                l = len(max(enabled_and_available_engine_names, key=len))
        enabled_engine_names)

    if args.list_engines:
        print "All:                   {}\n" \
              "Enabled:               {}\n" \
              "Available:             {}\n" \
              "Enabled and Available: {}".format(
              ", ".join(all_engine_names),
              ", ".join(enabled_engine_names),
              ", ".join(filter(lambda e: getattr(Engines, e).available(), all_engine_names)),
              ", ".join(enabled_and_available_engine_names),
        )
    else:
        if args.engine:
            engine_name = args.engine
            test_result = run_tests(md_testsuite.io_iterator(), engine_name,
                                    len(engine_name), args)
            print "\nExtensions:\n"
            test_result_extension = run_tests(
                md_testsuite.io_iterator_engine(engine_name), engine_name,
                len(engine_name), args)
            print format_error_ios_and_summaries(test_result,
                                                 test_result_extension)
        else:
            if disabled_by_conf:
                print "Disabled engines:              {}".format(
                    ", ".join(disabled_by_conf))
                newline = True
            if enabled_and_not_available_engine_names:
                print "Enabled engines not available: {}".format(
                    ", ".join(enabled_and_not_available_engine_names))
示例#3
0
output_path = u"all.tmp.md"

parser = argparse.ArgumentParser(
    description="Concatenate all input output pairs into a single file.",
    epilog=r"""The output file is: `{output_path}`. It is already gitignored.

The output format is:

    # Path

    Input

    ---

    Output

    # Path2

    ...
""" % {output_path:output_path},                   # f contains command name.
    formatter_class=argparse.RawTextHelpFormatter, # Keep newlines.
)
args = parser.parse_args()

# Clear the output path.
with open(output_path, "w") as output_file: pass
for path, input, output in itertools.chain(md_testsuite.io_iterator(),
        md_testsuite.io_iterator_all_engines()):
    with open(output_path, "a") as output_file:
        output_file.write("# {0}\n\n{1}\n\n---\n\n{2}\n\n".format(path, input, output))
示例#4
0
parser = argparse.ArgumentParser(
    description="Concatenate all input output pairs into a single file.",
    epilog=r"""The output file is: `{output_path}`. It is already gitignored.

The output format is:

    # Path

    Input

    ---

    Output

    # Path2

    ...
""" % {output_path: output_path},  # f contains command name.
    formatter_class=argparse.RawTextHelpFormatter,  # Keep newlines.
)
args = parser.parse_args()

# Clear the output path.
with open(output_path, "w") as output_file:
    pass
for path, input, output in itertools.chain(
        md_testsuite.io_iterator(), md_testsuite.io_iterator_all_engines()):
    with open(output_path, "a") as output_file:
        output_file.write("# {0}\n\n{1}\n\n---\n\n{2}\n\n".format(
            path, input, output))
示例#5
0
    ---

    Output

    # Path2

    ...
""" % {output_path:output_path},                   # f contains command name.
    formatter_class=argparse.RawTextHelpFormatter, # Keep newlines.
)
args = parser.parse_args()

# Clear the output path.
with open(output_path, "w") as output_file: pass
for path, input, output in itertools.chain(md_testsuite.io_iterator(),
        md_testsuite.io_iterator_all_engines()):
    with open(output_path, "a") as output_file:
        output_file.write("# {0}\n\n{1}\n\n---\n\n{2}\n\n".format(path, input, output))

########NEW FILE########
__FILENAME__ = md_testsuite
"""
Shared functionality.
"""

import imp
import os

# Default config values here.
config_file_noext = 'config_local'
示例#6
0
    Output

    # Path2

    ...
""" % {output_path: output_path},  # f contains command name.
    formatter_class=argparse.RawTextHelpFormatter,  # Keep newlines.
)
args = parser.parse_args()

# Clear the output path.
with open(output_path, "w") as output_file:
    pass
for path, input, output in itertools.chain(
        md_testsuite.io_iterator(), md_testsuite.io_iterator_all_engines()):
    with open(output_path, "a") as output_file:
        output_file.write("# {0}\n\n{1}\n\n---\n\n{2}\n\n".format(
            path, input, output))

########NEW FILE########
__FILENAME__ = md_testsuite
"""
Shared functionality.
"""

import imp
import os

# Default config values here.
config_file_noext = 'config_local'
    newline = False
    if disabled_by_conf:
        print "Engines disabled by configuration: {}".format(
            ", ".join(disabled_by_conf))
        newline = True
    if not_available_engine_names:
        print "Enabled engines not available:     {}".format(
            ", ".join(not_available_engine_names))
        newline = True
    if newline:
        print

        if available_engine_names:
            l = len(max(available_engine_names, key=len))
            for engine_name in available_engine_names:
                test_summarize(engine_name, md_testsuite.io_iterator(), l)
            print "\nExtensions:\n"
            for engine_name in available_engine_names:
                test_summarize(engine_name,
                               md_testsuite.io_iterator_engine(engine_name), l)
        else:
            print "No engines are enabled. Install or enable some from config_local.py"
else:
    engine_name = sys.argv[1]
    engine = getattr(Engines, engine_name)
    if engine.available():
        io_iterator = itertools.chain(
            md_testsuite.io_iterator(),
            md_testsuite.io_iterator_engine(engine_name))
        elapsed_time, total, errors = run_tests(io_iterator, engine.get_output,
                                                on_error_single, on_ok_single)
    not_available_engine_names = filter(lambda x: not x in available_engine_names, enabled_engine_names)

    newline = False
    if disabled_by_conf:
        print "Engines disabled by configuration: {}".format(", ".join(disabled_by_conf))
        newline = True
    if not_available_engine_names:
        print "Enabled engines not available:     {}".format(", ".join(not_available_engine_names))
        newline = True
    if newline:
        print

	if available_engine_names:
		l = len(max(available_engine_names, key=len))
		for engine_name in available_engine_names:
			test_summarize(engine_name, md_testsuite.io_iterator(), l)
		print "\nExtensions:\n"
		for engine_name in available_engine_names:
			test_summarize(engine_name, md_testsuite.io_iterator_engine(engine_name), l)
	else:
		print "No engines are enabled. Install or enable some from config_local.py"
else:
    engine_name = sys.argv[1]
    engine = getattr(Engines, engine_name)
    if engine.available():
        io_iterator = itertools.chain(md_testsuite.io_iterator(), md_testsuite.io_iterator_engine(engine_name))
        elapsed_time, total, errors = run_tests(io_iterator, engine.get_output, on_error_single, on_ok_single)
        labels = ["wall time", "total tests", "errors", "error percent"]
        values = [elapsed_time, total,         errors,   int(errors/float(total)*100)]
        sys.stdout.write("\n{:<{l}}{:.2f}s\n{:<{l}}{}\n{:<{l}}{}\n{:<{l}}{}%\n".format(
            *[x for t in zip(labels,values) for x in t],