[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:
Russell Keith-Magee 2013-10-08 10:00:39 +08:00
parent 563b5c2000
commit 7f0fdffd07
2 changed files with 6 additions and 8 deletions

View File

@ -16,10 +16,8 @@ def check_test_runner():
if test_runner_setting == new_default:
message = [
"You have not explicitly set 'TEST_RUNNER'. In Django 1.6,",
"there is a new test runner ('%s')" % new_default,
"by default. You should ensure your tests are still all",
"running & behaving as expected. See",
"Django 1.6 introduced a new default test runner ('%s')" % new_default,
"You should ensure your tests are all running & behaving as expected. See",
"https://docs.djangoproject.com/en/dev/releases/1.6/#discovery-of-tests-in-any-test-module",
"for more information.",
]

View File

@ -39,7 +39,7 @@ class CompatChecksTestCase(TestCase):
def test_check_test_runner_new_default(self):
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
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):
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
@ -49,7 +49,7 @@ class CompatChecksTestCase(TestCase):
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
result = django_1_6_0.run_checks()
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):
with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
@ -77,7 +77,7 @@ class CompatChecksTestCase(TestCase):
with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
result = base.check_compatibility()
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'):
self.assertEqual(len(base.check_compatibility()), 0)
@ -121,7 +121,7 @@ class CompatChecksTestCase(TestCase):
call_command('check')
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``.
base.warnings = old_warnings