summaryrefslogtreecommitdiff
path: root/django/test/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/test/utils.py')
-rw-r--r--django/test/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/django/test/utils.py b/django/test/utils.py
index 69bd25bc12..29babec3ff 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -65,3 +65,14 @@ def teardown_test_environment():
del mail.outbox
+
+def get_runner(settings):
+ test_path = settings.TEST_RUNNER.split('.')
+ # Allow for Python 2.5 relative paths
+ if len(test_path) > 1:
+ test_module_name = '.'.join(test_path[:-1])
+ else:
+ test_module_name = '.'
+ test_module = __import__(test_module_name, {}, {}, test_path[-1])
+ test_runner = getattr(test_module, test_path[-1])
+ return test_runner