Code

Ticket #8754: 8754_run_test_aggressive.diff

File 8754_run_test_aggressive.diff, 1.8 KB (added by Richard Davies <richard.davies@…>, 5 years ago)

Alternative more aggressive patch if we believe []

Line 
1Index: tests/regressiontests/admin_scripts/tests.py
2===================================================================
3--- tests/regressiontests/admin_scripts/tests.py        (revision 10650)
4+++ tests/regressiontests/admin_scripts/tests.py        (working copy)
5@@ -55,23 +55,10 @@
6         except OSError:
7             pass
8 
9-    def _ext_backend_path(self):
10-        """
11-        Returns the path for the external backend package, or None if no
12-        external backend is detected.
13-        """
14-        first_package_re = re.compile(r'(^[^\.]+)\.')
15-        result = first_package_re.findall(settings.DATABASE_ENGINE)
16-        if result:
17-            backend_pkg = __import__(result[0])
18-            backend_dir = os.path.dirname(backend_pkg.__file__)
19-            return os.path.dirname(backend_dir)
20-
21     def run_test(self, script, args, settings_file=None, apps=None):
22         test_dir = os.path.dirname(os.path.dirname(__file__))
23         project_dir = os.path.dirname(test_dir)
24         base_dir = os.path.dirname(project_dir)
25-        ext_backend_base_dir = self._ext_backend_path()
26 
27         # Remember the old environment
28         old_django_settings_module = os.environ.get('DJANGO_SETTINGS_MODULE', None)
29@@ -88,9 +75,10 @@
30             os.environ['DJANGO_SETTINGS_MODULE'] = settings_file
31         elif 'DJANGO_SETTINGS_MODULE' in os.environ:
32             del os.environ['DJANGO_SETTINGS_MODULE']
33-        python_path = [test_dir, base_dir]
34-        if ext_backend_base_dir:
35-            python_path.append(ext_backend_base_dir)
36+        if old_python_path:
37+            python_path = [test_dir, base_dir, old_python_path]
38+        else:
39+            python_path = [test_dir, base_dir]
40         os.environ[python_path_var_name] = os.pathsep.join(python_path)
41 
42         # Build the command line