Use CodeRunner only to check for syntaxerrors without testcase validation

Re: Use CodeRunner only to check for syntaxerrors without testcase validation

by Richard Lobb -
Number of replies: 0

You probably want a template with just a couple of lines like

answer = """{{ STUDENT_ANSWER | e('py') }}"""
compile(answer, '<string>', 'exec')

But you'll still need to set up a test case with empty expected output and a dummy 'testcode' (perhaps just a comment to say the code is being checked).

A nicer approach would be to use a combinator template grader, which doesn't require any test cases and doesn't need to generate a result table. But that's way harder.

You might also want to consider more-advanced checking than just "does it compile?". See the python3_pylint question type, introduced in the documentation here.