Skip to main content

Doctests for your shell

Project description

Build Status


Doctests for your shell. Run an executable, check the output.


Create a test script, say

# Command
>>> echo hello
# Expected output

# Another command
>>> echo 'Good bye!'
Good bye!

Test it:

doctest-cli: testing test/
All 2 tests passed


  • python


Check return code:

>>> false

Check stderr output:

>>> echo error > /dev/stderr
! error

Custom shell:

>>> echo hello; and echo this is fish
this is fish


doctest-cli uses python's Subprocess module to spawn a new shell for each command and checks it against the provided output. All the environment variables are inherited from the current session.

Whitespace (including intervening newlines) is ignored. For example, the following test should pass:

>>>printf 'hello\n\n\n\n\n\nworld'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for doctest-cli, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size doctest_cli-0.0.1-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size doctest-cli-0.0.1.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page