Skip to content

Instantly share code, notes, and snippets.

@florent-babylon
Created June 2, 2016 10:25
Show Gist options
  • Save florent-babylon/b2a843b82f05edb6bd3d398917ef17a7 to your computer and use it in GitHub Desktop.
Save florent-babylon/b2a843b82f05edb6bd3d398917ef17a7 to your computer and use it in GitHub Desktop.
Python TDD on steroids
# Dependencies:
# brew install terminal-notifier
# Run the tests and notifies of success or failure.
# NB - the icons are optional, remove the whole "-appIcon $path" if you don't need them.
NOTIF=/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier
python -m unittest test/test_*_model.py
if [ $? = 0 ]
then
echo "✔ All tests ok" | $NOTIF -title "Tests passing" -appIcon ~/misc/icons/ok.png
else
echo "✘ Tests failing" | $NOTIF -title "Tests failing" -appIcon ~/misc/icons/broken.png
fi
# Dependencies:
# brew install fswatch
# Watches the filesystem every .1 second on file changes and execute the tests when an event occurs
fswatch -o --event Created --event Updated --event Renamed --event Removed --exclude ".git" --latency 0.1 . | xargs -n1 ./testrunner.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment