A collection of parameterizable tests for automatic grading.
Project description
Generic Grader
A collection of generic tests for grading programming assignments.
This project is still in very early development. Expect breaking changes.
Installation
pip install generic-grader
Usage
-
Name the reference solution
reference.py, and place it in atestssubdirectory of the directory containing the student's code. -
Add a configuration file for the assignment in the
testssubdirectory (e.g.tests/config.py). It might look something like this:from parameterized import param from generic_grader.style import comments # Import the tests you want to use from generic_grader.utils.options import Options # Create tests by calling each test type's build method. # They should all start with the word `test_` to be discovered by unittest. # Adding a number after `test_` can be used to control the run order. # The argument is a list of `param` objects, each with an `Options` object. # See the Options class for more information on the available options. test_01_TestCommentLength = comments.build( [ param( Options( sub_module="hello_user", hint="Check the volume of comments in your code.", entries=("Tim the Enchanter",), ), ), param( Options( sub_module="hello_user", hint="Check the volume of comments in your code.", entries=("King Arthur",), ), ), ] )
-
Run the tests.
python -m unittest tests/config.py
Contributing
-
Clone the repo onto your machine.
-
HTTPS
git clone https://github.com/Purdue-EBEC/generic-grader.git
-
SSH
git clone git@github.com:Purdue-EBEC/generic-grader.git
-
-
Set up a new virtual environment in the cloned repo.
cd generic-grader python3.12 -m venv .env3.12
-
Activate the virtual environment. If you are using VS Code, there may be a pop-up to do this automatically when working from this directory.
-
Linux/macOS
source .env3.12/bin/activate
-
Windows
.env3.12\Scripts\activate
-
-
Install tesseract-ocr
-
on Linux
sudo apt install tesseract-ocr
-
on macOS
brew install tesseract
-
on Windows, download the latest installers from https://github.com/UB-Mannheim/tesseract/wiki
-
-
Install ghostscript
-
on Linux
sudo apt install ghostscript
-
on macOS
brew install ghostscript
-
on Windows, download the latest installers from https://ghostscript.com/releases/gsdnld.html
-
-
Install the package. Note that this installs the package as editable, so edits will be automatically reflected in the installed package.
pip install -e .[dev]
or
uv sync --extra dev
-
Install the pre-commit hooks.
pre-commit install -
Run the tests.
pytest
-
Make changes ...
-
Deactivate the virtual environment.
deactivate
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file generic_grader-0.1.24.tar.gz.
File metadata
- Download URL: generic_grader-0.1.24.tar.gz
- Upload date:
- Size: 144.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cc920c99222adf31ee8ece387df1a8fcac0793191684ca2ae3ff4631f01acc4
|
|
| MD5 |
9db881f172ccf9d1037a19ede9992e0d
|
|
| BLAKE2b-256 |
b88b72904bd89126299cd7b55247d9edc20a2305c0cd5bd295a9ba7239ff24e7
|
File details
Details for the file generic_grader-0.1.24-py3-none-any.whl.
File metadata
- Download URL: generic_grader-0.1.24-py3-none-any.whl
- Upload date:
- Size: 70.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
874536ddde1306d54c4dd8517431296f42227c64066dbc54065e84dff5113cce
|
|
| MD5 |
86579dfc98b57ce0420b3b7ac31a6d21
|
|
| BLAKE2b-256 |
d1e37ee3f7b3bcb0aa4dfdb8fca55b9d63048f41815fe4e29149b2607440131f
|