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

Fixed stupid issue relating to initialization of questions causing test failure

parent 52c25ef5
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -87,7 +87,7 @@ class QItem(unittest.TestCase): ...@@ -87,7 +87,7 @@ class QItem(unittest.TestCase):
self.name = self.__class__.__name__ self.name = self.__class__.__name__
self._correct_answer_payload = correct_answer_payload self._correct_answer_payload = correct_answer_payload
self.question = None self.question = question
# self.a = "not set" # self.a = "not set"
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
...@@ -124,10 +124,6 @@ class QItem(unittest.TestCase): ...@@ -124,10 +124,6 @@ class QItem(unittest.TestCase):
print(f"Element-wise differences {diff.tolist()}") print(f"Element-wise differences {diff.tolist()}")
self.assertEqual(computed, expected, msg=f"Not equal within tolerance {tol}") self.assertEqual(computed, expected, msg=f"Not equal within tolerance {tol}")
# def set_precomputed_payload(self, payload):
# self.a = "blaaah"
# self._precomputed_payload = payload
def precomputed_payload(self): def precomputed_payload(self):
return self._precomputed_payload return self._precomputed_payload
......
...@@ -136,12 +136,21 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa ...@@ -136,12 +136,21 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa
cc = None cc = None
if show_progress_bar: if show_progress_bar:
# cc.start()
cc = ActiveProgress(t=q.estimated_time, title=q_title_print) cc = ActiveProgress(t=q.estimated_time, title=q_title_print)
from unitgrade import Capturing from unitgrade import Capturing
#eval('from unitgrade import Capturing')
with eval('Capturing')(unmute=unmute): # Clunky import syntax is required bc. of minify issue. with eval('Capturing')(unmute=unmute): # Clunky import syntax is required bc. of minify issue.
try:
q.init() # Initialize the question. Useful for sharing resources. q.init() # Initialize the question. Useful for sharing resources.
except Exception as e:
if not passall:
if not silent:
print(" ")
print("="*30)
print(f"When initializing question {q.title} the initialization code threw an error")
print(e)
print("The remaining parts of this question will likely fail.")
print("="*30)
if show_progress_bar: if show_progress_bar:
cc.terminate() cc.terminate()
sys.stdout.flush() sys.stdout.flush()
......
__version__ = "0.1.4" __version__ = "0.1.5"
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment