Example #1
0
def main():

    script_dir, out_dir = get_paths()

    test_files = []
    inner_html_files = []

    if len(sys.argv) > 2:
        test_iterator = itertools.izip(
            itertools.repeat(False),
            sorted(
                os.path.abspath(item)
                for item in glob.glob(os.path.join(sys.argv[2], "*.dat"))))
    else:
        test_iterator = itertools.chain(
            itertools.izip(itertools.repeat(False),
                           sorted(
                               support.get_data_files("tree-construction"))),
            itertools.izip(
                itertools.repeat(True),
                sorted(
                    support.get_data_files(
                        os.path.join("tree-construction", "scripted")))))

    for (scripted, test_file) in test_iterator:
        input_file_name = os.path.splitext(os.path.basename(test_file))[0]
        if scripted:
            input_file_name = "scripted_" + input_file_name
        test_data = support.TestData(test_file)
        test_filename, inner_html_file_name = make_tests(
            script_dir, out_dir, input_file_name, test_data)
        if test_filename is not None:
            test_files.append(test_filename)
        if inner_html_file_name is not None:
            inner_html_files.append(inner_html_file_name)
def main():
    script_dir, out_dir = get_paths()

    test_files = []
    inner_html_files = []
    with open(os.path.join(script_dir, "html5lib_revision"), "r") as f:
        html5lib_rev = f.read().strip()

    with Html5libInstall(html5lib_rev):
        from html5lib.tests import support

        if len(sys.argv) > 2:
            test_iterator = zip(
                itertools.repeat(False),
                sorted(
                    os.path.abspath(item)
                    for item in glob.glob(os.path.join(sys.argv[2], "*.dat"))))
        else:
            test_iterator = itertools.chain(
                zip(itertools.repeat(False),
                    sorted(support.get_data_files("tree-construction"))),
                zip(
                    itertools.repeat(True),
                    sorted(
                        support.get_data_files(
                            os.path.join("tree-construction", "scripted")))))

        for (scripted, test_file) in test_iterator:
            input_file_name = os.path.splitext(os.path.basename(test_file))[0]
            if scripted:
                input_file_name = "scripted_" + input_file_name
            test_data = support.TestData(test_file)
            test_filename, inner_html_file_name = make_tests(
                script_dir, out_dir, input_file_name, test_data)
            if test_filename is not None:
                test_files.append(test_filename)
            if inner_html_file_name is not None:
                inner_html_files.append(inner_html_file_name)