MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / run

Function run

tests/helper.py:53–84  ·  view source on GitHub ↗
(data, run_code=True)

Source from the content-addressed store, hash-verified

51
52
53def run(data, run_code=True):
54 pec = data.get("DC_PEC", "")
55 stu_code = data.get("DC_CODE", "")
56 sol_code = data.get("DC_SOLUTION", "")
57 sct = data.get("DC_SCT", "")
58 force_diagnose = data.get("DC_FORCE_DIAGNOSE", False)
59
60 with in_temp_dir():
61 if run_code:
62 sol_process, stu_process, raw_stu_output, error = run_exercise(
63 pec, sol_code, stu_code
64 )
65 else:
66 raw_stu_output = ""
67 stu_process = StubProcess() # WorkerProcess()
68 sol_process = StubProcess() # WorkerProcess()
69 error = None
70
71 res = test_exercise(
72 sct=sct,
73 student_code=stu_code,
74 solution_code=sol_code,
75 pre_exercise_code=pec,
76 student_process=stu_process,
77 solution_process=sol_process,
78 raw_student_output=raw_stu_output,
79 ex_type="NormalExercise",
80 force_diagnose=force_diagnose,
81 error=error,
82 )
83
84 return res
85
86
87def get_sct_payload(output):

Callers

nothing calls this directly

Calls 4

run_exerciseFunction · 0.90
StubProcessClass · 0.90
test_exerciseFunction · 0.90
in_temp_dirFunction · 0.85

Tested by

no test coverage detected