File: import

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 (29 lines) | stat: -rw-r--r-- 745 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# Test that the module is importable. This test has been included
# instead of the standard autodep8 test as "import haystack" requires
# that the Django settings are configured.

set -e

# Create a minimal "settings.py" file with a valid haystack config,
# and use it as the Django settings file.
cat >> $AUTOPKGTEST_TMP/settings.py <<EOF
SECRET_KEY = 'foo'
INSTALLED_APPS = [
    'haystack',
]
HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'
    }
}
EOF
export DJANGO_SETTINGS_MODULE=settings

# Attempt to import the package.
for py in $(py3versions -s) ; do
    cd "$AUTOPKGTEST_TMP" ;
    echo "Testing with $py:" ;
    $py -c "import haystack; print(haystack)" ;
done