File: running_tests.rst

package info (click to toggle)
django-haystack 3.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,504 kB
  • sloc: python: 23,475; xml: 1,708; sh: 74; makefile: 71
file content (66 lines) | stat: -rw-r--r-- 2,334 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.. _ref-running-tests:

=============
Running Tests
=============

Everything
==========

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).


Cherry-Picked
=============

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 ``run_tests.py`` and
just specify the files or directories you wish to run, for example::

    python test_haystack/run_tests.py whoosh_tests test_loading.py

The ``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 ``--help``
to get a list of possible options::

    python test_haystack/run_tests.py --help

Configuring Solr
================

Haystack assumes that you have a Solr server running on port ``9001`` which
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::

    test_haystack/solr_tests/server/start-solr-test-server.sh

If no server is found all solr-related tests will be skipped.

Configuring Elasticsearch
=========================

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::

	cd test_haystack
	./run_tests.py elasticsearch_tests

.. _GeoDjango GEOS and GDAL settings: https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/geolibs/#geos-library-path