From bd4793f1168fe3001dfd36438c6ec82a5fdd4d70 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Wed, 18 Jul 2012 09:43:26 +0200 Subject: [PATCH] Add way of running tests unfiltered. --- .travis.yml | 2 +- run_tests | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77225ce..c309558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ python: install: - pip install -r requirements.txt script: - - sh run_tests + - sh run_tests -x #notifications: # irc: # channels: "irc.freenode.org#sentry" diff --git a/run_tests b/run_tests index 162c248..50736cc 100755 --- a/run_tests +++ b/run_tests @@ -4,6 +4,12 @@ check_redis_running() { return $? } +# Quit early if Redis server isn't running +if ! check_redis_running; then + echo "Redis not running." >&2 + exit 2 +fi + if command -v rg >/dev/null; then safe_rg=rg else @@ -12,13 +18,15 @@ else fi export ONLY_RUN_FAST_TESTS=1 -if [ "$1" == '-f' ]; then # Poor man's argparse +if [ "$1" = '-f' ]; then # Poor man's argparse unset ONLY_RUN_FAST_TESTS + shift 1 fi -if check_redis_running; then - /usr/bin/env python -m unittest discover -v -s tests $@ 2>&1 | egrep -v '^test_' | $safe_rg +# For use on build server, we need exit code to be representative of success/failure +if [ "$1" = '-x' ]; then + shift 1 + /usr/bin/env python -m unittest discover -v -s tests $@ 2>&1 else - echo "Redis not running." >&2 - exit 2 + /usr/bin/env python -m unittest discover -v -s tests $@ 2>&1 | egrep -v '^test_' | $safe_rg fi