Created
March 9, 2023 17:29
-
-
Save mfurquimdev/74d8d28d50f959362d3b01820dc596b4 to your computer and use it in GitHub Desktop.
Run unit pytests upon change on python files
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/bash | |
pipenv run pytest -s -vv --failed-first -x --cov-report term-missing --cov=. tests |
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/bash | |
ppid=$$ | |
function watch_file { | |
inotifywait -qm -r */ -e close_write --exclude ".*.pyc|.coverage|.pytest_cache|.mypy_cache" | while read -r path event filename; | |
do | |
echo -e "\033[1;7;37m$path$filename was $event\033[0;1;0m" | |
kill -s SIGUSR1 $ppid | |
done | |
} | |
watch_file & notify_pid="$!" | |
trap "{ kill --verbose -s SIGKILL -- $notify_pid $ppid; exit 255; }" SIGINT SIGTERM | |
trap "{ ./execute.sh; }" SIGUSR1 | |
while :; | |
do | |
echo -n "." | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment