cli-test-helpers Latest version on PyPI

Code checks status Test suite status Latest release 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) application is more difficult than it seems at first sight. Especially, when you use the argparse module or the docopt or 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 Painless Software CLI Copier template offers some guidance on how to get started, and the CLI test 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