Ticket #8754: 8754_run_test_aggressive.diff
File 8754_run_test_aggressive.diff, 1.8 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/admin_scripts/tests.py
55 55 except OSError: 56 56 pass 57 57 58 def _ext_backend_path(self):59 """60 Returns the path for the external backend package, or None if no61 external backend is detected.62 """63 first_package_re = re.compile(r'(^[^\.]+)\.')64 result = first_package_re.findall(settings.DATABASE_ENGINE)65 if result:66 backend_pkg = __import__(result[0])67 backend_dir = os.path.dirname(backend_pkg.__file__)68 return os.path.dirname(backend_dir)69 70 58 def run_test(self, script, args, settings_file=None, apps=None): 71 59 test_dir = os.path.dirname(os.path.dirname(__file__)) 72 60 project_dir = os.path.dirname(test_dir) 73 61 base_dir = os.path.dirname(project_dir) 74 ext_backend_base_dir = self._ext_backend_path()75 62 76 63 # Remember the old environment 77 64 old_django_settings_module = os.environ.get('DJANGO_SETTINGS_MODULE', None) … … 88 75 os.environ['DJANGO_SETTINGS_MODULE'] = settings_file 89 76 elif 'DJANGO_SETTINGS_MODULE' in os.environ: 90 77 del os.environ['DJANGO_SETTINGS_MODULE'] 91 python_path = [test_dir, base_dir] 92 if ext_backend_base_dir: 93 python_path.append(ext_backend_base_dir) 78 if old_python_path: 79 python_path = [test_dir, base_dir, old_python_path] 80 else: 81 python_path = [test_dir, base_dir] 94 82 os.environ[python_path_var_name] = os.pathsep.join(python_path) 95 83 96 84 # Build the command line