Skip to content

Instantly share code, notes, and snippets.

@amenasse
Last active August 29, 2015 14:02
Show Gist options
  • Save amenasse/a006dacc3fdd15d1fcde to your computer and use it in GitHub Desktop.
Save amenasse/a006dacc3fdd15d1fcde to your computer and use it in GitHub Desktop.
runs django tests when a python file in the given directory changes and play some audio if it fails
#!/bin/bash
# runs django tests when a python file in the given directory changes
# complain loudly if they fail. Only works on OSX right now
# requires fswatch: https://github.com/alandipert/fswatch
trap "exit" SIGINT
command="python manage.py test --noinput"
fswatch "$1" | while read line; do
if [[ $line =~ py$ ]]; then
${command}
[[ $? -ne 0 ]] && afplay ~/beep.wav
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment