Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Tools for automated grading of python assignments.

Project description

# is a testing framework that aids in grading python assignments. gracefully handles exceptions and offers error carried forward support.

This package differs from standard testing frameworks in two major ways. First, it relies on a correct implementation of the module, making test scripts quick to write and enabling error carried forward. Second, it is designed to identify graded quality of performance, rather than giving binary PASS/FAIL judgements.

## Usage

As an end user (i.e. a grader), usage is simple:

$ path/to/student/

For example, one could test all the python modules in a directory of student submissions with the command: ` students/*/*.py`. Of course, this will only work if testing scripts have been appropriately registered by the lead grader.

## Writing test scripts

Writing a test script comes in two phases:

1. Correctly implement the assigned module specification.
2. Write a test suite with functions that generate output using the module.

### Example test function

def test_foo(module):
for i in range(10):
yield Check('foo({i})', note='good effort')

This function might generate the following output:

foo(0) should be 0, but student code raised an exception:
File "flc37/", line 15, in foo
return 1.0 / x
ZeroDivisionError: integer division or modulo by zero
Note: good effort

foo(5) should be 5, but it is 5.0
Note: good effort

You can find a more complete example in `example/`, which includes two "student submisions" along with an example grading package and detailed commentary.

To create a new test, first copy the boilerplate from `test/grade_template/`. A package in the `tests/` directory that follows the naming convention `grade_MODULE/` will be used to grade any module with the name `MODULE`. Putting the module in this directory makes it visible to the command line tool.

## Distributing test scripts

We are still in the process of developing a generalized distribution strategy. At present, the best option is fork this repository and add scripts directly into the repository. Then update the name of the package and upload it to PyPI so that graders can easily download and update the package using e.g. `$ pip install cs1110grading`

Project details

Release history Release notifications

This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
gradepy-0.3.tar.gz (7.4 kB) Copy SHA256 hash SHA256 Source None Feb 4, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page