def test_exercise(sct, student_code, student_result, student_conn, solution_code, solution_result, solution_conn, pre_exercise_code, ex_type, error, debug = False # currently unused ): """ """ # TODO: put reporter on state state = State( student_code = student_code, solution_code = solution_code, pre_exercise_code = pre_exercise_code, student_conn = student_conn, solution_conn = solution_conn, student_result = student_result, solution_result = solution_result, reporter = Reporter(error)) SCT_CTX['Ex'].root_state = state try: exec(sct, SCT_CTX) except TestFail: pass return(state.reporter.build_payload())
def test_exercise(sct, student_code, student_result, student_conn, solution_code, solution_result, solution_conn, pre_exercise_code, ex_type, error, force_diagnose = False, debug = False # currently unused ): """ """ state = State( student_code = student_code, solution_code = solution_code, pre_exercise_code = pre_exercise_code, student_conn = student_conn, solution_conn = solution_conn, student_result = student_result, solution_result = solution_result, reporter = Reporter(error), force_diagnose = force_diagnose) SCT_CTX['Ex'].root_state = state try: exec(sct, SCT_CTX) except TestFail as tf: return tf.payload return state.reporter.build_final_payload()
def state(): return State(student_code="echo a $b ${c}", solution_code="echo a $b ${c} unique", pre_exercise_code="", student_conn=None, solution_conn=None, student_result="", solution_result="", reporter=Reporter())
def state(): return State(student_code="some code\x1b[39;49m", solution_code="some code", pre_exercise_code="", student_conn=replwrap.bash(), solution_conn=None, student_result="stdout stuff", solution_result=None, reporter=Reporter())
def prepare_state(student_code=''): s = State(student_code=student_code, solution_code="", reporter=Reporter(), pre_exercise_code="", student_result=None, solution_result=None, student_conn=None, solution_conn=None) s.tc_msg = "Fail" return (s)
def state(): return State( student_code='student_code', solution_code='solution_code', reporter=Reporter(), # args below should be ignored pre_exercise_code="NA", student_result='stu_result', solution_result=None, student_conn=replwrap.bash(), solution_conn=None )