Skip to content

Instantly share code, notes, and snippets.

@jbn
Last active November 8, 2017 19:22
Show Gist options
  • Save jbn/14ca7ad9f2c40216427151ac8993890d to your computer and use it in GitHub Desktop.
Save jbn/14ca7ad9f2c40216427151ac8993890d to your computer and use it in GitHub Desktop.
#!/bin/bash
###############################################################################
# setUp
###############################################################################
# Fail on first non-zero return value.
set -ev
# Ensure a pristine environment.
rm -rf cli_tests/outputs && mkdir cli_tests/outputs
###############################################################################
# 1. The first test.
###############################################################################
# Run the cli as __main__, with appending coverage.
# Capture the output as cli_tests/outputs/test_2.txt
(coverage run --source=pathsjson --append -m pathsjson.cli --shell-exports > \
cli_tests/outputs/test_2.txt) || true
# Compare the captured output to the expected output.
diff cli_tests/outputs/test_2.txt cli_tests/test_2.expected.txt
###############################################################################
# tearDown
###############################################################################
rm -rf cli_tests/outputs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment