File: __init__.py

package info (click to toggle)
django-haystack 3.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,512 kB
  • sloc: python: 23,577; xml: 1,708; makefile: 71; sh: 65
file content (27 lines) | stat: -rw-r--r-- 489 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
import os

test_runner = None
old_config = None

os.environ["DJANGO_SETTINGS_MODULE"] = "test_haystack.settings"


import django

django.setup()


def setup():
    global test_runner
    global old_config

    from django.test.runner import DiscoverRunner

    test_runner = DiscoverRunner()
    test_runner.setup_test_environment()
    old_config = test_runner.setup_databases()


def teardown():
    test_runner.teardown_databases(old_config)
    test_runner.teardown_test_environment()