mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user