Ticket #6298: runtests-2.patch
File runtests-2.patch, 1.4 KB (added by , 17 years ago) |
---|
-
runtests.py
3 3 import os, sys, traceback 4 4 import unittest 5 5 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) 11 12 import django 6 13 import django.contrib as contrib 7 14 15 print "\nRunning tests against " + os.path.dirname(django.__file__) 16 8 17 try: 9 18 set 10 19 except NameError: … … 173 182 if options.settings: 174 183 os.environ['DJANGO_SETTINGS_MODULE'] = options.settings 175 184 elif "DJANGO_SETTINGS_MODULE" not in os.environ: 176 parser.error("DJANGO_SETTINGS_MODULE is not set in the environment. " 177 "Set it or use --settings.") 185 # since no settings have been defined, try setting up a test environment that uses SQLite 186 try: 187 import sqlite3 188 from django.conf import settings 189 settings.configure(DATABASE_ENGINE="sqlite3",ROOT_URLCONF="/") 190 except: 191 parser.error("DJANGO_SETTINGS_MODULE is not set in the environment. " 192 "Set it or use --settings.") 178 193 django_tests(int(options.verbosity), options.interactive, args)