<s> from __future__ import absolute_import , unicode_literals <EOL> import os <EOL> test_runner = None <EOL> old_config = None <EOL> os . environ [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> import django <EOL> if hasattr ( django , "<STR_LIT>" ) : <EOL> django . setup ( ) <EOL> def _geospatial_support ( ) : <EOL> try : <EOL> import geopy <EOL> from haystack . utils . geo import Point <EOL> except ImportError : <EOL> return False <EOL> else : <EOL> return True <EOL> geospatial_support = _geospatial_support ( ) <EOL> def setup ( ) : <EOL> global test_runner <EOL> global old_config <EOL> try : <EOL> from django . test . runner import DiscoverRunner <EOL> test_runner = DiscoverRunner ( ) <EOL> except ImportError : <EOL> from django . test . simple import DjangoTestSuiteRunner <EOL> test_runner = DjangoTestSuiteRunner ( ) <EOL> test_runner . setup_test_environment ( ) <EOL> old_config = test_runner . setup_databases ( ) <EOL> def teardown ( ) : <EOL> test_runner . teardown_databases ( old_config ) <EOL> test_runner . teardown_test_environment ( ) </s>
