-
-
Save dseeni/f79f68ee13083c6d710860d6bcbe7d4c to your computer and use it in GitHub Desktop.
pre-commit hook that runs pytest
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
| #!/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