123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/bin/sh
- basedir="`dirname $0`"
- subdir="mediagoblin/tests"
- [ '!' -d "$basedir/$subdir" ] && basedir="."
- if [ '!' -d "$basedir/$subdir" ]
- then
- echo "Could not find base directory" >&2
- exit 1
- fi
- if [ -x "$basedir/bin/py.test" ]; then
- export PYTEST="$basedir/bin/py.test";
- echo "Using $PYTEST";
- elif which py.test > /dev/null; then
- echo "Using py.test from \$PATH";
- export PYTEST="py.test";
- else
- echo "py.test not found. X_X";
- echo "Please install pytest e.g. with 'pip install pytest'. Exiting.";
- exit 1
- fi
- need_arg=1
- ignore_next=0
- for i in "$@"
- do
- if [ "$ignore_next" = 1 ]
- then
- ignore_next=0
- continue
- fi
- case "$i" in
- -n) ignore_next=1;;
- -*) ;;
- *) need_arg=0; break ;;
- esac
- done
- if [ "$need_arg" = 1 ]
- then
- testdir="$basedir/mediagoblin/tests"
- set -x
- exec "$PYTEST" "$@" "$testdir" --boxed
- else
- set -x
- exec "$PYTEST" "$@" --boxed
- fi
|