Skip to content
Snippets Groups Projects
Commit 6b8b30f2 authored by tuhe's avatar tuhe
Browse files

updates

parent 228776fa
No related branches found
No related tags found
No related merge requests found
...@@ -172,7 +172,9 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa ...@@ -172,7 +172,9 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa
detail['status'] = 'error' detail['status'] = 'error'
else: else:
raise Exception("Status not known.") raise Exception("Status not known.")
detail = {**detail, **msg}#['message'] = msg
nice_title = s.title
detail = {**detail, **msg, 'nice_title': nice_title}#['message'] = msg
details[key] = detail details[key] = detail
# q_[s._testMethodName] = ("pass", None) # q_[s._testMethodName] = ("pass", None)
......
...@@ -128,8 +128,8 @@ class Report: ...@@ -128,8 +128,8 @@ class Report:
if not url.endswith("/"): if not url.endswith("/"):
url += "/" url += "/"
snapshot_file = os.path.dirname(self._file()) + "/unitgrade_data/.snapshot" snapshot_file = os.path.dirname(self._file()) + "/unitgrade_data/.snapshot"
print("Sanity checking time using snapshot", snapshot_file) # print("Sanity checking time using snapshot", snapshot_file)
print("and using self-identified file", self._file()) # print("and using self-identified file", self._file())
if os.path.isfile(snapshot_file): if os.path.isfile(snapshot_file):
with open(snapshot_file, 'r') as f: with open(snapshot_file, 'r') as f:
...@@ -140,15 +140,15 @@ class Report: ...@@ -140,15 +140,15 @@ class Report:
if self.url.startswith("https://gitlab"): if self.url.startswith("https://gitlab"):
# Try to turn url into a 'raw' format. # Try to turn url into a 'raw' format.
"https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false" # "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false"
# url = self.url # url = self.url
url = url.replace("-/tree", "-/raw") url = url.replace("-/tree", "-/raw")
print(url) # print(url)
# "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/tree/master/examples/autolab_example_py_upload/instructor/cs102_autolab" # "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/tree/master/examples/autolab_example_py_upload/instructor/cs102_autolab"
# "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/report2_test.py?inline=false" # "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/report2_test.py?inline=false"
# "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false" # "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false"
raw_url = urllib.parse.urljoin(url, os.path.basename(self._file()) + "?inline=false") raw_url = urllib.parse.urljoin(url, os.path.basename(self._file()) + "?inline=false")
print("Is this file run in local mode?", self._is_run_in_grade_mode()) # print("Is this file run in local mode?", self._is_run_in_grade_mode())
if self._is_run_in_grade_mode(): if self._is_run_in_grade_mode():
remote_source = requests.get(raw_url).text remote_source = requests.get(raw_url).text
with open(self._file(), 'r') as f: with open(self._file(), 'r') as f:
...@@ -430,12 +430,12 @@ class UTestCase(unittest.TestCase): ...@@ -430,12 +430,12 @@ class UTestCase(unittest.TestCase):
# file = inspect.getfile(self.__class__) # file = inspect.getfile(self.__class__)
import importlib, inspect import importlib, inspect
found_reports = [] found_reports = []
print("But do I have report", self._report) # print("But do I have report", self._report)
print("I think I am module", self.__module__) # print("I think I am module", self.__module__)
print("Importlib says", importlib.import_module(self.__module__)) # print("Importlib says", importlib.import_module(self.__module__))
# This will delegate you to the wrong main clsas when running in grade mode. # This will delegate you to the wrong main clsas when running in grade mode.
for name, cls in inspect.getmembers(importlib.import_module(self.__module__), inspect.isclass): for name, cls in inspect.getmembers(importlib.import_module(self.__module__), inspect.isclass):
print("checking", cls) # print("checking", cls)
if issubclass(cls, Report): if issubclass(cls, Report):
for q,_ in cls.questions: for q,_ in cls.questions:
if q == self.__class__: if q == self.__class__:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment