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 -lv # list available environments
tox -e flake8,py310 # run a few environments
tox -e py # run tests with 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
Hashes for cli_test_helpers-3.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 414fa232239c6733e8843fae653b5e10bb489cf875be94e029819755194baf17 |
|
MD5 | 85b0ebd3f2a68beda5b0dd95b10f8349 |
|
BLAKE2b-256 | b2cff88f012a6587fb5d69d972fab94775f7a5233eac9faee01ead26da3187b0 |