The simplest way to get up and running with Haystack’s tests is to run:
python setup.py test
This installs all of the backend libraries & all dependencies for getting the tests going and runs the tests. You will still have to setup search servers (for running Solr tests, the spatial Solr tests & the Elasticsearch tests).
If you’d rather not run all the tests, run only the backends you need since tests for backends that are not running will be skipped.
Haystack is maintained with all tests passing at all times, so if you
receive any errors during testing, please check your setup and file a report if
the errors persist.
To run just a portion of the tests you can use the script
just specify the files or directories you wish to run, for example:
python test_haystack/run_tests.py whoosh_tests test_loading.py
run_tests.py script is just a tiny wrapper around the Django test
command and any options you pass to it will be passed on; including
to get a list of possible options:
python test_haystack/run_tests.py --help
Haystack assumes that you have a Solr server running on port
uses the schema and configuration provided in the
test_haystack/solr_tests/server/ directory. For convenience, a script is
provided which will download, configure and start a test Solr server:
If no server is found all solr-related tests will be skipped.
The test suite will try to connect to Elasticsearch on port
9200. If no
server is found all elasticsearch tests will be skipped. Note that the tests
are destructive - during the teardown phase they will wipe the cluster clean so
make sure you don’t run them against an instance with data you wish to keep.
If you want to run the geo-django tests you may need to review the GeoDjango GEOS and GDAL settings before running these commands: