From a090cbd564c863da0143921e6218a7269ae464da Mon Sep 17 00:00:00 2001 From: Adam Novotny Date: Mon, 9 Sep 2019 19:53:00 -0400 Subject: [PATCH 1/7] Print function name in log when passing --- focstest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/focstest.py b/focstest.py index fc65205..bbc0f28 100755 --- a/focstest.py +++ b/focstest.py @@ -135,10 +135,11 @@ def run_test(code: str, expected_out: str, file: str = None): # compare strings output = matches[-2] # don't use empty final match from #quit;; for step in steps: + function = code.split()[0] method = step.__name__ result = step(output) == step(expected_out) if result is True: - logger.debug('Test passed with method {!r}'.format(method)) + logger.debug('Test {!r} passed with method {!r}'.format(function, method)) break return (result, output, method) From 78b7f052fac87779f011020d803ad223692c3f5a Mon Sep 17 00:00:00 2001 From: Adam Novotny Date: Mon, 9 Sep 2019 20:12:38 -0400 Subject: [PATCH 2/7] Add printing function on not implemented exception --- focstest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/focstest.py b/focstest.py index bbc0f28..9c2e56f 100755 --- a/focstest.py +++ b/focstest.py @@ -268,13 +268,14 @@ def format_info(kind, value): else: result, output, method = res test_str = get_test_str(test, output, expected_output) + function = test.split()[0] if result is False: - if output.lower() == 'exception: failure "not implemented".': + if output.strip().lower() == 'exception: failure "not implemented".': if args.verbose: print(colored('Unimplemented'+header_temp, 'yellow')) print(test_str) num_skipped += len(suite) - (k + 1) - print(colored('Skipped unimplemented suite {}'.format(j), 'yellow')) + print(colored('Skipped unimplemented suite {} {!r}'.format(j, function), 'yellow')) break num_failed += 1 print(colored('Failed'+header_temp, 'red')) From 75eab53a5c25042d698a05d89182ab122ece635f Mon Sep 17 00:00:00 2001 From: Adam Novotny Date: Mon, 9 Sep 2019 20:20:09 -0400 Subject: [PATCH 3/7] Remove depricated logger.warn for logger.warning --- focstest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/focstest.py b/focstest.py index 9c2e56f..772678a 100755 --- a/focstest.py +++ b/focstest.py @@ -128,7 +128,7 @@ def run_test(code: str, expected_out: str, file: str = None): outs, errs = _run_ocaml_code(command) matches = outs.split('# ')[1:] # TODO: check if this should change based on the presence of a file if len(matches) != 3 and file is not None: - logger.warn("Unable to parse ocaml output, expected 2 matches, got {}".format(len(matches))) + logger.warning("Unable to parse ocaml output, expected 2 matches, got {}".format(len(matches))) elif len(matches) != 2 and file is None: logger.error("Unable to parse ocaml output, expected 1 match, got {} ".format(len(matches))) else: From ad3fb6b0adb082528ca153139ee40b5bced7673f Mon Sep 17 00:00:00 2001 From: Adam Novotny Date: Mon, 9 Sep 2019 21:08:09 -0400 Subject: [PATCH 4/7] Skip code blocks that don't have any tests --- focstest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/focstest.py b/focstest.py index 772678a..cf6c07d 100755 --- a/focstest.py +++ b/focstest.py @@ -229,7 +229,7 @@ def format_info(kind, value): # TODO: get titles/descriptions from code blocks blocks = get_blocks(html) # parse code blocks for tests - test_suites = list(enumerate([get_tests(block) for block in blocks], 1)) # list of suites and indices (starting at 1) + test_suites = list(enumerate([get_tests(block) for block in blocks if get_tests(block)], 1)) # list of suites and indices (starting at 1) (skipping empty suites) num_tests = sum([len(suite) for j, suite in test_suites]) logger.info("Found {} test suites and {} tests total".format( len(test_suites), num_tests)) From 48a12c1bab72a46a9d874b75ba3b524957b8b76a Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 16 Sep 2019 22:39:43 -0400 Subject: [PATCH 5/7] revert BASE_URL --- focstest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/focstest.py b/focstest.py index cf6c07d..a6dc3e7 100755 --- a/focstest.py +++ b/focstest.py @@ -18,7 +18,7 @@ # default url matching -BASE_URL = "http://rpucella.net/courses/focs-fa19/" # website and path to look under +BASE_URL = "http://rpucella.net/courses/focs-fa19/homeworks/" # website and path to look under OCAML_FILE_PATTERN = "homework(\d{1,2}).ml" # pattern to pass the user-given ocaml file HTML_FILE_TEMPLATE = "homework{}.html" # template to build the html filename given a homework number From b18f5716638280ddecf3fe04a488f958ed45581b Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 16 Sep 2019 22:45:58 -0400 Subject: [PATCH 6/7] Add comments and make empty test checking better --- focstest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/focstest.py b/focstest.py index a6dc3e7..d27f069 100755 --- a/focstest.py +++ b/focstest.py @@ -135,7 +135,7 @@ def run_test(code: str, expected_out: str, file: str = None): # compare strings output = matches[-2] # don't use empty final match from #quit;; for step in steps: - function = code.split()[0] + function = code.split()[0] # grab the first word of the command (probably the function name) method = step.__name__ result = step(output) == step(expected_out) if result is True: @@ -229,7 +229,7 @@ def format_info(kind, value): # TODO: get titles/descriptions from code blocks blocks = get_blocks(html) # parse code blocks for tests - test_suites = list(enumerate([get_tests(block) for block in blocks if get_tests(block)], 1)) # list of suites and indices (starting at 1) (skipping empty suites) + test_suites = list(enumerate(filter(None, (get_tests(b) for b in blocks)), 1)) # list of suites and indices (starting at 1) (skipping empty suites) num_tests = sum([len(suite) for j, suite in test_suites]) logger.info("Found {} test suites and {} tests total".format( len(test_suites), num_tests)) From e718ec09dc4c9d652c7cb42a53bec28055110153 Mon Sep 17 00:00:00 2001 From: Evan Lloyd New-Schmidt Date: Mon, 16 Sep 2019 23:03:32 -0400 Subject: [PATCH 7/7] Update comment whitespace --- focstest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/focstest.py b/focstest.py index d27f069..e8e2794 100755 --- a/focstest.py +++ b/focstest.py @@ -135,7 +135,7 @@ def run_test(code: str, expected_out: str, file: str = None): # compare strings output = matches[-2] # don't use empty final match from #quit;; for step in steps: - function = code.split()[0] # grab the first word of the command (probably the function name) + function = code.split()[0] # grab the first word of the command (probably the function name) method = step.__name__ result = step(output) == step(expected_out) if result is True: