diff options
| author | Florian Apolloner <florian@apolloner.eu> | 2013-02-26 21:04:32 +0100 |
|---|---|---|
| committer | Florian Apolloner <florian@apolloner.eu> | 2013-02-26 21:04:32 +0100 |
| commit | 33234aa8f718a4fd7a1535416cf4593414b60a13 (patch) | |
| tree | 0b3fd7285a537642efc57f8ff67bc7c7c9ee80af | |
| parent | 0fe11fca408dadcb6ff314f9f508597c064db73c (diff) | |
Fixed discovery of the Django installation during tests.
If Django was symlinked into site-packages the previous approach to discover
the tests subdirectory would fail. The revised version now always points to
the location of the source and not the import path.
| -rw-r--r-- | tests/admin_scripts/tests.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index b3d129b304..64c0105539 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -106,9 +106,12 @@ class AdminScriptTestCase(unittest.TestCase): def run_test(self, script, args, settings_file=None, apps=None): project_dir = test_dir base_dir = os.path.dirname(test_dir) - import django - django_dir = os.path.dirname(os.path.dirname(django.__file__)) - tests_dir = os.path.join(django_dir, 'tests') + # The base dir for Django's tests is one level up. + tests_dir = os.path.dirname(os.path.dirname(__file__)) + # The base dir for Django is one level above the test dir. We don't use + # `import django` to figure that out, so we don't pick up a Django + # from site-packages or similar. + django_dir = os.path.dirname(tests_dir) ext_backend_base_dirs = self._ext_backend_paths() # Remember the old environment |
