Exemplo n.º 1
0
 def test_test_runner_not_set_explicitly(self):
     # If TEST_RUNNER was set explicitly, temporarily pretend it wasn't
     test_runner_overridden = False
     if 'TEST_RUNNER' in settings._wrapped._explicit_settings:
         test_runner_overridden = True
         settings._wrapped._explicit_settings.remove('TEST_RUNNER')
     # We remove some settings to make this look like a project generated under Django 1.5.
     settings._wrapped._explicit_settings.add('MANAGERS')
     settings._wrapped._explicit_settings.add('ADMINS')
     try:
         errors = check_1_6_compatibility()
         expected = [
             checks.Warning(
                 "Some project unittests may not execute as expected.",
                 hint=
                 ("Django 1.6 introduced a new default test runner. It looks like "
                  "this project was generated using Django 1.5 or earlier. 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."),
                 obj=None,
                 id='1_6.W001',
             )
         ]
         self.assertEqual(errors, expected)
     finally:
         # Restore settings value
         if test_runner_overridden:
             settings._wrapped._explicit_settings.add('TEST_RUNNER')
         settings._wrapped._explicit_settings.remove('MANAGERS')
         settings._wrapped._explicit_settings.remove('ADMINS')
Exemplo n.º 2
0
Arquivo: tests.py Projeto: 6ft/django
 def test_test_runner_not_set_explicitly(self):
     # If TEST_RUNNER was set explicitly, temporarily pretend it wasn't
     test_runner_overridden = False
     if 'TEST_RUNNER' in settings._wrapped._explicit_settings:
         test_runner_overridden = True
         settings._wrapped._explicit_settings.remove('TEST_RUNNER')
     # We remove some settings to make this look like a project generated under Django 1.5.
     settings._wrapped._explicit_settings.add('MANAGERS')
     settings._wrapped._explicit_settings.add('ADMINS')
     try:
         errors = check_1_6_compatibility()
         expected = [
             checks.Warning(
                 "Some project unittests may not execute as expected.",
                 hint=("Django 1.6 introduced a new default test runner. It looks like "
                       "this project was generated using Django 1.5 or earlier. 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."),
                 obj=None,
                 id='1_6.W001',
             )
         ]
         self.assertEqual(errors, expected)
     finally:
         # Restore settings value
         if test_runner_overridden:
             settings._wrapped._explicit_settings.add('TEST_RUNNER')
         settings._wrapped._explicit_settings.remove('MANAGERS')
         settings._wrapped._explicit_settings.remove('ADMINS')
Exemplo n.º 3
0
 def test_boolean_field_default_value(self):
     # 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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
Exemplo n.º 6
0
Arquivo: tests.py Projeto: 6ft/django
 def test_test_runner_overriden(self):
     errors = check_1_6_compatibility()
     self.assertEqual(errors, [])
Exemplo n.º 7
0
Arquivo: tests.py Projeto: 6ft/django
 def test_test_runner_new_default(self):
     errors = check_1_6_compatibility()
     self.assertEqual(errors, [])
Exemplo n.º 8
0
 def test_test_runner_overriden(self):
     errors = check_1_6_compatibility()
     self.assertEqual(errors, [])
Exemplo n.º 9
0
 def test_test_runner_new_default(self):
     errors = check_1_6_compatibility()
     self.assertEqual(errors, [])