Skip to content

Commit 04f2400

Browse files
committed
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 django-haystack#683
2 parents 68a0b87 + c000f8a commit 04f2400

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

tests/run_all_tests.sh

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
if [ "$1" == "--help" ]; then
4+
echo "Runs the test suite for all backends"
5+
echo
6+
echo "See docs/running_tests.rst for instructions on installing test"
7+
echo "search engine instances"
8+
echo
9+
echo "Use $0 --with-coverage to execute tests using coverage.py"
10+
echo
11+
exit 0
12+
elif [ "$1" == "--with-coverage" ]; then
13+
TEST_RUNNER="coverage run --source=$(realpath "$(dirname "$0")/../haystack") -- `which django-admin.py`"
14+
else
15+
TEST_RUNNER=django-admin.py
16+
fi
17+
218
echo "** CORE **"
3-
django-admin.py test core --settings=settings
19+
$TEST_RUNNER test core --settings=settings
420
echo ""
521

622
echo "** DISCOVERY **"
7-
django-admin.py test discovery --settings=discovery_settings
23+
$TEST_RUNNER test discovery --settings=discovery_settings
824
echo ""
925

1026
echo "** OVERRIDES **"
11-
django-admin.py test overrides --settings=overrides_settings
27+
$TEST_RUNNER test overrides --settings=overrides_settings
1228
echo ""
1329

1430
echo "** SIMPLE **"
15-
django-admin.py test simple_tests --settings=simple_settings
31+
$TEST_RUNNER test simple_tests --settings=simple_settings
1632
echo ""
1733

1834
echo "** SOLR **"
19-
django-admin.py test solr_tests --settings=solr_settings
35+
$TEST_RUNNER test solr_tests --settings=solr_settings
2036
echo ""
2137

2238
echo "** Elasticsearch **"
23-
django-admin.py test elasticsearch_tests --settings=elasticsearch_settings
39+
$TEST_RUNNER test elasticsearch_tests --settings=elasticsearch_settings
2440
echo ""
2541

2642
echo "** WHOOSH **"
27-
django-admin.py test whoosh_tests --settings=whoosh_settings
43+
$TEST_RUNNER test whoosh_tests --settings=whoosh_settings
2844
echo ""
2945

3046
echo "** MULTIPLE INDEX **"
31-
django-admin.py test multipleindex --settings=multipleindex_settings
47+
$TEST_RUNNER test multipleindex --settings=multipleindex_settings
3248
echo ""
3349

3450
echo "** SPATIAL **"
35-
django-admin.py test spatial --settings=spatial_settings
51+
$TEST_RUNNER test spatial --settings=spatial_settings
3652
echo ""

0 commit comments

Comments
 (0)