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.
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 unittest_monkey-0.1.0.tar.gz.
File metadata
- Download URL: unittest_monkey-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e8f27d635ac3a6353ff561dc3cc8b6be97bb83d094632e0d71eae9c65250b2
|
|
| MD5 |
132c19c0b0611c2ef4a1b0c19fb5acc4
|
|
| BLAKE2b-256 |
d33b9c9700ac71408100e03a165a1aaa125451d03e70cda5d481ce0afd598b0c
|
Provenance
The following attestation bundles were made for unittest_monkey-0.1.0.tar.gz:
Publisher:
ci.yml on enrico-j-yang/unittest-monkey
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unittest_monkey-0.1.0.tar.gz -
Subject digest:
56e8f27d635ac3a6353ff561dc3cc8b6be97bb83d094632e0d71eae9c65250b2 - Sigstore transparency entry: 2299551350
- Sigstore integration time:
-
Permalink:
enrico-j-yang/unittest-monkey@309de0a25f1742f821b5c64fc721d52deb98d445 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/enrico-j-yang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@309de0a25f1742f821b5c64fc721d52deb98d445 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unittest_monkey-0.1.0-py3-none-any.whl.
File metadata
- Download URL: unittest_monkey-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ff74b567f183caaa0de7c343b49928b9858eec1ab1c8aeb449800f283faf8d
|
|
| MD5 |
6ebaba0d6a233dfc45738a75cfe534c5
|
|
| BLAKE2b-256 |
90ecd0cfa69c3e8ae35250777514e1c865027c56945bf51016cb4b4867e864e5
|
Provenance
The following attestation bundles were made for unittest_monkey-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on enrico-j-yang/unittest-monkey
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unittest_monkey-0.1.0-py3-none-any.whl -
Subject digest:
50ff74b567f183caaa0de7c343b49928b9858eec1ab1c8aeb449800f283faf8d - Sigstore transparency entry: 2299551356
- Sigstore integration time:
-
Permalink:
enrico-j-yang/unittest-monkey@309de0a25f1742f821b5c64fc721d52deb98d445 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/enrico-j-yang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@309de0a25f1742f821b5c64fc721d52deb98d445 -
Trigger Event:
push
-
Statement type: