File: import

package info (click to toggle)
python-xapian-haystack 3.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: python: 2,274; sh: 237; makefile: 4
file content (29 lines) | stat: -rw-r--r-- 749 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 importing the module
# requires that the Django settings are configured.

set -e

# Create a minimal "settings.py" file with a valid xapian-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': 'xapian_backend.XapianEngine'
    }
}
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 xapian_backend; print(xapian_backend)" ;
done