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

xonuralp/python-grader-utils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

372 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 (by default the full, unformatted traceback is also available).

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

Grading feedback screenshot

Quickstart

Install

git clone --depth 1 https://github.com/Aalto-LeTech/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 88.3%
  • HTML 10.3%
  • CSS 1.4%