diff --git a/tests/runtests.py b/tests/runtests.py
index f2ea5f1..978281b 100755
a
|
b
|
|
3 | 3 | import os, sys, traceback |
4 | 4 | import unittest |
5 | 5 | |
6 | | import django.contrib as contrib |
| 6 | # tests should use the same version (as has been checked out) |
| 7 | if sys.argv: |
| 8 | script_path = os.path.dirname(sys.argv[0]) |
| 9 | django_path = os.path.abspath(os.path.join(script_path, "..")) |
| 10 | sys.path.insert(1, django_path) |
7 | 11 | |
8 | | try: |
9 | | set |
10 | | except NameError: |
11 | | from sets import Set as set # For Python 2.3 |
| 12 | import django |
| 13 | import django.contrib as contrib |
12 | 14 | |
| 15 | print "\nRunning tests against " + os.path.dirname(django.__file__) |
13 | 16 | |
14 | 17 | CONTRIB_DIR_NAME = 'django.contrib' |
15 | 18 | MODEL_TESTS_DIR_NAME = 'modeltests' |
… |
… |
if __name__ == "__main__":
|
190 | 193 | if options.settings: |
191 | 194 | os.environ['DJANGO_SETTINGS_MODULE'] = options.settings |
192 | 195 | elif "DJANGO_SETTINGS_MODULE" not in os.environ: |
193 | | parser.error("DJANGO_SETTINGS_MODULE is not set in the environment. " |
194 | | "Set it or use --settings.") |
| 196 | # since no settings have been defined, set up a test env using SQLite |
| 197 | try: |
| 198 | import sqlite3 |
| 199 | from django.conf import settings |
| 200 | settings.configure(**{ |
| 201 | 'DATABASES': { |
| 202 | 'default': { |
| 203 | 'ENGINE': 'django.db.backends.sqlite3' |
| 204 | }, |
| 205 | 'other': { |
| 206 | 'ENGINE': 'django.db.backends.sqlite3', |
| 207 | 'TEST_NAME': 'other_db' |
| 208 | } |
| 209 | }, |
| 210 | 'ROOT_URLCONF': '/', |
| 211 | }) |
| 212 | except ImportError: |
| 213 | parser.error("DJANGO_SETTINGS_MODULE is not set in the environment. " |
| 214 | "Set it or use --settings.") |
195 | 215 | django_tests(int(options.verbosity), options.interactive, options.failfast, args) |