-if [ -f ./bin/nosetests ]; then
- echo "Using ./bin/nosetests";
- export NOSETESTS="./bin/nosetests";
-elif which nosetests > /dev/null; then
- echo "Using nosetests from \$PATH";
- export NOSETESTS="nosetests";
+basedir="`dirname $0`"
+# Directory to seaerch for:
+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";