cli-test-helpers Latest version on PyPI

Code checks status Test suite status Python versions Software license Documentation Status

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.

Contents

Quotes

Software without (automated) tests is broken by design.

Jacob Kaplan-Moss, creator of the Django web framework

If an application has automated tests, you can safely make changes and instantly know if anything breaks.

Testing Flask Applications, The Flask project