Skip to content

Run unit tests to grade Python exercises and get feedback in JSON, which can be converted to HTML

License

Notifications You must be signed in to change notification settings

ihalaij1/python-grader-utils

 
 

Repository files navigation

Graderutils

Python library that handles grader test suite management, file validation and test feedback formatting. Originally developed to enable HTML feedback for programming exercise grading output for courses served on the A+ platform. The A+ platform is not required to run graderutils.

Features

  • Running unittest.TestCase tests and producing generic JSON results that may be converted into HTML.
  • Validation tasks before running tests.
  • Restricting allowed Python syntax using black- and whitelists of AST node names.
  • Formatting tracebacks and exception messages to include only essential information (the full, unformatted traceback is also available).
  • Testing input and output of a program against a model program's input and output using IOTester.

Results from examples/01_simple rendered with the default theme:

Grading feedback screenshot

Quickstart

Install

git clone --depth 1 https://github.com/apluslms/python-grader-utils.git
cd python-grader-utils
pip install .

Examples

Using graderutils_format without graderutils

Any JSON strings that validate successfully against the "Grading feedback" JSON schema can be converted to human readable form using graderutils_format.

E.g.

cat results.json | python3 -m graderutils_format.html > results.html

Outline of the grading feedback JSON contents:

Grading feedback JSON schema object diagram

About

Run unit tests to grade Python exercises and get feedback in JSON, which can be converted to HTML

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.3%
  • HTML 2.8%
  • CSS 0.9%