Last active
May 8, 2019 10:42
-
-
Save konradkonrad/7411fbb1ab0942d8495873dc2cc6b679 to your computer and use it in GitHub Desktop.
run tests and show coverage report html for raiden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# pytest executable | |
PYTEST=${PYTEST:-$(which pytest)} | |
# specify non temp output directory | |
OUT_DIR=${OUT_DIR:-$(mktemp -d)} | |
# which tests to execute | |
SUITE=${SUITE:-raiden/tests/unit raiden/tests/fuzz} | |
# report only these files | |
ONLY=${ONLY:-*} | |
# open specific file | |
SHOW=${SHOW:-index.html} | |
# example: | |
## ONLY=raiden/transfer/node.py SHOW=raiden_transfer_node_py.html test_and_report.sh | |
if [[ "$ONLY" = "*" ]]; | |
then | |
SHOW=${SHOW:-index.html} | |
else | |
SHOW=$(python -c "import sys; print(sys.argv[1].replace('/', '_').replace('.', '_') + '.html')" $ONLY) | |
fi | |
mkdir -p $OUT_DIR | |
rm .coverage | |
coverage run $PYTEST -x $SUITE && coverage html -d $OUT_DIR --include=$ONLY && xdg-open $OUT_DIR/$SHOW |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment