Registry / testing / gradescope-utils

gradescope-utils

JSON →
library0.5.0pypypiunverified

Utilities for building Gradescope autograders. Current version 0.5.0, released June 2022. The library provides decorators and a JSON test runner to streamline autograder development. Low release cadence.

pip install gradescope-utils
INSTALL
IMPORT
SIG · GRADESCOPE-UTILS
G
gradescope-utils
testingpythonv0.5.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JSONTestRunner
from gradescope_utils import JSONTestRunner

Basic autograder using unittest and gradescope-utils decorators.

import unittest from gradescope_utils import JSONTestRunner from gradescope_utils.decorators import weight class TestHello(unittest.TestCase): @weight(1) def test_hello(self): self.assertEqual('hello', 'hello') if __name__ == '__main__': suite = unittest.defaultTestLoader.discover('tests') JSONTestRunner(visibility='visible').run(suite)
Debug
Known issues
gotchaThe @number decorator argument must be a string. In version 0.3.1 it was converted to string automatically, but in earlier versions you had to pass a string explicitly.
fix
Update to >=0.3.1 or pass number as a string.
affects: <0.3.1
gotchaJSONTestRunner's visibility parameter only works if the test suite top-level visibility is not overridden by individual test visibilities. Use 'visible', 'after_published', or 'hidden'.
fix
Set visibility on the runner and ensure individual tests don't override incorrectly.
affects: >=0.2.7
gotchaThe @partial_credit decorator requires you to set the score via the test case's 'score' attribute; it does not automatically compute partial credit.
fix
Inside the test method, set self.score to the desired score (float or int).
affects: >=0.3.0
gotchaThe check_submitted_files utility checks for file existence only; it does not check file content or directory structure beyond the base path.
fix
For deeper checks, implement custom validation.
affects: >=0.2.4
Upgrade
Version history
0.5.0latest on PyPI · released Oct 17, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
gradescope-utils — pip install gradescope-utils · libregistry