@@ -11,7 +11,6 @@ BASE_DIR = os.path.dirname(os.path.realpath(__file__))
11PARSERS_DIR = os.path.join(BASE_DIR, "parsers")
11PARSERS_DIR = os.path.join(BASE_DIR, "parsers")
12TEST_CASES_DIR_PATH = os.path.join(BASE_DIR, "test_parsing")
12TEST_CASES_DIR_PATH = os.path.join(BASE_DIR, "test_parsing")
13LOGS_DIR_PATH = os.path.join(BASE_DIR, "results")
13LOGS_DIR_PATH = os.path.join(BASE_DIR, "results")
14−REPORT_PATH = os.path.join(BASE_DIR, "results/parsing.html")
15LOG_FILENAME = "logs.txt"
14LOG_FILENAME = "logs.txt"
16LOG_FILE_PATH = os.path.join(LOGS_DIR_PATH, LOG_FILENAME)
15LOG_FILE_PATH = os.path.join(LOGS_DIR_PATH, LOG_FILENAME)
@@ -476,7 +475,7 @@ def f_tests_with_same_results(libs, status_for_lib_for_file):
479−def generate_report(keep_only_first_result_in_set = False):
478+def generate_report(report_path, keep_only_first_result_in_set = False):
481 (status_for_lib_for_file, libs) = f_status_for_lib_for_file(TEST_CASES_DIR_PATH, LOGS_DIR_PATH)
480 (status_for_lib_for_file, libs) = f_status_for_lib_for_file(TEST_CASES_DIR_PATH, LOGS_DIR_PATH)
@@ -484,7 +483,7 @@ def generate_report(keep_only_first_result_in_set = False):
485 tests_with_same_results = f_tests_with_same_results(libs, status_for_lib_for_file)
484 tests_with_same_results = f_tests_with_same_results(libs, status_for_lib_for_file)
487− with open(REPORT_PATH, 'w') as f:
486+ with open(report_path, 'w') as f:
489 f.write("""<!DOCTYPE html>
488 f.write("""<!DOCTYPE html>
@@ -505,7 +504,12 @@ def generate_report(keep_only_first_result_in_set = False):
505 libs = list(status_for_path_for_lib.keys())
504 libs = list(status_for_path_for_lib.keys())
506 libs.sort()
505 libs.sort()
507+ title = "JSON Parsing Tests"
508+ if keep_only_first_result_in_set:
509+ title += ", Prunned"
508− f.write("<H1>JSON Parsing Tests</H1>\n")
512+ f.write("<H1>%s</H1>\n" % title)
509 f.write('<P>Appendix to: seriot.ch <A HREF="http://www.seriot.ch/parsing_json.php">Parsing JSON is a Minefield</A> http://www.seriot.ch/parsing_json.php</P>\n')
513 f.write('<P>Appendix to: seriot.ch <A HREF="http://www.seriot.ch/parsing_json.php">Parsing JSON is a Minefield</A> http://www.seriot.ch/parsing_json.php</P>\n')
510 f.write("<PRE>%s</PRE>\n" % strftime("%Y-%m-%d %H:%M:%S"))
514 f.write("<PRE>%s</PRE>\n" % strftime("%Y-%m-%d %H:%M:%S"))
@@ -635,7 +639,7 @@ def generate_report(keep_only_first_result_in_set = False):
638− os.system("/usr/bin/open %s" % REPORT_PATH)
642+ os.system('/usr/bin/open "%s"' % report_path)
@@ -650,4 +654,5 @@ if __name__ == '__main__':
651 run_tests(restrict_to_path)
655 run_tests(restrict_to_path)
653− generate_report(keep_only_first_result_in_set = False)
657+ generate_report(os.path.join(BASE_DIR, "results/parsing.html"), keep_only_first_result_in_set = False)
658+ generate_report(os.path.join(BASE_DIR, "results/parsing_pruned.html"), keep_only_first_result_in_set = True)