Really removing nosetests things now! all assert_whatever removed
[mediagoblin.git] / runtests.sh
CommitLineData
188240e3
CAW
1#!/bin/sh
2
3# GNU MediaGoblin -- federated, autonomous media hosting
7f4ebeed 4# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
188240e3
CAW
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Affero General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU Affero General Public License for more details.
15#
16# You should have received a copy of the GNU Affero General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
8b271c28
E
19basedir="`dirname $0`"
20# Directory to seaerch for:
21subdir="mediagoblin/tests"
22[ '!' -d "$basedir/$subdir" ] && basedir="."
23if [ '!' -d "$basedir/$subdir" ]
24then
25 echo "Could not find base directory" >&2
26 exit 1
27fi
28
c8196f28
CAW
29if [ -x "$basedir/bin/py.test" ]; then
30 export PYTEST="$basedir/bin/py.test";
31 echo "Using $PYTEST";
32elif which py.test > /dev/null; then
33 echo "Using py.test from \$PATH";
34 export PYTEST="py.test";
188240e3 35else
c8196f28 36 echo "py.test not found. X_X";
528c8b8f 37 echo "Please install 'nose'. Exiting.";
188240e3
CAW
38 exit 1
39fi
40
05eee632
CAW
41
42CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_tests
43export CELERY_CONFIG_MODULE
44echo "+ CELERY_CONFIG_MODULE=$CELERY_CONFIG_MODULE"
45
46# Look to see if the user has specified a specific directory/file to
47# run tests out of. If not we'll need to pass along
c8196f28 48# mediagoblin/tests/ later very specifically. Otherwise py.test
05eee632
CAW
49# will try to read all directories, and this turns into a mess!
50
7dec9f92
E
51need_arg=1
52for i in "$@"
53do
54 case "$i" in
55 -*) ;;
56 *) need_arg=0; break ;;
57 esac
58done
59
7dec9f92
E
60if [ "$need_arg" = 1 ]
61then
8b271c28
E
62 testdir="$basedir/mediagoblin/tests"
63 set -x
c8196f28 64 exec "$PYTEST" "$@" "$testdir" --boxed
7dec9f92 65else
8b271c28 66 set -x
c8196f28 67 exec "$PYTEST" "$@" --boxed
7dec9f92 68fi