unittest-monkey
unittest-monkey is a command-line monkey runner for Python's standard-library
unittest framework. It collects test cases using unittest, randomly selects
test cases with replacement, and runs the selected cases a specified number of
times.
Every execution prints its random seed. Reuse the same target, count, and seed to reproduce the same selection sequence.
Installation
pip install .
Usage
# Discover from the current directory and run 100 random test cases.
unittest-monkey --count 100
# Discover tests under a directory.
unittest-monkey tests/ --count 100
# Load tests from one Python file.
unittest-monkey tests/test_service.py --count 50
# Run a named unittest class or method.
unittest-monkey package.test_service.TestService.test_create --count 20
# Reproduce an earlier selection sequence.
unittest-monkey tests/ --count 100 --seed 1234567890
# Do not stop after the first failure and show each result.
unittest-monkey tests/ --count 100 --continue-on-fail --verbose
Options
| Option | Description |
|---|---|
test_spec |
Optional directory, Python file, or dotted unittest name. When omitted, unittest discovers tests from the current directory. |
--count COUNT |
Required number of random test-case executions. |
--seed SEED |
Optional seed. A random 10-digit seed is generated when absent. |
--continue-on-fail |
Continue after a failure rather than stopping immediately. |
--report-dir DIR |
Report directory. Defaults to ./reports. |
-v, --verbose |
Print each selected test and its outcome. |
-s, --no-capture |
Stream test stdout and stderr instead of capturing it. |
Discovery Behavior
Directory and no-target discovery delegate to unittest.TestLoader.discover,
therefore they retain unittest's native test*.py naming pattern and import
requirements. File targets are loaded directly as Python modules. Named targets
use unittest's dotted-name syntax.
Reports
Each run writes the following files to --report-dir:
report.json: machine-readable seed, summary, selection results, durations, and failure tracebacks.report.html: browser-readable execution report.
License
This project is licensed under the MIT License.
Release files for unittest-monkey 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unittest_monkey-0.1.0.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unittest_monkey-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / unittest_monkey-0.1.0.tar.gz
| Download URL | unittest_monkey-0.1.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56e8f27d635ac3a6353ff561dc3cc8b6be97bb83d094632e0d71eae9c65250b2
|
|
BLAKE2b-256 checksum How to use checksums |
d33b9c9700ac71408100e03a165a1aaa125451d03e70cda5d481ce0afd598b0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.
Transparency logRelease files / unittest_monkey-0.1.0-py3-none-any.whl
| Download URL | unittest_monkey-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50ff74b567f183caaa0de7c343b49928b9858eec1ab1c8aeb449800f283faf8d
|
|
BLAKE2b-256 checksum How to use checksums |
90ecd0cfa69c3e8ae35250777514e1c865027c56945bf51016cb4b4867e864e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.
Transparency log