| 1 | #!/bin/sh |
| 2 | |
| 3 | # Test that the module is importable. This test has been included |
| 4 | # instead of the standard autodep8 test as "import haystack" requires |
| 5 | # that the Django settings are configured. |
| 6 | |
| 7 | set -e |
| 8 | |
| 9 | # Create a minimal "settings.py" file with a valid haystack config, |
| 10 | # and use it as the Django settings file. |
| 11 | cat >> $AUTOPKGTEST_TMP/settings.py <<EOF |
| 12 | SECRET_KEY = 'foo' |
| 13 | INSTALLED_APPS = [ |
| 14 | 'haystack', |
| 15 | ] |
| 16 | HAYSTACK_CONNECTIONS = { |
| 17 | 'default': { |
| 18 | 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine' |
| 19 | } |
| 20 | } |
| 21 | EOF |
| 22 | export DJANGO_SETTINGS_MODULE=settings |
| 23 | |
| 24 | # Attempt to import the package. |
| 25 | for py in $(py3versions -s) ; do |
| 26 | cd "$AUTOPKGTEST_TMP" ; |
| 27 | echo "Testing with $py:" ; |
| 28 | $py -c "import haystack; print(haystack)" ; |
| 29 | done |