summaryrefslogtreecommitdiff
path: root/django/test/utils.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-02-28 04:46:38 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-02-28 04:46:38 +0000
commitbeb20057a30a96b74dfc309c2add47148103ba63 (patch)
tree6747be928a805729e881db9f0a380dbcc55c3a26 /django/test/utils.py
parent415ffa8df56d72bf6f114abc8fdae11d459e768d (diff)
downloaddjango-beb20057a30a96b74dfc309c2add47148103ba63.tar.gz
Fixed #10165 -- Use settings.TEST_RUNNER in runtests.py
This permits running Django's core tests under an alternative test runner. Most likely useful to non-CPython implementations, rather than much else (since Django's core tests might assume things about the test runner). Patch from Leo Soto. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
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