Doctests for your shell
Project description
doctest-cli
Doctests for your shell. Run an executable, check the output.
Usage
Create a test script, say test.sh
:
# Command
>>> echo hello
# Expected output
hello
# Another command
>>> echo 'Good bye!'
Good bye!
Test it:
./doctest-cli test.sh
doctest-cli: testing test/simple.sh
------------------------------------------------------------
All 2 tests passed
Dependencies
python
Extra
Check return code:
>>> false
$?=1
Check stderr
output:
>>> echo error > /dev/stderr
! error
Custom shell:
#!/usr/local/bin/fish
>>> echo hello; and echo this is fish
hello
this is fish
Details
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'
hello
world
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
doctest-cli-0.0.1.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for doctest_cli-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9dbfe312f668ef5ec675231d0d647f661456b432089cf9fa85725b223857e71 |
|
MD5 | 09732b97807b131ffe254c3a24337d99 |
|
BLAKE2b-256 | 11270b822afd376c03a31dacda6ab00d22c8fe4704020b61a003ef5291f75599 |