Last active
December 10, 2015 23:41
-
-
Save josefdlange/32be51f1efa9ec28bbba to your computer and use it in GitHub Desktop.
Show an OS X Notification when tests are complete
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 | |
| # Run your tests and throw the return code into a variable. | |
| RESULT=$(python -m tests.__init__ $1) | |
| # Only if osascript exists (AKA only on OS X) | |
| if type "osascript" > /dev/null; then | |
| SUCCESS="Successful" | |
| MESSAGE="All Tests Complete" | |
| # If there were test parameters passed in via args.. | |
| if ! [ -z "$1" ]; then | |
| MESSAGE="Tests ($1) Complete."; | |
| fi | |
| # Check success (a well-behaved test runner of course exits 0 on success, non-zero on fail) | |
| if [ $TEST_RESULT -ne 0 ]; then | |
| SUCCESS="FAILED" | |
| fi | |
| osascript -e "display notification with title \"Tests $SUCCESS\" subtitle \"$MESSAGE\" sound name \"Glass\"" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment