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(harness_prefix): test_files = [] inner_html_files = [] if not os.path.exists("tests"): os.mkdir("tests") if not file_base == os.path.abspath(os.curdir): cur_dir = os.path.abspath(os.curdir) for fn in [ "testharness.js", "harness.js", "testharnessreport.js", "common.js", "test.js", "testharness.css" ]: shutil.copy(os.path.join(file_base, fn), cur_dir) 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.html5lib_test_files("tree-construction"))), itertools.izip( itertools.repeat(True), sorted( support.html5lib_test_files( os.path.join("tree-construction", "scripted"))))) for (scripted, test_file) in test_iterator: input_file_name = os.path.splitext(os.path.split(test_file)[1])[0] if scripted: input_file_name = "scripted_" + input_file_name test_data = support.TestData(test_file) test_filename, inner_html_file_name = make_tests( input_file_name, test_data, harness_prefix) 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) make_index(test_files, inner_html_files) make_manifest(test_files, inner_html_files)
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)