Created
November 8, 2018 12:21
-
-
Save erayerdin/af80bf5312fc0e25c8584db4befd5b11 to your computer and use it in GitHub Desktop.
Pre-commit for Git especially for the stack which uses Python, Nose and Pycodestyle (formerly known as PEP8)
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/bash | |
export exit_code="0" | |
# if you want to start a dummy flask server | |
# export FLASK_APP="server.py" | |
# flask run --port 2333 --no-debugger --no-reload > /dev/null 2>&1 & | |
# I didn't find requests-mock practical, so written my own server instead | |
# what above does is it starts a server, puts it into background, redirects all output to /dev/null | |
pycodestyle tests/ yourpackage/ setup.py | |
exit_code=$(($exit_code+$?)) | |
nosetests | |
exit_code=$(($exit_code+$?)) | |
# kill your bg jobs | |
# kill $(jobs -p) | |
exit $exit_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment