Ticket #8754: 8754_run_test_aggressive.diff

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

Alternative more aggressive patch if we believe []

  • tests/regressiontests/admin_scripts/tests.py

     
    5555        except OSError:
    5656            pass
    5757
    58     def _ext_backend_path(self):
    59         """
    60         Returns the path for the external backend package, or None if no
    61         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 
    7058    def run_test(self, script, args, settings_file=None, apps=None):
    7159        test_dir = os.path.dirname(os.path.dirname(__file__))
    7260        project_dir = os.path.dirname(test_dir)
    7361        base_dir = os.path.dirname(project_dir)
    74         ext_backend_base_dir = self._ext_backend_path()
    7562
    7663        # Remember the old environment
    7764        old_django_settings_module = os.environ.get('DJANGO_SETTINGS_MODULE', None)
     
    8875            os.environ['DJANGO_SETTINGS_MODULE'] = settings_file
    8976        elif 'DJANGO_SETTINGS_MODULE' in os.environ:
    9077            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]
    9482        os.environ[python_path_var_name] = os.pathsep.join(python_path)
    9583
    9684        # Build the command line
Back to Top