From dd9095a196f8ce6703d3d5eb962c6498d7f23b86 Mon Sep 17 00:00:00 2001 From: Tue Herlau <tuhe@dtu.dk> Date: Fri, 3 Jun 2022 14:36:31 +0200 Subject: [PATCH] updates --- docs/mkdocs.py | 2 +- requirements.txt | 1 + src/unitgrade/framework.py | 4 +++- src/unitgrade/utils.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/mkdocs.py b/docs/mkdocs.py index aa19556..685860e 100644 --- a/docs/mkdocs.py +++ b/docs/mkdocs.py @@ -8,7 +8,7 @@ if __name__ == "__main__": bibtex = make_bibliography("../setup.py", "./") out = subprocess.check_output("python --version").decode("utf-8") - fn = unitgrade_private.__path__[0] + "/../../examples/02631/instructor/week5/report1intro.py" + fn = unitgrade_private.__path__[0] + "/../../examples/02631/instructor/week5/looping_tests.py" out = subprocess.check_output(f"cd {os.path.dirname(fn)} && python {os.path.basename(fn)} --noprogress", shell=True, encoding='utf8', errors='strict') out = out.replace("", "") diff --git a/requirements.txt b/requirements.txt index 5fcd905..577cf43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ colorama numpy scikit_learn snipper +importnb # Experimental notebook inclusion feature. May not be required. \ No newline at end of file diff --git a/src/unitgrade/framework.py b/src/unitgrade/framework.py index badb2d4..409ee18 100644 --- a/src/unitgrade/framework.py +++ b/src/unitgrade/framework.py @@ -251,6 +251,7 @@ class UTestCase(unittest.TestCase): if "def" in lines2[j] or "class" in lines2[j]: break from snipper.legacy import gcoms + fun = lines2[j] comments, _ = gcoms("\n".join(lines2[j:l])) if rel not in cc: @@ -479,7 +480,8 @@ class UTestCase(unittest.TestCase): if self._cache_contains(key): CC = self._cache_get(key) cl, m = self.cache_id() - gprint(f"> An error occured while solving: {cl}.{m}. The files/methods you need to edit are:") # For the test {id} in {file} you should edit:") + # Insert newline to get better formatting. + gprint(f"\n> An error occured during the test: {cl}.{m}. The following files/methods has code in them you are supposed to edit and may therefore be the cause of the problem:") for file in CC: rec = CC[file] gprint(f"> * {file}") diff --git a/src/unitgrade/utils.py b/src/unitgrade/utils.py index 00ea948..23442d2 100644 --- a/src/unitgrade/utils.py +++ b/src/unitgrade/utils.py @@ -13,7 +13,7 @@ _CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"]) def gprint(s): - print(f"{Fore.GREEN}{s}") + print(f"{Fore.LIGHTGREEN_EX}{s}") myround = lambda x: np.round(x) # required for obfuscation. -- GitLab