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 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):
self.name = self.__class__.__name__
self._correct_answer_payload = correct_answer_payload
self.question = None
self.question = question
# self.a = "not set"
super().__init__(*args, **kwargs)
......@@ -124,10 +124,6 @@ class QItem(unittest.TestCase):
print(f"Element-wise differences {diff.tolist()}")
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):
return self._precomputed_payload
......
......@@ -136,12 +136,21 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa
cc = None
if show_progress_bar:
# cc.start()
cc = ActiveProgress(t=q.estimated_time, title=q_title_print)
from unitgrade import Capturing
#eval('from unitgrade import Capturing')
with eval('Capturing')(unmute=unmute): # Clunky import syntax is required bc. of minify issue.
q.init() # Initialize the question. Useful for sharing resources.
with eval('Capturing')(unmute=unmute): # Clunky import syntax is required bc. of minify issue.
try:
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:
cc.terminate()
sys.stdout.flush()
......
__version__ = "0.1.4"
\ No newline at end of file
__version__ = "0.1.5"
\ 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