Skip to main content

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

unittest_monkey-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unittest_monkey-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

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

Hashes for unittest_monkey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56e8f27d635ac3a6353ff561dc3cc8b6be97bb83d094632e0d71eae9c65250b2
MD5 132c19c0b0611c2ef4a1b0c19fb5acc4
BLAKE2b-256 d33b9c9700ac71408100e03a165a1aaa125451d03e70cda5d481ce0afd598b0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for unittest_monkey-0.1.0.tar.gz:

Publisher: ci.yml on enrico-j-yang/unittest-monkey

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for unittest_monkey-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50ff74b567f183caaa0de7c343b49928b9858eec1ab1c8aeb449800f283faf8d
MD5 6ebaba0d6a233dfc45738a75cfe534c5
BLAKE2b-256 90ecd0cfa69c3e8ae35250777514e1c865027c56945bf51016cb4b4867e864e5

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page