Created
April 16, 2018 03:56
-
-
Save BARJ/e2744bfb60f858b0ada33e67fbc6e78f to your computer and use it in GitHub Desktop.
pre-commit hook that runs pytest
This file contains 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
#!/bin/sh | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
test_results=$(script -q /dev/null pipenv run python -m pytest ./test -v --tb=no) | |
if [ $? -eq 1 ]; then | |
printf "${RED}CANNOT COMMIT, PYTEST FAILED\n\nPYTEST RESULTS:\n" | |
echo "$test_results" | |
exit 1 | |
fi | |
# NO ERRORS | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with poetry?