summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@gmail.com>2014-10-15 14:14:46 +0700
committerLoic Bistuer <loic.bistuer@gmail.com>2014-10-16 23:49:21 +0700
commit157f9cf240427bd52aa09a895ac4456da167f876 (patch)
treec91f8230c4743a92d7b5acdda7c572887fa68731
parent80b8d3bee035b56b0d9ac57dd732dffa3b2d5f3c (diff)
Minor cleanup in the check_framework test package.
-rw-r--r--tests/check_framework/models.py5
-rw-r--r--tests/check_framework/tests.py42
2 files changed, 21 insertions, 26 deletions
diff --git a/tests/check_framework/models.py b/tests/check_framework/models.py
index da2bf0c58d..f091783098 100644
--- a/tests/check_framework/models.py
+++ b/tests/check_framework/models.py
@@ -12,8 +12,3 @@ class SimpleModel(models.Model):
class Book(models.Model):
title = models.CharField(max_length=250)
is_published = models.BooleanField(default=False)
-
-
-class BlogPost(models.Model):
- title = models.CharField(max_length=250)
- is_published = models.BooleanField(default=False)
diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py
index 2fd80fd1ac..c1059de604 100644
--- a/tests/check_framework/tests.py
+++ b/tests/check_framework/tests.py
@@ -125,28 +125,28 @@ class Django_1_6_0_CompatibilityChecks(TestCase):
settings._wrapped._explicit_settings.remove('MANAGERS')
settings._wrapped._explicit_settings.remove('ADMINS')
+ @override_settings(TEST_RUNNER='myapp.test.CustomRunner')
def test_boolean_field_default_value(self):
- with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
- # We patch the field's default value to trigger the warning
- boolean_field = Book._meta.get_field('is_published')
- old_default = boolean_field.default
- try:
- boolean_field.default = NOT_PROVIDED
- errors = check_1_6_compatibility()
- expected = [
- checks.Warning(
- 'BooleanField does not have a default value.',
- hint=('Django 1.6 changed the default value of BooleanField from False to None. '
- 'See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield '
- 'for more information.'),
- obj=boolean_field,
- id='1_6.W002',
- )
- ]
- self.assertEqual(errors, expected)
- finally:
- # Restore the ``default``
- boolean_field.default = old_default
+ # We patch the field's default value to trigger the warning
+ boolean_field = Book._meta.get_field('is_published')
+ old_default = boolean_field.default
+ try:
+ boolean_field.default = NOT_PROVIDED
+ errors = check_1_6_compatibility()
+ expected = [
+ checks.Warning(
+ 'BooleanField does not have a default value.',
+ hint=('Django 1.6 changed the default value of BooleanField from False to None. '
+ 'See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield '
+ 'for more information.'),
+ obj=boolean_field,
+ id='1_6.W002',
+ )
+ ]
+ self.assertEqual(errors, expected)
+ finally:
+ # Restore the ``default``
+ boolean_field.default = old_default
class Django_1_7_0_CompatibilityChecks(TestCase):