Skip to content
Snippets Groups Projects
Commit 877a8e0d authored by Tue Herlau's avatar Tue Herlau
Browse files

updates

parent e9d40fc9
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
...@@ -69,11 +69,16 @@ class Capturing(list): ...@@ -69,11 +69,16 @@ class Capturing(list):
class QItem(unittest.TestCase): class QItem(unittest.TestCase):
title = None title = None
testfun = unittest.TestCase.assertEqual testfun = None
tol = 0 tol = 0
_computed_answer = None # Internal helper to later get results. _computed_answer = None # Internal helper to later get results.
def __init__(self, working_directory=None, correct_answer_payload=None, *args, **kwargs): def __init__(self, working_directory=None, correct_answer_payload=None, *args, **kwargs):
if self.tol > 0 and self.testfun is None:
self.testfun = self.assertL2Relative
else:
self.testfun = unittest.TestCase.assertEqual
self.name = self.__class__.__name__ self.name = self.__class__.__name__
self._correct_answer_payload = correct_answer_payload self._correct_answer_payload = correct_answer_payload
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
......
...@@ -46,7 +46,7 @@ parser.add_argument('--passall', action="store_true", help='Automatically pass ...@@ -46,7 +46,7 @@ parser.add_argument('--passall', action="store_true", help='Automatically pass
# const=sum, default=max, # const=sum, default=max,
# help='sum the integers (default: find the max)') # help='sum the integers (default: find the max)')
def evaluate_report_student(report, question=None, qitem=None, unmute=None, passall=None): def evaluate_report_student(report, question=None, qitem=None, unmute=None, passall=None, ignore_missing_file=False):
args = parser.parse_args() args = parser.parse_args()
if question is None and args.q is not None: if question is None and args.q is not None:
question = args.q question = args.q
...@@ -54,7 +54,8 @@ def evaluate_report_student(report, question=None, qitem=None, unmute=None, pass ...@@ -54,7 +54,8 @@ def evaluate_report_student(report, question=None, qitem=None, unmute=None, pass
question, qitem = [int(v) for v in question.split(".")] question, qitem = [int(v) for v in question.split(".")]
else: else:
question = int(question) question = int(question)
if not os.path.isfile(report.computed_answers_file):
if not os.path.isfile(report.computed_answers_file) and not ignore_missing_file:
raise Exception("> Error: The pre-computed answer file", os.path.abspath(report.computed_answers_file), "does not exist. Check your package installation") raise Exception("> Error: The pre-computed answer file", os.path.abspath(report.computed_answers_file), "does not exist. Check your package installation")
if unmute is None: if unmute is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment