[1.6.x] Refs #21197 -- Clarified upgrade check message.
Thanks to Carl and Shai for the discussion.
Backport of 8ff4303
from master.
This commit is contained in:
parent
563b5c2000
commit
7f0fdffd07
|
@ -16,10 +16,8 @@ def check_test_runner():
|
||||||
|
|
||||||
if test_runner_setting == new_default:
|
if test_runner_setting == new_default:
|
||||||
message = [
|
message = [
|
||||||
"You have not explicitly set 'TEST_RUNNER'. In Django 1.6,",
|
"Django 1.6 introduced a new default test runner ('%s')" % new_default,
|
||||||
"there is a new test runner ('%s')" % new_default,
|
"You should ensure your tests are all running & behaving as expected. See",
|
||||||
"by default. You should ensure your tests are still all",
|
|
||||||
"running & behaving as expected. See",
|
|
||||||
"https://docs.djangoproject.com/en/dev/releases/1.6/#discovery-of-tests-in-any-test-module",
|
"https://docs.djangoproject.com/en/dev/releases/1.6/#discovery-of-tests-in-any-test-module",
|
||||||
"for more information.",
|
"for more information.",
|
||||||
]
|
]
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CompatChecksTestCase(TestCase):
|
||||||
def test_check_test_runner_new_default(self):
|
def test_check_test_runner_new_default(self):
|
||||||
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
|
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
|
||||||
result = django_1_6_0.check_test_runner()
|
result = django_1_6_0.check_test_runner()
|
||||||
self.assertTrue("You have not explicitly set 'TEST_RUNNER'" in result)
|
self.assertTrue("Django 1.6 introduced a new default test runner" in result)
|
||||||
|
|
||||||
def test_check_test_runner_overridden(self):
|
def test_check_test_runner_overridden(self):
|
||||||
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
|
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
|
||||||
|
@ -49,7 +49,7 @@ class CompatChecksTestCase(TestCase):
|
||||||
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
|
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
|
||||||
result = django_1_6_0.run_checks()
|
result = django_1_6_0.run_checks()
|
||||||
self.assertEqual(len(result), 1)
|
self.assertEqual(len(result), 1)
|
||||||
self.assertTrue("You have not explicitly set 'TEST_RUNNER'" in result[0])
|
self.assertTrue("Django 1.6 introduced a new default test runner" in result[0])
|
||||||
|
|
||||||
def test_run_checks_overridden(self):
|
def test_run_checks_overridden(self):
|
||||||
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
|
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
|
||||||
|
@ -77,7 +77,7 @@ class CompatChecksTestCase(TestCase):
|
||||||
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
|
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
|
||||||
result = base.check_compatibility()
|
result = base.check_compatibility()
|
||||||
self.assertEqual(len(result), 1)
|
self.assertEqual(len(result), 1)
|
||||||
self.assertTrue("You have not explicitly set 'TEST_RUNNER'" in result[0])
|
self.assertTrue("Django 1.6 introduced a new default test runner" in result[0])
|
||||||
|
|
||||||
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
|
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
|
||||||
self.assertEqual(len(base.check_compatibility()), 0)
|
self.assertEqual(len(base.check_compatibility()), 0)
|
||||||
|
@ -121,7 +121,7 @@ class CompatChecksTestCase(TestCase):
|
||||||
call_command('check')
|
call_command('check')
|
||||||
|
|
||||||
self.assertEqual(len(check.warnings._warnings), 1)
|
self.assertEqual(len(check.warnings._warnings), 1)
|
||||||
self.assertTrue("You have not explicitly set 'TEST_RUNNER'" in check.warnings._warnings[0])
|
self.assertTrue("Django 1.6 introduced a new default test runner" in check.warnings._warnings[0])
|
||||||
|
|
||||||
# Restore the ``warnings``.
|
# Restore the ``warnings``.
|
||||||
base.warnings = old_warnings
|
base.warnings = old_warnings
|
||||||
|
|
Loading…
Reference in New Issue