Permalink
Browse files

Tests: command-line help and coverage.py support

This makes run_all_tests.sh a little easier to use and simplifies the process of
running under coverage.py

Closes #683
  • Loading branch information...
2 parents 68a0b87 + c000f8a commit 04f24009fb390bf6fe6735ceba0c52e311eff868 @acdha acdha committed Nov 25, 2012
Showing with 26 additions and 10 deletions.
  1. +26 −10 tests/run_all_tests.sh
@@ -1,36 +1,52 @@
-#!/bin/sh
+#!/bin/bash
+
+if [ "$1" == "--help" ]; then
+ echo "Runs the test suite for all backends"
+ echo
+ echo "See docs/running_tests.rst for instructions on installing test"
+ echo "search engine instances"
+ echo
+ echo "Use $0 --with-coverage to execute tests using coverage.py"
+ echo
+ exit 0
+elif [ "$1" == "--with-coverage" ]; then
+ TEST_RUNNER="coverage run --source=$(realpath "$(dirname "$0")/../haystack") -- `which django-admin.py`"
+else
+ TEST_RUNNER=django-admin.py
+fi
+
echo "** CORE **"
-django-admin.py test core --settings=settings
+$TEST_RUNNER test core --settings=settings
echo ""
echo "** DISCOVERY **"
-django-admin.py test discovery --settings=discovery_settings
+$TEST_RUNNER test discovery --settings=discovery_settings
echo ""
echo "** OVERRIDES **"
-django-admin.py test overrides --settings=overrides_settings
+$TEST_RUNNER test overrides --settings=overrides_settings
echo ""
echo "** SIMPLE **"
-django-admin.py test simple_tests --settings=simple_settings
+$TEST_RUNNER test simple_tests --settings=simple_settings
echo ""
echo "** SOLR **"
-django-admin.py test solr_tests --settings=solr_settings
+$TEST_RUNNER test solr_tests --settings=solr_settings
echo ""
echo "** Elasticsearch **"
-django-admin.py test elasticsearch_tests --settings=elasticsearch_settings
+$TEST_RUNNER test elasticsearch_tests --settings=elasticsearch_settings
echo ""
echo "** WHOOSH **"
-django-admin.py test whoosh_tests --settings=whoosh_settings
+$TEST_RUNNER test whoosh_tests --settings=whoosh_settings
echo ""
echo "** MULTIPLE INDEX **"
-django-admin.py test multipleindex --settings=multipleindex_settings
+$TEST_RUNNER test multipleindex --settings=multipleindex_settings
echo ""
echo "** SPATIAL **"
-django-admin.py test spatial --settings=spatial_settings
+$TEST_RUNNER test spatial --settings=spatial_settings
echo ""

0 comments on commit 04f2400

Please sign in to comment.