Useful helpers for writing tests for your Python CLI program.
Project description
Useful helpers for writing tests for your Python CLI program.
Writing tests for a command line interface (CLI) tool may not seem strictly straight-forward when you think in terms of unit tests. Especially, when you use the argparse module or the click package, control of the application entry point is a bit taken away from you.
But it’s not all that bad. This package is here to help. The examples give you some guidance on how to get started, and the helpers allow you to deal with common cases, such as mocking CLI arguments and environment variable values.
Documentation
See the documentation for installation instructions and a tutorial.
Examples
The examples folder contains hands-on example projects you can start to use directly.
Development
This project uses Tox to run its test suite. Install and use it locally like this:
python3 -m pip install tox
tox list # list available environments
tox -e ruff,py311 # run a few environments
tox -e py # run tests with local default Python
tox # run entire suite
The included example projects can be tested independently with their dedicated environments, e.g.
tox -e example-docopt
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
File details
Details for the file cli-test-helpers-4.0.0.tar.gz
.
File metadata
- Download URL: cli-test-helpers-4.0.0.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 322e23eb329d6c6f7768a69385fc1b9e8cb8dd161628fee09988a3cd97745b0e |
|
MD5 | c3ba50c1d78294489c8e0b251d26f267 |
|
BLAKE2b-256 | d23b0442cd5d45cc7f60bb74dc015d85299917c089e245f27504cd1666aaceca |
File details
Details for the file cli_test_helpers-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: cli_test_helpers-4.0.0-py3-none-any.whl
- Upload date:
- Size: 38.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ada66063f17b43cc885a647d976c2559bffe4001a4c213401fa27e77e57fcf69 |
|
MD5 | 5965b2901e38960245fd479bbc137005 |
|
BLAKE2b-256 | fc2af0fa7b5a66c8b92f57ae63433dad861b2831b711ef4a4c2b6e416ff8473c |