From be67400b477c1b0e7e81766f41bbceed0de74bdc Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 17 Apr 2015 17:38:20 -0400 Subject: [PATCH] Refs #24652 -- Used SimpleTestCase where appropriate. --- tests/absolute_url_overrides/tests.py | 4 +- tests/admin_checks/tests.py | 4 +- tests/admin_registration/tests.py | 6 +-- tests/admin_scripts/tests.py | 6 ++- tests/admin_views/tests.py | 5 ++- tests/admin_widgets/tests.py | 30 +++++++-------- tests/app_loading/tests.py | 6 +-- tests/apps/tests.py | 8 ++-- tests/auth_tests/test_auth_backends.py | 6 ++- tests/auth_tests/test_context_processors.py | 4 +- tests/auth_tests/test_forms.py | 4 +- tests/auth_tests/test_management.py | 6 ++- tests/backends/tests.py | 8 ++-- tests/basic/tests.py | 7 ++-- tests/cache/tests.py | 23 +++++------ tests/check_framework/test_security.py | 32 ++++++++-------- tests/check_framework/tests.py | 12 +++--- tests/conditional_processing/tests.py | 4 +- tests/context_processors/tests.py | 4 +- tests/csrf_tests/tests.py | 4 +- tests/field_deconstruction/tests.py | 4 +- tests/field_subclassing/tests.py | 4 +- tests/file_uploads/tests.py | 4 +- tests/flatpages_tests/test_models.py | 4 +- .../forms_tests/tests/test_error_messages.py | 4 +- tests/forms_tests/tests/test_forms.py | 4 +- tests/forms_tests/tests/test_formsets.py | 10 ++--- tests/forms_tests/tests/test_media.py | 6 +-- tests/forms_tests/tests/test_utils.py | 4 +- tests/forms_tests/tests/test_widgets.py | 12 +++--- tests/forms_tests/tests/tests.py | 4 +- tests/generic_inline_admin/tests.py | 8 ++-- tests/generic_relations/tests.py | 4 +- tests/generic_views/test_base.py | 6 +-- tests/generic_views/test_edit.py | 8 ++-- tests/gis_tests/maps/tests.py | 4 +- tests/handlers/tests.py | 12 +++--- tests/http_utils/tests.py | 4 +- tests/httpwrappers/tests.py | 10 ++--- tests/i18n/patterns/tests.py | 4 +- tests/i18n/tests.py | 22 ++++++----- tests/invalid_models_tests/base.py | 4 +- .../test_ordinary_fields.py | 9 +++-- tests/logging_tests/tests.py | 16 ++++---- tests/messages_tests/test_api.py | 4 +- tests/messages_tests/test_cookie.py | 4 +- tests/messages_tests/test_fallback.py | 4 +- tests/messages_tests/test_mixins.py | 4 +- tests/middleware/test_security.py | 4 +- tests/middleware/tests.py | 14 +++---- tests/middleware_exceptions/tests.py | 8 ++-- tests/migrations/test_graph.py | 4 +- tests/migrations/test_optimizer.py | 4 +- tests/migrations/test_state.py | 6 +-- tests/migrations/test_writer.py | 4 +- tests/model_fields/test_durationfield.py | 8 ++-- tests/model_fields/test_field_flags.py | 2 +- tests/model_fields/test_uuid.py | 8 ++-- tests/model_fields/tests.py | 8 ++-- tests/model_forms/tests.py | 16 ++++---- tests/model_meta/test_legacy.py | 2 +- tests/model_meta/tests.py | 8 ++-- tests/model_permalink/tests.py | 4 +- tests/model_validation/tests.py | 4 +- tests/modeladmin/tests.py | 6 +-- tests/multiple_database/tests.py | 4 +- tests/no_models/tests.py | 4 +- tests/resolve_url/tests.py | 4 +- tests/select_related/tests.py | 4 +- tests/select_related_onetoone/tests.py | 4 +- tests/serializers/tests.py | 7 ++-- tests/serializers_regress/tests.py | 4 +- tests/servers/test_basehttp.py | 4 +- tests/settings_tests/tests.py | 10 ++--- tests/shortcuts/tests.py | 4 +- tests/signed_cookies_tests/tests.py | 4 +- tests/signing/tests.py | 6 +-- tests/staticfiles_tests/tests.py | 12 +++--- tests/test_client/tests.py | 10 +++-- tests/test_client_regress/tests.py | 38 ++++++++++--------- tests/test_utils/tests.py | 14 +++---- tests/timezones/tests.py | 6 +-- tests/urlpatterns_reverse/tests.py | 24 ++++++------ tests/utils_tests/test_autoreload.py | 4 +- tests/utils_tests/test_dateformat.py | 4 +- tests/utils_tests/test_decorators.py | 6 +-- tests/utils_tests/test_jslex.py | 6 +-- tests/utils_tests/test_safestring.py | 4 +- tests/view_tests/tests/test_csrf.py | 4 +- tests/view_tests/tests/test_debug.py | 16 ++++---- tests/view_tests/tests/test_i18n.py | 7 ++-- tests/view_tests/tests/test_json.py | 4 +- tests/view_tests/tests/test_specials.py | 4 +- 93 files changed, 362 insertions(+), 340 deletions(-) diff --git a/tests/absolute_url_overrides/tests.py b/tests/absolute_url_overrides/tests.py index b57374cb6d..ab4ad0d005 100644 --- a/tests/absolute_url_overrides/tests.py +++ b/tests/absolute_url_overrides/tests.py @@ -1,8 +1,8 @@ from django.db import models -from django.test import TestCase +from django.test import SimpleTestCase -class AbsoluteUrlOverrideTests(TestCase): +class AbsoluteUrlOverrideTests(SimpleTestCase): def test_get_absolute_url(self): """ diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py index 7e1902105f..d988ade920 100644 --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -4,7 +4,7 @@ from django import forms from django.contrib import admin from django.contrib.contenttypes.admin import GenericStackedInline from django.core import checks -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from .models import Album, Book, City, Influence, Song, State, TwoAlbumFKAndAnE @@ -41,7 +41,7 @@ class MyAdmin(admin.ModelAdmin): SILENCED_SYSTEM_CHECKS=['fields.W342'], # ForeignKey(unique=True) INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes', 'admin_checks'] ) -class SystemChecksTestCase(TestCase): +class SystemChecksTestCase(SimpleTestCase): @override_settings(DEBUG=True) def test_checks_are_performed(self): diff --git a/tests/admin_registration/tests.py b/tests/admin_registration/tests.py index 6cda66bb0e..7471c521d6 100644 --- a/tests/admin_registration/tests.py +++ b/tests/admin_registration/tests.py @@ -4,7 +4,7 @@ from django.contrib import admin from django.contrib.admin.decorators import register from django.contrib.admin.sites import site from django.core.exceptions import ImproperlyConfigured -from django.test import TestCase +from django.test import SimpleTestCase from .models import Location, Person, Place, Traveler @@ -18,7 +18,7 @@ class CustomSite(admin.AdminSite): pass -class TestRegistration(TestCase): +class TestRegistration(SimpleTestCase): def setUp(self): self.site = admin.AdminSite() @@ -80,7 +80,7 @@ class TestRegistration(TestCase): self.assertFalse(self.site.is_registered(Person)) -class TestRegistrationDecorator(TestCase): +class TestRegistrationDecorator(SimpleTestCase): """ Tests the register decorator in admin.decorators diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 6343d89c3e..7c07a51796 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -25,7 +25,9 @@ from django.core.management import ( from django.db import ConnectionHandler from django.db.migrations.exceptions import MigrationSchemaMissing from django.db.migrations.recorder import MigrationRecorder -from django.test import LiveServerTestCase, TestCase, mock, override_settings +from django.test import ( + LiveServerTestCase, SimpleTestCase, mock, override_settings, +) from django.test.runner import DiscoverRunner from django.utils._os import npath, upath from django.utils.encoding import force_text @@ -1695,7 +1697,7 @@ class CommandTypes(AdminScriptTestCase): self.assertOutput(out, "EXECUTE:LabelCommand label=anotherlabel, options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', False), ('verbosity', 1)]") -class Discovery(TestCase): +class Discovery(SimpleTestCase): def test_precedence(self): """ diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 93c3a7a710..825242c48c 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -27,7 +27,8 @@ from django.forms.utils import ErrorList from django.template.loader import render_to_string from django.template.response import TemplateResponse from django.test import ( - TestCase, modify_settings, override_settings, skipUnlessDBFeature, + SimpleTestCase, TestCase, modify_settings, override_settings, + skipUnlessDBFeature, ) from django.test.utils import override_script_prefix, patch_logger from django.utils import formats, six, translation @@ -6150,7 +6151,7 @@ class InlineAdminViewOnSiteTest(TestCase): @override_settings(ROOT_URLCONF="admin_views.urls") -class TestEtagWithAdminView(TestCase): +class TestEtagWithAdminView(SimpleTestCase): # See https://code.djangoproject.com/ticket/16003 def test_admin(self): diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 1f0ec00eed..3ab7938ece 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -5,7 +5,7 @@ import gettext import os from datetime import datetime, timedelta from importlib import import_module -from unittest import TestCase, skipIf +from unittest import skipIf from django import forms from django.conf import settings @@ -17,7 +17,7 @@ from django.core.files.storage import default_storage from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse from django.db.models import CharField, DateField -from django.test import TestCase as DjangoTestCase, override_settings +from django.test import SimpleTestCase, TestCase, override_settings from django.utils import six, translation from . import models @@ -59,7 +59,7 @@ class SeleniumDataMixin(object): ) -class AdminFormfieldForDBFieldTests(TestCase): +class AdminFormfieldForDBFieldTests(SimpleTestCase): """ Tests for correct behavior of ModelAdmin.formfield_for_dbfield """ @@ -194,7 +194,7 @@ class AdminFormfieldForDBFieldTests(TestCase): @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], ROOT_URLCONF='admin_widgets.urls') -class AdminFormfieldForDBFieldWithRequestTests(TestDataMixin, DjangoTestCase): +class AdminFormfieldForDBFieldWithRequestTests(TestDataMixin, TestCase): def test_filter_choices_by_request_user(self): """ @@ -208,7 +208,7 @@ class AdminFormfieldForDBFieldWithRequestTests(TestDataMixin, DjangoTestCase): @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], ROOT_URLCONF='admin_widgets.urls') -class AdminForeignKeyWidgetChangeList(TestDataMixin, DjangoTestCase): +class AdminForeignKeyWidgetChangeList(TestDataMixin, TestCase): def setUp(self): self.client.login(username="super", password="secret") @@ -220,7 +220,7 @@ class AdminForeignKeyWidgetChangeList(TestDataMixin, DjangoTestCase): @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], ROOT_URLCONF='admin_widgets.urls') -class AdminForeignKeyRawIdWidget(TestDataMixin, DjangoTestCase): +class AdminForeignKeyRawIdWidget(TestDataMixin, TestCase): def setUp(self): self.client.login(username="super", password="secret") @@ -262,7 +262,7 @@ class AdminForeignKeyRawIdWidget(TestDataMixin, DjangoTestCase): self.assertEqual(lookup1, lookup2) -class FilteredSelectMultipleWidgetTest(DjangoTestCase): +class FilteredSelectMultipleWidgetTest(SimpleTestCase): def test_render(self): # Backslash in verbose_name to ensure it is JavaScript escaped. w = widgets.FilteredSelectMultiple('test\\', False) @@ -284,7 +284,7 @@ class FilteredSelectMultipleWidgetTest(DjangoTestCase): ) -class AdminDateWidgetTest(DjangoTestCase): +class AdminDateWidgetTest(SimpleTestCase): def test_attrs(self): """ Ensure that user-supplied attrs are used. @@ -303,7 +303,7 @@ class AdminDateWidgetTest(DjangoTestCase): ) -class AdminTimeWidgetTest(DjangoTestCase): +class AdminTimeWidgetTest(SimpleTestCase): def test_attrs(self): """ Ensure that user-supplied attrs are used. @@ -322,7 +322,7 @@ class AdminTimeWidgetTest(DjangoTestCase): ) -class AdminSplitDateTimeWidgetTest(DjangoTestCase): +class AdminSplitDateTimeWidgetTest(SimpleTestCase): def test_render(self): w = widgets.AdminSplitDateTime() self.assertHTMLEqual( @@ -341,7 +341,7 @@ class AdminSplitDateTimeWidgetTest(DjangoTestCase): ) -class AdminURLWidgetTest(DjangoTestCase): +class AdminURLWidgetTest(SimpleTestCase): def test_render(self): w = widgets.AdminURLFieldWidget() self.assertHTMLEqual( @@ -382,7 +382,7 @@ class AdminURLWidgetTest(DjangoTestCase): PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], ROOT_URLCONF='admin_widgets.urls', ) -class AdminFileWidgetTests(TestDataMixin, DjangoTestCase): +class AdminFileWidgetTests(TestDataMixin, TestCase): @classmethod def setUpTestData(cls): @@ -436,7 +436,7 @@ class AdminFileWidgetTests(TestDataMixin, DjangoTestCase): @override_settings(ROOT_URLCONF='admin_widgets.urls') -class ForeignKeyRawIdWidgetTest(DjangoTestCase): +class ForeignKeyRawIdWidgetTest(TestCase): def test_render(self): band = models.Band.objects.create(name='Linkin Park') @@ -519,7 +519,7 @@ class ForeignKeyRawIdWidgetTest(DjangoTestCase): @override_settings(ROOT_URLCONF='admin_widgets.urls') -class ManyToManyRawIdWidgetTest(DjangoTestCase): +class ManyToManyRawIdWidgetTest(TestCase): def test_render(self): band = models.Band.objects.create(name='Linkin Park') @@ -566,7 +566,7 @@ class ManyToManyRawIdWidgetTest(DjangoTestCase): ) -class RelatedFieldWidgetWrapperTests(DjangoTestCase): +class RelatedFieldWidgetWrapperTests(SimpleTestCase): def test_no_can_add_related(self): rel = models.Individual._meta.get_field('parent').remote_field w = widgets.AdminRadioSelect() diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py index d9bead4d61..e068508e6c 100644 --- a/tests/app_loading/tests.py +++ b/tests/app_loading/tests.py @@ -3,13 +3,13 @@ from __future__ import unicode_literals import os from django.apps import apps -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import extend_sys_path from django.utils import six from django.utils._os import upath -class EggLoadingTest(TestCase): +class EggLoadingTest(SimpleTestCase): def setUp(self): self.egg_dir = '%s/eggs' % os.path.dirname(upath(__file__)) @@ -62,7 +62,7 @@ class EggLoadingTest(TestCase): pass -class GetModelsTest(TestCase): +class GetModelsTest(SimpleTestCase): def setUp(self): from .not_installed import models self.not_installed_module = models diff --git a/tests/apps/tests.py b/tests/apps/tests.py index 347996454f..e7e5c53534 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -10,7 +10,7 @@ from django.apps.registry import Apps from django.contrib.admin.models import LogEntry from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured from django.db import models -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.test.utils import extend_sys_path from django.utils import six from django.utils._os import upath @@ -38,7 +38,7 @@ SOME_INSTALLED_APPS_NAMES = [ HERE = os.path.dirname(upath(__file__)) -class AppsTests(TestCase): +class AppsTests(SimpleTestCase): def test_singleton_master(self): """ @@ -303,7 +303,7 @@ class Stub(object): self.__dict__.update(kwargs) -class AppConfigTests(TestCase): +class AppConfigTests(SimpleTestCase): """Unit tests for AppConfig class.""" def test_path_set_explicitly(self): """If subclass sets path as class attr, no module attributes needed.""" @@ -366,7 +366,7 @@ class AppConfigTests(TestCase): @skipUnless( sys.version_info > (3, 3, 0), "Namespace packages sans __init__.py were added in Python 3.3") -class NamespacePackageAppTests(TestCase): +class NamespacePackageAppTests(SimpleTestCase): # We need nsapp to be top-level so our multiple-paths tests can add another # location for it (if its inside a normal package with an __init__.py that # isn't possible). In order to avoid cluttering the already-full tests/ dir diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py index 1977494a24..6a642aaba6 100644 --- a/tests/auth_tests/test_auth_backends.py +++ b/tests/auth_tests/test_auth_backends.py @@ -12,7 +12,9 @@ from django.contrib.auth.tests.custom_user import CustomUser, ExtensionUser from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.http import HttpRequest -from django.test import TestCase, modify_settings, override_settings +from django.test import ( + SimpleTestCase, TestCase, modify_settings, override_settings, +) from .models import CustomPermissionsUser, UUIDUser @@ -394,7 +396,7 @@ class RowlevelBackendTest(TestCase): @override_settings( AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend'], ) -class AnonymousUserBackendTest(TestCase): +class AnonymousUserBackendTest(SimpleTestCase): """ Tests for AnonymousUser delegating to backend. """ diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py index 5f91fd1e0a..e76c8df004 100644 --- a/tests/auth_tests/test_context_processors.py +++ b/tests/auth_tests/test_context_processors.py @@ -5,7 +5,7 @@ from django.contrib.auth.context_processors import PermLookupDict, PermWrapper from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.db.models import Q -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, TestCase, override_settings from .settings import AUTH_MIDDLEWARE_CLASSES, AUTH_TEMPLATES @@ -22,7 +22,7 @@ class MockUser(object): return False -class PermWrapperTests(TestCase): +class PermWrapperTests(SimpleTestCase): """ Test some details of the PermWrapper implementation. """ diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py index 28dca7b3a1..2595cd7540 100644 --- a/tests/auth_tests/test_forms.py +++ b/tests/auth_tests/test_forms.py @@ -14,7 +14,7 @@ from django.contrib.sites.models import Site from django.core import mail from django.core.mail import EmailMultiAlternatives from django.forms.fields import CharField, Field -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, TestCase, override_settings from django.utils import translation from django.utils.encoding import force_text from django.utils.text import capfirst @@ -553,7 +553,7 @@ class PasswordResetFormTest(TestDataMixin, TestCase): ) -class ReadOnlyPasswordHashTest(TestCase): +class ReadOnlyPasswordHashTest(SimpleTestCase): def test_bug_19349_render_with_none_value(self): # Rendering the widget with value set to None diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py index d3b2ff18c5..e9c6105496 100644 --- a/tests/auth_tests/test_management.py +++ b/tests/auth_tests/test_management.py @@ -17,7 +17,9 @@ from django.contrib.contenttypes.models import ContentType from django.core import checks, exceptions from django.core.management import call_command from django.core.management.base import CommandError -from django.test import TestCase, override_settings, override_system_checks +from django.test import ( + SimpleTestCase, TestCase, override_settings, override_system_checks, +) from django.utils import six from django.utils.encoding import force_str from django.utils.translation import ugettext_lazy as _ @@ -415,7 +417,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase): test(self) -class CustomUserModelValidationTestCase(TestCase): +class CustomUserModelValidationTestCase(SimpleTestCase): @override_settings(AUTH_USER_MODEL='auth.CustomUserNonListRequiredFields') @override_system_checks([check_user_model]) def test_required_fields_is_list(self): diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 0773c9fd64..f5ec488c86 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -25,8 +25,8 @@ from django.db.models import Avg, StdDev, Sum, Variance from django.db.models.sql.constants import CURSOR from django.db.utils import ConnectionHandler from django.test import ( - TestCase, TransactionTestCase, mock, override_settings, skipIfDBFeature, - skipUnlessDBFeature, + SimpleTestCase, TestCase, TransactionTestCase, mock, override_settings, + skipIfDBFeature, skipUnlessDBFeature, ) from django.test.utils import str_prefix from django.utils import six @@ -35,7 +35,7 @@ from django.utils.six.moves import range from . import models -class DummyBackendTest(TestCase): +class DummyBackendTest(SimpleTestCase): def test_no_databases(self): """ @@ -1096,7 +1096,7 @@ class DBConstraintTestCase(TestCase): self.assertEqual(intermediary_model.objects.count(), 2) -class BackendUtilTests(TestCase): +class BackendUtilTests(SimpleTestCase): def test_format_number(self): """ diff --git a/tests/basic/tests.py b/tests/basic/tests.py index 0fd673fca6..a37aa77613 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -11,7 +11,8 @@ from django.db.models.fields.related import ForeignObjectRel from django.db.models.manager import BaseManager from django.db.models.query import EmptyQuerySet, QuerySet from django.test import ( - TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature, + SimpleTestCase, TestCase, TransactionTestCase, skipIfDBFeature, + skipUnlessDBFeature, ) from django.utils import six from django.utils.translation import ugettext_lazy @@ -594,7 +595,7 @@ class ConcurrentSaveTests(TransactionTestCase): self.assertEqual(Article.objects.get(pk=a.pk).headline, 'foo') -class ManagerTest(TestCase): +class ManagerTest(SimpleTestCase): QUERYSET_PROXY_METHODS = [ 'none', 'count', @@ -772,7 +773,7 @@ class ModelRefreshTests(TestCase): a.refresh_from_db(fields=[]) -class TestRelatedObjectDeprecation(TestCase): +class TestRelatedObjectDeprecation(SimpleTestCase): def test_field_related_deprecation(self): field = SelfRef._meta.get_field('selfref') with warnings.catch_warnings(record=True) as warns: diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 9d29239cf6..a7e098307c 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -30,7 +30,8 @@ from django.template import engines from django.template.context_processors import csrf from django.template.response import TemplateResponse from django.test import ( - RequestFactory, TestCase, TransactionTestCase, override_settings, + RequestFactory, SimpleTestCase, TestCase, TransactionTestCase, + override_settings, ) from django.test.signals import setting_changed from django.utils import six, timezone, translation @@ -69,7 +70,7 @@ class Unpickable(object): 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', } }) -class DummyCacheTests(TestCase): +class DummyCacheTests(SimpleTestCase): # The Dummy cache backend doesn't really behave like a test backend, # so it has its own test case. @@ -1235,7 +1236,7 @@ class FileBasedCacheTests(BaseCacheTests, TestCase): 'BACKEND': 'cache.liberal_backend.CacheClass', }, }) -class CustomCacheKeyValidationTests(TestCase): +class CustomCacheKeyValidationTests(SimpleTestCase): """ Tests for the ability to mixin a custom ``validate_key`` method to a custom cache backend that otherwise inherits from a builtin @@ -1257,7 +1258,7 @@ class CustomCacheKeyValidationTests(TestCase): } } ) -class CacheClosingTests(TestCase): +class CacheClosingTests(SimpleTestCase): def test_close(self): self.assertFalse(cache.closed) @@ -1275,7 +1276,7 @@ NEVER_EXPIRING_CACHES_SETTINGS = copy.deepcopy(DEFAULT_MEMORY_CACHES_SETTINGS) NEVER_EXPIRING_CACHES_SETTINGS['default']['TIMEOUT'] = None -class DefaultNonExpiringCacheKeyTests(TestCase): +class DefaultNonExpiringCacheKeyTests(SimpleTestCase): """Tests that verify that settings having Cache arguments with a TIMEOUT set to `None` will create Caches that will set non-expiring keys. @@ -1351,7 +1352,7 @@ class DefaultNonExpiringCacheKeyTests(TestCase): }, USE_I18N=False, ) -class CacheUtils(TestCase): +class CacheUtils(SimpleTestCase): """TestCase for django.utils.cache functions.""" def setUp(self): @@ -1500,7 +1501,7 @@ class PrefixedCacheUtils(CacheUtils): }, }, ) -class CacheHEADTest(TestCase): +class CacheHEADTest(SimpleTestCase): def setUp(self): self.path = '/cache/test/' @@ -1820,7 +1821,7 @@ def csrf_view(request): }, }, ) -class CacheMiddlewareTest(TestCase): +class CacheMiddlewareTest(SimpleTestCase): def setUp(self): super(CacheMiddlewareTest, self).setUp() @@ -2001,7 +2002,7 @@ class CacheMiddlewareTest(TestCase): }, USE_I18N=False, ) -class TestWithTemplateResponse(TestCase): +class TestWithTemplateResponse(SimpleTestCase): """ Tests various headers w/ TemplateResponse. @@ -2097,7 +2098,7 @@ class TestWithTemplateResponse(TestCase): self.assertTrue(response.has_header('ETag')) -class TestMakeTemplateFragmentKey(TestCase): +class TestMakeTemplateFragmentKey(SimpleTestCase): def test_without_vary_on(self): key = make_template_fragment_key('a.fragment') self.assertEqual(key, 'template.cache.a.fragment.d41d8cd98f00b204e9800998ecf8427e') @@ -2118,7 +2119,7 @@ class TestMakeTemplateFragmentKey(TestCase): 'template.cache.spam.f27688177baec990cdf3fbd9d9c3f469') -class CacheHandlerTest(TestCase): +class CacheHandlerTest(SimpleTestCase): def test_same_instance(self): """ Attempting to retrieve the same alias should yield the same instance. diff --git a/tests/check_framework/test_security.py b/tests/check_framework/test_security.py index c62d96f68c..42e186d639 100644 --- a/tests/check_framework/test_security.py +++ b/tests/check_framework/test_security.py @@ -1,10 +1,10 @@ from django.conf import settings from django.core.checks.security import base, csrf, sessions -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import override_settings -class CheckSessionCookieSecureTest(TestCase): +class CheckSessionCookieSecureTest(SimpleTestCase): @property def func(self): from django.core.checks.security.sessions import check_session_cookie_secure @@ -55,7 +55,7 @@ class CheckSessionCookieSecureTest(TestCase): self.assertEqual(self.func(None), []) -class CheckSessionCookieHttpOnlyTest(TestCase): +class CheckSessionCookieHttpOnlyTest(SimpleTestCase): @property def func(self): from django.core.checks.security.sessions import check_session_cookie_httponly @@ -106,7 +106,7 @@ class CheckSessionCookieHttpOnlyTest(TestCase): self.assertEqual(self.func(None), []) -class CheckCSRFMiddlewareTest(TestCase): +class CheckCSRFMiddlewareTest(SimpleTestCase): @property def func(self): from django.core.checks.security.csrf import check_csrf_middleware @@ -125,7 +125,7 @@ class CheckCSRFMiddlewareTest(TestCase): self.assertEqual(self.func(None), []) -class CheckCSRFCookieSecureTest(TestCase): +class CheckCSRFCookieSecureTest(SimpleTestCase): @property def func(self): from django.core.checks.security.csrf import check_csrf_cookie_secure @@ -156,7 +156,7 @@ class CheckCSRFCookieSecureTest(TestCase): self.assertEqual(self.func(None), []) -class CheckCSRFCookieHttpOnlyTest(TestCase): +class CheckCSRFCookieHttpOnlyTest(SimpleTestCase): @property def func(self): from django.core.checks.security.csrf import check_csrf_cookie_httponly @@ -187,7 +187,7 @@ class CheckCSRFCookieHttpOnlyTest(TestCase): self.assertEqual(self.func(None), []) -class CheckSecurityMiddlewareTest(TestCase): +class CheckSecurityMiddlewareTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_security_middleware @@ -206,7 +206,7 @@ class CheckSecurityMiddlewareTest(TestCase): self.assertEqual(self.func(None), []) -class CheckStrictTransportSecurityTest(TestCase): +class CheckStrictTransportSecurityTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_sts @@ -238,7 +238,7 @@ class CheckStrictTransportSecurityTest(TestCase): self.assertEqual(self.func(None), []) -class CheckStrictTransportSecuritySubdomainsTest(TestCase): +class CheckStrictTransportSecuritySubdomainsTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_sts_include_subdomains @@ -282,7 +282,7 @@ class CheckStrictTransportSecuritySubdomainsTest(TestCase): self.assertEqual(self.func(None), []) -class CheckXFrameOptionsMiddlewareTest(TestCase): +class CheckXFrameOptionsMiddlewareTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_xframe_options_middleware @@ -300,7 +300,7 @@ class CheckXFrameOptionsMiddlewareTest(TestCase): self.assertEqual(self.func(None), []) -class CheckXFrameOptionsDenyTest(TestCase): +class CheckXFrameOptionsDenyTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_xframe_deny @@ -333,7 +333,7 @@ class CheckXFrameOptionsDenyTest(TestCase): self.assertEqual(self.func(None), []) -class CheckContentTypeNosniffTest(TestCase): +class CheckContentTypeNosniffTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_content_type_nosniff @@ -365,7 +365,7 @@ class CheckContentTypeNosniffTest(TestCase): self.assertEqual(self.func(None), []) -class CheckXssFilterTest(TestCase): +class CheckXssFilterTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_xss_filter @@ -397,7 +397,7 @@ class CheckXssFilterTest(TestCase): self.assertEqual(self.func(None), []) -class CheckSSLRedirectTest(TestCase): +class CheckSSLRedirectTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_ssl_redirect @@ -429,7 +429,7 @@ class CheckSSLRedirectTest(TestCase): self.assertEqual(self.func(None), []) -class CheckSecretKeyTest(TestCase): +class CheckSecretKeyTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_secret_key @@ -466,7 +466,7 @@ class CheckSecretKeyTest(TestCase): self.assertEqual(self.func(None), [base.W009]) -class CheckDebugTest(TestCase): +class CheckDebugTest(SimpleTestCase): @property def func(self): from django.core.checks.security.base import check_debug diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py index 3c79e9ba51..0b517aa5fe 100644 --- a/tests/check_framework/tests.py +++ b/tests/check_framework/tests.py @@ -10,7 +10,7 @@ from django.core.checks.registry import CheckRegistry from django.core.management import call_command from django.core.management.base import CommandError from django.db import models -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import override_settings, override_system_checks from django.utils.encoding import force_text from django.utils.six import StringIO @@ -23,7 +23,7 @@ class DummyObj(object): return "obj" -class SystemCheckFrameworkTests(TestCase): +class SystemCheckFrameworkTests(SimpleTestCase): def test_register_and_run_checks(self): @@ -69,7 +69,7 @@ class SystemCheckFrameworkTests(TestCase): self.assertEqual(sorted(errors), [4, 5]) -class MessageTests(TestCase): +class MessageTests(SimpleTestCase): def test_printing(self): e = Error("Message", hint="Hint", obj=DummyObj()) @@ -126,7 +126,7 @@ def deployment_system_check(**kwargs): deployment_system_check.tags = ['deploymenttag'] -class CheckCommandTests(TestCase): +class CheckCommandTests(SimpleTestCase): def setUp(self): simple_system_check.kwargs = None @@ -213,7 +213,7 @@ def custom_warning_system_check(app_configs, **kwargs): ] -class SilencingCheckTests(TestCase): +class SilencingCheckTests(SimpleTestCase): def setUp(self): self.old_stdout, self.old_stderr = sys.stdout, sys.stderr @@ -266,7 +266,7 @@ class IsolateModelsMixin(object): apps.clear_cache() -class CheckFrameworkReservedNamesTests(IsolateModelsMixin, TestCase): +class CheckFrameworkReservedNamesTests(IsolateModelsMixin, SimpleTestCase): @override_settings( SILENCED_SYSTEM_CHECKS=['models.E20', 'fields.W342'], # ForeignKey(unique=True) INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes', 'check_framework'] diff --git a/tests/conditional_processing/tests.py b/tests/conditional_processing/tests.py index 7cbe378be8..3a67817683 100644 --- a/tests/conditional_processing/tests.py +++ b/tests/conditional_processing/tests.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from datetime import datetime -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings FULL_RESPONSE = 'Test conditional get response' LAST_MODIFIED = datetime(2007, 10, 21, 23, 21, 47) @@ -16,7 +16,7 @@ EXPIRED_ETAG = '7fae4cd4b0f81e7d2914700043aa8ed6' @override_settings(ROOT_URLCONF='conditional_processing.urls') -class ConditionalGet(TestCase): +class ConditionalGet(SimpleTestCase): def assertFullResponse(self, response, check_last_modified=True, check_etag=True): self.assertEqual(response.status_code, 200) diff --git a/tests/context_processors/tests.py b/tests/context_processors/tests.py index f6c6600402..de25735b5c 100644 --- a/tests/context_processors/tests.py +++ b/tests/context_processors/tests.py @@ -1,7 +1,7 @@ """ Tests for Django's bundled context processors. """ -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, TestCase, override_settings @override_settings( @@ -16,7 +16,7 @@ from django.test import TestCase, override_settings }, }], ) -class RequestContextProcessorTests(TestCase): +class RequestContextProcessorTests(SimpleTestCase): """ Tests for the ``django.template.context_processors.request`` processor. """ diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index 29ce2c170c..2d347ccdde 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -10,7 +10,7 @@ from django.middleware.csrf import ( ) from django.template import RequestContext, Template from django.template.context_processors import csrf -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.views.decorators.csrf import ( csrf_exempt, ensure_csrf_cookie, requires_csrf_token, ) @@ -56,7 +56,7 @@ class TestingHttpRequest(HttpRequest): return getattr(self, '_is_secure_override', False) -class CsrfViewMiddlewareTest(TestCase): +class CsrfViewMiddlewareTest(SimpleTestCase): # The csrf token is potentially from an untrusted source, so could have # characters that need dealing with. _csrf_id_cookie = b"<1>\xc2\xa1" diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py index 30c5e89213..6a0fe114ce 100644 --- a/tests/field_deconstruction/tests.py +++ b/tests/field_deconstruction/tests.py @@ -1,11 +1,11 @@ from __future__ import unicode_literals from django.db import models -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.utils import six -class FieldDeconstructionTests(TestCase): +class FieldDeconstructionTests(SimpleTestCase): """ Tests the deconstruct() method on all core fields. """ diff --git a/tests/field_subclassing/tests.py b/tests/field_subclassing/tests.py index 4d3340260d..af56fb294f 100644 --- a/tests/field_subclassing/tests.py +++ b/tests/field_subclassing/tests.py @@ -4,7 +4,7 @@ import inspect from django.core import exceptions, serializers from django.db import connection -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from .fields import CustomTypedField, Small from .models import ChoicesModel, DataModel, MyModel, OtherModel @@ -123,7 +123,7 @@ class CustomField(TestCase): o.full_clean() -class TestDbType(TestCase): +class TestDbType(SimpleTestCase): def test_db_parameters_respects_db_type(self): f = CustomTypedField() diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index 91b959b8ca..c7e627aeb0 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -13,7 +13,7 @@ import unittest from django.core.files import temp as tempfile from django.core.files.uploadedfile import SimpleUploadedFile from django.http.multipartparser import MultiPartParser, parse_header -from django.test import TestCase, client, override_settings +from django.test import SimpleTestCase, TestCase, client, override_settings from django.utils.encoding import force_bytes from django.utils.http import urlquote from django.utils.six import PY2, BytesIO, StringIO @@ -509,7 +509,7 @@ class FileUploadTests(TestCase): @override_settings(MEDIA_ROOT=MEDIA_ROOT) -class DirectoryCreationTests(TestCase): +class DirectoryCreationTests(SimpleTestCase): """ Tests for error handling during directory creation via _save_FIELD_file (ticket #6450) diff --git a/tests/flatpages_tests/test_models.py b/tests/flatpages_tests/test_models.py index 8c67450f40..ccb73c799e 100644 --- a/tests/flatpages_tests/test_models.py +++ b/tests/flatpages_tests/test_models.py @@ -3,11 +3,11 @@ from __future__ import unicode_literals from django.contrib.flatpages.models import FlatPage -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import override_script_prefix -class FlatpageModelTests(TestCase): +class FlatpageModelTests(SimpleTestCase): def test_get_absolute_url_urlencodes(self): pf = FlatPage(title="Café!", url='/café/') diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py index c02a44f8ff..d2a80051ce 100644 --- a/tests/forms_tests/tests/test_error_messages.py +++ b/tests/forms_tests/tests/test_error_messages.py @@ -9,7 +9,7 @@ from django.forms import ( ModelMultipleChoiceField, MultipleChoiceField, RegexField, SplitDateTimeField, TimeField, URLField, ValidationError, utils, ) -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from django.utils.encoding import python_2_unicode_compatible from django.utils.safestring import mark_safe @@ -23,7 +23,7 @@ class AssertFormErrorsMixin(object): self.assertEqual(e.messages, expected) -class FormsErrorMessagesTestCase(TestCase, AssertFormErrorsMixin): +class FormsErrorMessagesTestCase(SimpleTestCase, AssertFormErrorsMixin): def test_charfield(self): e = { 'required': 'REQUIRED', diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 940a55feda..056dbad296 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -20,7 +20,7 @@ from django.forms import ( from django.forms.utils import ErrorList from django.http import QueryDict from django.template import Context, Template -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import str_prefix from django.utils import six from django.utils.datastructures import MultiValueDict @@ -41,7 +41,7 @@ class PersonNew(Form): birthday = DateField() -class FormsTestCase(TestCase): +class FormsTestCase(SimpleTestCase): # A Form is a collection of Fields. It knows how to validate a set of data and it # knows how to render itself in a couple of default ways (e.g., an HTML table). # You can pass it data in __init__(), as a dictionary. diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 9285a83038..0bd28111e1 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -9,7 +9,7 @@ from django.forms import ( ) from django.forms.formsets import BaseFormSet, formset_factory from django.forms.utils import ErrorList -from django.test import TestCase +from django.test import SimpleTestCase from django.utils.encoding import force_text @@ -57,7 +57,7 @@ class SplitDateTimeForm(Form): SplitDateTimeFormSet = formset_factory(SplitDateTimeForm) -class FormsFormsetTestCase(TestCase): +class FormsFormsetTestCase(SimpleTestCase): def make_choiceformset(self, formset_data=None, formset_class=ChoiceFormSet, total_forms=None, initial_forms=0, max_num_forms=0, min_num_forms=0, **kwargs): @@ -1117,7 +1117,7 @@ class Choice(Form): ChoiceFormSet = formset_factory(Choice) -class FormsetAsFooTests(TestCase): +class FormsetAsFooTests(SimpleTestCase): def test_as_table(self): formset = ChoiceFormSet(data, auto_id=False, prefix='choices') self.assertHTMLEqual(formset.as_table(), """ @@ -1145,7 +1145,7 @@ class ArticleForm(Form): ArticleFormSet = formset_factory(ArticleForm) -class TestIsBoundBehavior(TestCase): +class TestIsBoundBehavior(SimpleTestCase): def test_no_data_raises_validation_error(self): with self.assertRaises(ValidationError): ArticleFormSet({}).is_valid() @@ -1200,7 +1200,7 @@ class TestIsBoundBehavior(TestCase): self.assertHTMLEqual(empty_forms[0].as_p(), empty_forms[1].as_p()) -class TestEmptyFormSet(TestCase): +class TestEmptyFormSet(SimpleTestCase): def test_empty_formset_is_valid(self): """Test that an empty formset still calls clean()""" EmptyFsetWontValidateFormset = formset_factory(FavoriteDrinkForm, extra=0, formset=EmptyFsetWontValidate) diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py index 64d29c44cb..4ec5f6ab7e 100644 --- a/tests/forms_tests/tests/test_media.py +++ b/tests/forms_tests/tests/test_media.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from django.forms import CharField, Form, Media, MultiWidget, TextInput from django.template import Context, Template -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.utils.encoding import force_text @@ -9,7 +9,7 @@ from django.utils.encoding import force_text STATIC_URL=None, MEDIA_URL='http://media.example.com/media/', ) -class FormsMediaTestCase(TestCase): +class FormsMediaTestCase(SimpleTestCase): """Tests for the media handling on widgets and forms""" def test_construction(self): @@ -466,7 +466,7 @@ class FormsMediaTestCase(TestCase): STATIC_URL='http://media.example.com/static/', MEDIA_URL='http://media.example.com/media/', ) -class StaticFormsMediaTestCase(TestCase): +class StaticFormsMediaTestCase(SimpleTestCase): """Tests for the media handling on widgets and forms""" def test_construction(self): diff --git a/tests/forms_tests/tests/test_utils.py b/tests/forms_tests/tests/test_utils.py index 7baf975bea..d13c59ed79 100644 --- a/tests/forms_tests/tests/test_utils.py +++ b/tests/forms_tests/tests/test_utils.py @@ -5,14 +5,14 @@ import copy from django.core.exceptions import ValidationError from django.forms.utils import ErrorDict, ErrorList, flatatt -from django.test import TestCase +from django.test import SimpleTestCase from django.utils import six from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy -class FormsUtilsTestCase(TestCase): +class FormsUtilsTestCase(SimpleTestCase): # Tests for forms/utils.py module. def test_flatatt(self): diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py index 5f552b03fd..40ff750f60 100644 --- a/tests/forms_tests/tests/test_widgets.py +++ b/tests/forms_tests/tests/test_widgets.py @@ -18,7 +18,7 @@ from django.forms import ( from django.forms.widgets import ( ChoiceFieldRenderer, ChoiceInput, RadioFieldRenderer, ) -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.utils import six, translation from django.utils.dates import MONTHS_AP from django.utils.encoding import force_text, python_2_unicode_compatible @@ -27,7 +27,7 @@ from django.utils.safestring import SafeData, mark_safe from ..models import Article -class FormsWidgetTests(TestCase): +class FormsWidgetTests(SimpleTestCase): # Each Widget class corresponds to an HTML form widget. A Widget knows how to # render itself, given a field name and some data. Widgets don't perform # validation. @@ -1173,7 +1173,7 @@ class NullBooleanSelectLazyForm(Form): @override_settings(USE_L10N=True) -class FormsI18NWidgetsTests(TestCase): +class FormsI18NWidgetsTests(SimpleTestCase): def setUp(self): super(FormsI18NWidgetsTests, self).setUp() translation.activate('de-at') @@ -1261,7 +1261,7 @@ class SelectAndTextWidget(MultiWidget): choices = property(_get_choices, _set_choices) -class WidgetTests(TestCase): +class WidgetTests(SimpleTestCase): def test_12048(self): # See ticket #12048. w1 = SelectAndTextWidget(choices=[1, 2, 3]) @@ -1303,7 +1303,7 @@ class FakeFieldFile(object): return self.url -class ClearableFileInputTests(TestCase): +class ClearableFileInputTests(SimpleTestCase): def test_clear_input_renders(self): """ A ClearableFileInput with is_required False and rendered with @@ -1436,7 +1436,7 @@ class GetDate(Form): mydate = DateField(widget=SelectDateWidget) -class SelectDateWidgetTests(TestCase): +class SelectDateWidgetTests(SimpleTestCase): # The forms library comes with some extra, higher-level Field and Widget def test_selectdate(self): diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index 6dafee1fb8..211866b2f1 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -9,7 +9,7 @@ from django.forms import ( CharField, FileField, Form, ModelChoiceField, ModelForm, ) from django.forms.models import ModelFormMetaclass -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from django.utils import six from ..models import ( @@ -222,7 +222,7 @@ class FormsModelTestCase(TestCase): self.assertEqual(obj.def_date, datetime.date(1999, 3, 2)) -class RelatedModelFormTests(TestCase): +class RelatedModelFormTests(SimpleTestCase): def test_invalid_loading_order(self): """ Test for issue 10405 diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py index 834cd80c5d..c5456084fc 100644 --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -11,7 +11,9 @@ from django.contrib.contenttypes.forms import generic_inlineformset_factory from django.core.urlresolvers import reverse from django.forms.formsets import DEFAULT_MAX_NUM from django.forms.models import ModelForm -from django.test import RequestFactory, TestCase, override_settings +from django.test import ( + RequestFactory, SimpleTestCase, TestCase, override_settings, +) from .admin import MediaInline, MediaPermanentInline, site as admin_site from .models import Category, Episode, EpisodePermanent, Media @@ -313,7 +315,7 @@ class GenericInlineAdminWithUniqueTogetherTest(TestDataMixin, TestCase): @override_settings(ROOT_URLCONF="generic_inline_admin.urls") -class NoInlineDeletionTest(TestCase): +class NoInlineDeletionTest(SimpleTestCase): def test_no_deletion(self): inline = MediaPermanentInline(EpisodePermanent, admin_site) @@ -335,7 +337,7 @@ request.user = MockSuperUser() @override_settings(ROOT_URLCONF="generic_inline_admin.urls") -class GenericInlineModelAdminTest(TestCase): +class GenericInlineModelAdminTest(SimpleTestCase): def setUp(self): self.site = AdminSite() diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py index 05ce20f078..47545bdef9 100644 --- a/tests/generic_relations/tests.py +++ b/tests/generic_relations/tests.py @@ -5,7 +5,7 @@ from django.contrib.contenttypes.forms import generic_inlineformset_factory from django.contrib.contenttypes.models import ContentType from django.core.exceptions import FieldError from django.db.models import Q -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from django.utils import six from .models import ( @@ -618,7 +618,7 @@ class ProxyRelatedModelTest(TestCase): self.assertEqual(base, newrel.bases.get()) -class TestInitWithNoneArgument(TestCase): +class TestInitWithNoneArgument(SimpleTestCase): def test_none_not_allowed(self): # TaggedItem requires a content_type, initializing with None should # raise a ValueError. diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py index bf7fa0fc34..340d0a5f5f 100644 --- a/tests/generic_views/test_base.py +++ b/tests/generic_views/test_base.py @@ -6,7 +6,7 @@ import unittest from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import resolve from django.http import HttpResponse -from django.test import RequestFactory, TestCase, override_settings +from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.utils import require_jinja2 from django.views.generic import RedirectView, TemplateView, View @@ -241,7 +241,7 @@ class ViewTest(unittest.TestCase): @override_settings(ROOT_URLCONF='generic_views.urls') -class TemplateViewTest(TestCase): +class TemplateViewTest(SimpleTestCase): rf = RequestFactory() @@ -352,7 +352,7 @@ class TemplateViewTest(TestCase): @override_settings(ROOT_URLCONF='generic_views.urls') -class RedirectViewTest(TestCase): +class RedirectViewTest(SimpleTestCase): rf = RequestFactory() diff --git a/tests/generic_views/test_edit.py b/tests/generic_views/test_edit.py index 3950adb57f..3cc5318947 100644 --- a/tests/generic_views/test_edit.py +++ b/tests/generic_views/test_edit.py @@ -5,7 +5,9 @@ import warnings from django import forms from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import reverse -from django.test import TestCase, ignore_warnings, override_settings +from django.test import ( + SimpleTestCase, TestCase, ignore_warnings, override_settings, +) from django.test.client import RequestFactory from django.utils.deprecation import RemovedInDjango20Warning from django.views.generic.base import View @@ -16,7 +18,7 @@ from .models import Artist, Author from .test_forms import AuthorForm -class FormMixinTests(TestCase): +class FormMixinTests(SimpleTestCase): def test_initial_data(self): """ Test instance independence of initial data dict (see #16138) """ initial_1 = FormMixin().get_initial() @@ -97,7 +99,7 @@ class BasicFormTests(TestCase): self.assertRedirects(res, '/list/authors/') -class ModelFormMixinTests(TestCase): +class ModelFormMixinTests(SimpleTestCase): def test_get_form(self): form_class = views.AuthorGetQuerySetFormView().get_form_class() self.assertEqual(form_class._meta.model, Author) diff --git a/tests/gis_tests/maps/tests.py b/tests/gis_tests/maps/tests.py index 3bcd38e485..c62b9e6735 100644 --- a/tests/gis_tests/maps/tests.py +++ b/tests/gis_tests/maps/tests.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from unittest import skipUnless from django.contrib.gis.geos import HAS_GEOS -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import modify_settings, override_settings from django.utils.encoding import force_text @@ -15,7 +15,7 @@ GOOGLE_MAPS_API_KEY = 'XXXX' @modify_settings( INSTALLED_APPS={'append': 'django.contrib.gis'}, ) -class GoogleMapsTest(TestCase): +class GoogleMapsTest(SimpleTestCase): @override_settings(GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY) def test_google_map_scripts(self): diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index e7c03dd971..6097754b59 100644 --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -6,13 +6,13 @@ from django.core.handlers.wsgi import WSGIHandler, WSGIRequest, get_script_name from django.core.signals import request_finished, request_started from django.db import close_old_connections, connection from django.test import ( - RequestFactory, TestCase, TransactionTestCase, override_settings, + RequestFactory, SimpleTestCase, TransactionTestCase, override_settings, ) from django.utils import six from django.utils.encoding import force_str -class HandlerTests(TestCase): +class HandlerTests(SimpleTestCase): def setUp(self): request_started.disconnect(close_old_connections) @@ -137,7 +137,7 @@ class TransactionsPerRequestTests(TransactionTestCase): @override_settings(ROOT_URLCONF='handlers.urls') -class SignalsTests(TestCase): +class SignalsTests(SimpleTestCase): def setUp(self): self.signals = [] @@ -170,7 +170,7 @@ class SignalsTests(TestCase): @override_settings(ROOT_URLCONF='handlers.urls') -class HandlerSuspiciousOpsTest(TestCase): +class HandlerSuspiciousOpsTest(SimpleTestCase): def test_suspiciousop_in_view_returns_400(self): response = self.client.get('/suspicious/') @@ -178,7 +178,7 @@ class HandlerSuspiciousOpsTest(TestCase): @override_settings(ROOT_URLCONF='handlers.urls') -class HandlerNotFoundTest(TestCase): +class HandlerNotFoundTest(SimpleTestCase): def test_invalid_urls(self): response = self.client.get('~%A9helloworld') @@ -202,7 +202,7 @@ class HandlerNotFoundTest(TestCase): self.assertIsInstance(environ['PATH_INFO'], six.text_type) -class ScriptNameTests(TestCase): +class ScriptNameTests(SimpleTestCase): def test_get_script_name(self): # Regression test for #23173 # Test first without PATH_INFO diff --git a/tests/http_utils/tests.py b/tests/http_utils/tests.py index a75cc7ab21..53e06c8938 100644 --- a/tests/http_utils/tests.py +++ b/tests/http_utils/tests.py @@ -5,7 +5,7 @@ import io from django.http import HttpRequest, HttpResponse, StreamingHttpResponse from django.http.utils import conditional_content_removal -from django.test import TestCase +from django.test import SimpleTestCase # based on Python 3.3's gzip.compress @@ -19,7 +19,7 @@ def gzip_compress(data): return buf.getvalue() -class HttpUtilTests(TestCase): +class HttpUtilTests(SimpleTestCase): def test_conditional_content_removal(self): """ diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index a51609097f..3f641da89b 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -17,7 +17,7 @@ from django.http import ( HttpResponseRedirect, JsonResponse, QueryDict, SimpleCookie, StreamingHttpResponse, parse_cookie, ) -from django.test import TestCase +from django.test import SimpleTestCase from django.utils import six from django.utils._os import upath from django.utils.encoding import force_text, smart_str @@ -425,7 +425,7 @@ class HttpResponseTests(unittest.TestCase): HttpResponsePermanentRedirect, url) -class HttpResponseSubclassesTests(TestCase): +class HttpResponseSubclassesTests(SimpleTestCase): def test_redirect(self): response = HttpResponseRedirect('/redirected/') self.assertEqual(response.status_code, 302) @@ -460,7 +460,7 @@ class HttpResponseSubclassesTests(TestCase): self.assertContains(response, 'Only the GET method is allowed', status_code=405) -class JsonResponseTests(TestCase): +class JsonResponseTests(SimpleTestCase): def test_json_response_non_ascii(self): data = {'key': 'łóżko'} response = JsonResponse(data) @@ -489,7 +489,7 @@ class JsonResponseTests(TestCase): self.assertEqual(json.loads(response.content.decode()), {'foo': 'bar'}) -class StreamingHttpResponseTests(TestCase): +class StreamingHttpResponseTests(SimpleTestCase): def test_streaming_response(self): r = StreamingHttpResponse(iter(['hello', 'world'])) @@ -554,7 +554,7 @@ class StreamingHttpResponseTests(TestCase): self.assertEqual(r.getvalue(), b'helloworld') -class FileCloseTests(TestCase): +class FileCloseTests(SimpleTestCase): def setUp(self): # Disable the request_finished signal during this test diff --git a/tests/i18n/patterns/tests.py b/tests/i18n/patterns/tests.py index eb020fbdaf..a5a012be27 100644 --- a/tests/i18n/patterns/tests.py +++ b/tests/i18n/patterns/tests.py @@ -7,7 +7,7 @@ from django.core.urlresolvers import clear_url_caches, reverse, translate_url from django.http import HttpResponsePermanentRedirect from django.middleware.locale import LocaleMiddleware from django.template import Context, Template -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.test.utils import override_script_prefix from django.utils import translation from django.utils._os import upath @@ -43,7 +43,7 @@ class PermanentRedirectLocaleMiddleWare(LocaleMiddleware): }, }], ) -class URLTestCaseBase(TestCase): +class URLTestCaseBase(SimpleTestCase): """ TestCase base-class for the URL tests. """ diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 751419ffcb..24951633de 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -14,7 +14,9 @@ from unittest import skipUnless from django import forms from django.conf import settings from django.template import Context, Template, TemplateSyntaxError -from django.test import RequestFactory, TestCase, override_settings +from django.test import ( + RequestFactory, SimpleTestCase, TestCase, override_settings, +) from django.utils import six, translation from django.utils._os import upath from django.utils.formats import ( @@ -54,7 +56,7 @@ def patch_formats(lang, **settings): reset_format_cache() -class TranslationTests(TestCase): +class TranslationTests(SimpleTestCase): @translation.override('fr') def test_plural(self): @@ -427,7 +429,7 @@ class TranslationTests(TestCase): self.assertEqual(rendered, 'My other name is James.') -class TranslationThreadSafetyTests(TestCase): +class TranslationThreadSafetyTests(SimpleTestCase): def setUp(self): self._old_language = get_language() @@ -459,7 +461,7 @@ class TranslationThreadSafetyTests(TestCase): @override_settings(USE_L10N=True) -class FormattingTests(TestCase): +class FormattingTests(SimpleTestCase): def setUp(self): super(FormattingTests, self).setUp() @@ -906,7 +908,7 @@ class FormattingTests(TestCase): ) -class MiscTests(TestCase): +class MiscTests(SimpleTestCase): def setUp(self): super(MiscTests, self).setUp() @@ -1136,7 +1138,7 @@ class MiscTests(TestCase): self.assertNotEqual('pt-br', g(r)) -class ResolutionOrderI18NTests(TestCase): +class ResolutionOrderI18NTests(SimpleTestCase): def setUp(self): super(ResolutionOrderI18NTests, self).setUp() @@ -1205,7 +1207,7 @@ class TestModels(TestCase): c.save() -class TestLanguageInfo(TestCase): +class TestLanguageInfo(SimpleTestCase): def test_localized_language_info(self): li = get_language_info('de') self.assertEqual(li['code'], 'de') @@ -1237,7 +1239,7 @@ class TestLanguageInfo(TestCase): self.assertEqual(li['code'], 'zh-hans') -class MultipleLocaleActivationTests(TestCase): +class MultipleLocaleActivationTests(SimpleTestCase): """ Tests for template rendering behavior when multiple locales are activated during the lifetime of the same process. @@ -1409,7 +1411,7 @@ class LocaleMiddlewareTests(TestCase): ], ROOT_URLCONF='i18n.urls' ) -class CountrySpecificLanguageTests(TestCase): +class CountrySpecificLanguageTests(SimpleTestCase): def setUp(self): super(CountrySpecificLanguageTests, self).setUp() @@ -1459,7 +1461,7 @@ class CountrySpecificLanguageTests(TestCase): self.assertEqual('pt-br', lang) -class TranslationFilesMissing(TestCase): +class TranslationFilesMissing(SimpleTestCase): def setUp(self): super(TranslationFilesMissing, self).setUp() diff --git a/tests/invalid_models_tests/base.py b/tests/invalid_models_tests/base.py index a180eec6e2..9459b313d6 100644 --- a/tests/invalid_models_tests/base.py +++ b/tests/invalid_models_tests/base.py @@ -2,10 +2,10 @@ from __future__ import unicode_literals from django.apps import apps -from django.test import TestCase +from django.test import SimpleTestCase -class IsolatedModelsTestCase(TestCase): +class IsolatedModelsTestCase(SimpleTestCase): def setUp(self): # The unmanaged models need to be removed after the test in order to diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py index 9baaf70feb..033970aae4 100644 --- a/tests/invalid_models_tests/test_ordinary_fields.py +++ b/tests/invalid_models_tests/test_ordinary_fields.py @@ -5,6 +5,7 @@ import unittest from django.core.checks import Error, Warning as DjangoWarning from django.db import connection, models +from django.test import TestCase from django.test.utils import override_settings from django.utils.timezone import now @@ -64,7 +65,7 @@ class BooleanFieldTests(IsolatedModelsTestCase): self.assertEqual(errors, expected) -class CharFieldTests(IsolatedModelsTestCase): +class CharFieldTests(IsolatedModelsTestCase, TestCase): def test_valid_field(self): class Model(models.Model): @@ -215,7 +216,7 @@ class CharFieldTests(IsolatedModelsTestCase): self.assertEqual(errors, expected) -class DateFieldTests(IsolatedModelsTestCase): +class DateFieldTests(IsolatedModelsTestCase, TestCase): def test_auto_now_and_auto_now_add_raise_error(self): class Model(models.Model): @@ -281,7 +282,7 @@ class DateFieldTests(IsolatedModelsTestCase): self.test_fix_default_value() -class DateTimeFieldTests(IsolatedModelsTestCase): +class DateTimeFieldTests(IsolatedModelsTestCase, TestCase): def test_fix_default_value(self): class Model(models.Model): @@ -548,7 +549,7 @@ class IntegerFieldTests(IsolatedModelsTestCase): self.assertEqual(errors, expected) -class TimeFieldTests(IsolatedModelsTestCase): +class TimeFieldTests(IsolatedModelsTestCase, TestCase): def test_fix_default_value(self): class Model(models.Model): diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index 5ee1092c41..c1768da838 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -8,7 +8,7 @@ from admin_scripts.tests import AdminScriptTestCase from django.core import mail from django.core.files.temp import NamedTemporaryFile -from django.test import RequestFactory, TestCase, override_settings +from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.utils import LoggingCaptureMixin, patch_logger from django.utils.deprecation import RemovedInNextVersionWarning from django.utils.encoding import force_text @@ -39,7 +39,7 @@ OLD_LOGGING = { } -class LoggingFiltersTest(TestCase): +class LoggingFiltersTest(SimpleTestCase): def test_require_debug_false_filter(self): """ Test the RequireDebugFalse filter class. @@ -65,7 +65,7 @@ class LoggingFiltersTest(TestCase): self.assertEqual(filter_.filter("record is not used"), False) -class DefaultLoggingTest(LoggingCaptureMixin, TestCase): +class DefaultLoggingTest(LoggingCaptureMixin, SimpleTestCase): def test_django_logger(self): """ @@ -79,7 +79,7 @@ class DefaultLoggingTest(LoggingCaptureMixin, TestCase): self.assertEqual(self.logger_output.getvalue(), 'Hey, this is an error.\n') -class WarningLoggerTests(TestCase): +class WarningLoggerTests(SimpleTestCase): """ Tests that warnings output for RemovedInDjangoXXWarning (XX being the next Django version) is enabled and captured to the logging system @@ -137,7 +137,7 @@ class WarningLoggerTests(TestCase): warnings.warn('Foo Deprecated', RemovedInNextVersionWarning) -class CallbackFilterTest(TestCase): +class CallbackFilterTest(SimpleTestCase): def test_sense(self): f_false = CallbackFilter(lambda r: False) f_true = CallbackFilter(lambda r: True) @@ -158,7 +158,7 @@ class CallbackFilterTest(TestCase): self.assertEqual(collector, ["a record"]) -class AdminEmailHandlerTest(TestCase): +class AdminEmailHandlerTest(SimpleTestCase): logger = logging.getLogger('django') def get_admin_email_handler(self, logger): @@ -385,7 +385,7 @@ def dictConfig(config): dictConfig.called = False -class SetupConfigureLogging(TestCase): +class SetupConfigureLogging(SimpleTestCase): """ Test that calling django.setup() initializes the logging configuration. """ @@ -398,7 +398,7 @@ class SetupConfigureLogging(TestCase): @override_settings(DEBUG=True, ROOT_URLCONF='logging_tests.urls') -class SecurityLoggerTest(TestCase): +class SecurityLoggerTest(SimpleTestCase): def test_suspicious_operation_creates_log_message(self): with patch_logger('django.security.SuspiciousOperation', 'error') as calls: diff --git a/tests/messages_tests/test_api.py b/tests/messages_tests/test_api.py index f79db95866..b629ef49da 100644 --- a/tests/messages_tests/test_api.py +++ b/tests/messages_tests/test_api.py @@ -1,5 +1,5 @@ from django.contrib import messages -from django.test import RequestFactory, TestCase +from django.test import RequestFactory, SimpleTestCase class DummyStorage(object): @@ -14,7 +14,7 @@ class DummyStorage(object): self.store.append(message) -class ApiTest(TestCase): +class ApiTest(SimpleTestCase): def setUp(self): self.rf = RequestFactory() self.request = self.rf.request() diff --git a/tests/messages_tests/test_cookie.py b/tests/messages_tests/test_cookie.py index 1ce04bd691..c70e253d7d 100644 --- a/tests/messages_tests/test_cookie.py +++ b/tests/messages_tests/test_cookie.py @@ -5,7 +5,7 @@ from django.contrib.messages.storage.base import Message from django.contrib.messages.storage.cookie import ( CookieStorage, MessageDecoder, MessageEncoder, ) -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.utils.safestring import SafeData, mark_safe from .base import BaseTests @@ -43,7 +43,7 @@ def stored_cookie_messages_count(storage, response): @override_settings(SESSION_COOKIE_DOMAIN='.example.com', SESSION_COOKIE_SECURE=True, SESSION_COOKIE_HTTPONLY=True) -class CookieTest(BaseTests, TestCase): +class CookieTest(BaseTests, SimpleTestCase): storage_class = CookieStorage def stored_messages_count(self, storage, response): diff --git a/tests/messages_tests/test_fallback.py b/tests/messages_tests/test_fallback.py index a57acc728a..647941b8b2 100644 --- a/tests/messages_tests/test_fallback.py +++ b/tests/messages_tests/test_fallback.py @@ -2,14 +2,14 @@ from django.contrib.messages import constants from django.contrib.messages.storage.fallback import ( CookieStorage, FallbackStorage, ) -from django.test import TestCase +from django.test import SimpleTestCase from .base import BaseTests from .test_cookie import set_cookie_data, stored_cookie_messages_count from .test_session import set_session_data, stored_session_messages_count -class FallbackTest(BaseTests, TestCase): +class FallbackTest(BaseTests, SimpleTestCase): storage_class = FallbackStorage def get_request(self): diff --git a/tests/messages_tests/test_mixins.py b/tests/messages_tests/test_mixins.py index a90a37e98b..f59de5abd9 100644 --- a/tests/messages_tests/test_mixins.py +++ b/tests/messages_tests/test_mixins.py @@ -1,11 +1,11 @@ from django.core.urlresolvers import reverse -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from .urls import ContactFormViewWithMsg @override_settings(ROOT_URLCONF='messages_tests.urls') -class SuccessMessageMixinTests(TestCase): +class SuccessMessageMixinTests(SimpleTestCase): def test_set_messages_success(self): author = {'name': 'John Doe', diff --git a/tests/middleware/test_security.py b/tests/middleware/test_security.py index 7c0d50491a..3189c215b8 100644 --- a/tests/middleware/test_security.py +++ b/tests/middleware/test_security.py @@ -1,9 +1,9 @@ from django.http import HttpResponse -from django.test import RequestFactory, TestCase +from django.test import RequestFactory, SimpleTestCase from django.test.utils import override_settings -class SecurityMiddlewareTest(TestCase): +class SecurityMiddlewareTest(SimpleTestCase): @property def middleware(self): from django.middleware.security import SecurityMiddleware diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py index 8b20a0c627..db9de1e9b4 100644 --- a/tests/middleware/tests.py +++ b/tests/middleware/tests.py @@ -19,7 +19,7 @@ from django.middleware.common import ( ) from django.middleware.gzip import GZipMiddleware from django.middleware.http import ConditionalGetMiddleware -from django.test import RequestFactory, TestCase, override_settings +from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.utils import patch_logger from django.utils import six from django.utils.encoding import force_str @@ -28,7 +28,7 @@ from django.utils.six.moves.urllib.parse import quote @override_settings(ROOT_URLCONF='middleware.urls') -class CommonMiddlewareTest(TestCase): +class CommonMiddlewareTest(SimpleTestCase): rf = RequestFactory() @@ -289,7 +289,7 @@ class CommonMiddlewareTest(TestCase): IGNORABLE_404_URLS=[re.compile(r'foo')], MANAGERS=['PHB@dilbert.com'], ) -class BrokenLinkEmailsMiddlewareTest(TestCase): +class BrokenLinkEmailsMiddlewareTest(SimpleTestCase): rf = RequestFactory() @@ -353,7 +353,7 @@ class BrokenLinkEmailsMiddlewareTest(TestCase): @override_settings(ROOT_URLCONF='middleware.cond_get_urls') -class ConditionalGetMiddlewareTest(TestCase): +class ConditionalGetMiddlewareTest(SimpleTestCase): def setUp(self): self.req = RequestFactory().get('/') @@ -492,7 +492,7 @@ class ConditionalGetMiddlewareTest(TestCase): self.assertEqual(self.resp.status_code, 400) -class XFrameOptionsMiddlewareTest(TestCase): +class XFrameOptionsMiddlewareTest(SimpleTestCase): """ Tests for the X-Frame-Options clickjacking prevention middleware. """ @@ -610,7 +610,7 @@ class XFrameOptionsMiddlewareTest(TestCase): self.assertEqual(r['X-Frame-Options'], 'DENY') -class GZipMiddlewareTest(TestCase): +class GZipMiddlewareTest(SimpleTestCase): """ Tests the GZip middleware. """ @@ -717,7 +717,7 @@ class GZipMiddlewareTest(TestCase): @override_settings(USE_ETAGS=True) -class ETagGZipMiddlewareTest(TestCase): +class ETagGZipMiddlewareTest(SimpleTestCase): """ Tests if the ETag middleware behaves correctly with GZip middleware. """ diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py index 3e6cbb747c..eb80460bce 100644 --- a/tests/middleware_exceptions/tests.py +++ b/tests/middleware_exceptions/tests.py @@ -6,7 +6,7 @@ from django.core.signals import got_request_exception from django.http import HttpResponse from django.template import engines from django.template.response import TemplateResponse -from django.test import RequestFactory, TestCase, override_settings +from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.utils import patch_logger @@ -116,7 +116,7 @@ class NoResponseMiddleware(TestMiddleware): @override_settings(ROOT_URLCONF='middleware_exceptions.urls') -class BaseMiddlewareExceptionTest(TestCase): +class BaseMiddlewareExceptionTest(SimpleTestCase): def setUp(self): self.exceptions = [] @@ -827,7 +827,7 @@ _missing = object() @override_settings(ROOT_URLCONF='middleware_exceptions.urls') -class RootUrlconfTests(TestCase): +class RootUrlconfTests(SimpleTestCase): @override_settings(ROOT_URLCONF=None) def test_missing_root_urlconf(self): @@ -859,7 +859,7 @@ class MyMiddlewareWithExceptionMessage(object): DEBUG=True, ROOT_URLCONF='middleware_exceptions.urls', ) -class MiddlewareNotUsedTests(TestCase): +class MiddlewareNotUsedTests(SimpleTestCase): rf = RequestFactory() diff --git a/tests/migrations/test_graph.py b/tests/migrations/test_graph.py index 44608c0128..b4252a94c8 100644 --- a/tests/migrations/test_graph.py +++ b/tests/migrations/test_graph.py @@ -4,11 +4,11 @@ from django.db.migrations.exceptions import ( CircularDependencyError, NodeNotFoundError, ) from django.db.migrations.graph import RECURSION_DEPTH_WARNING, MigrationGraph -from django.test import TestCase +from django.test import SimpleTestCase from django.utils.encoding import force_text -class GraphTests(TestCase): +class GraphTests(SimpleTestCase): """ Tests the digraph structure. """ diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py index e639752082..e599baac83 100644 --- a/tests/migrations/test_optimizer.py +++ b/tests/migrations/test_optimizer.py @@ -2,12 +2,12 @@ from django.db import migrations, models from django.db.migrations.optimizer import MigrationOptimizer -from django.test import TestCase +from django.test import SimpleTestCase from .models import CustomModelBase, EmptyManager -class OptimizerTests(TestCase): +class OptimizerTests(SimpleTestCase): """ Tests the migration autodetector. """ diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index 3c6abe3a91..2ad8025122 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -7,7 +7,7 @@ from django.db.migrations.operations import ( from django.db.migrations.state import ( ModelState, ProjectState, get_related_models_recursive, ) -from django.test import SimpleTestCase, TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.utils import six from .models import ( @@ -16,7 +16,7 @@ from .models import ( ) -class StateTests(TestCase): +class StateTests(SimpleTestCase): """ Tests state construction, rendering and modification by operations. """ @@ -750,7 +750,7 @@ class StateTests(TestCase): self.assertEqual(list(choices_field.choices), choices) -class ModelStateTests(TestCase): +class ModelStateTests(SimpleTestCase): def test_custom_model_base(self): state = ModelState.from_model(ModelWithCustomBase) self.assertEqual(state.bases, (models.Model,)) diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index f0edfd3e30..ef9489748d 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -17,7 +17,7 @@ from django.db import migrations, models from django.db.migrations.writer import ( MigrationWriter, OperationWriter, SettingsReference, ) -from django.test import SimpleTestCase, TestCase, ignore_warnings +from django.test import SimpleTestCase, ignore_warnings from django.utils import datetime_safe, six from django.utils._os import upath from django.utils.deconstruct import deconstructible @@ -152,7 +152,7 @@ class OperationWriterTests(SimpleTestCase): ) -class WriterTests(TestCase): +class WriterTests(SimpleTestCase): """ Tests the migration writer (makes migration files from Migration instances) """ diff --git a/tests/model_fields/test_durationfield.py b/tests/model_fields/test_durationfield.py index fece35d57b..fb26baadc9 100644 --- a/tests/model_fields/test_durationfield.py +++ b/tests/model_fields/test_durationfield.py @@ -4,7 +4,7 @@ import json from django import forms from django.core import exceptions, serializers from django.db import models -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from .models import DurationModel, NullDurationModel @@ -46,7 +46,7 @@ class TestQuerying(TestCase): ) -class TestSerialization(TestCase): +class TestSerialization(SimpleTestCase): test_data = '[{"fields": {"field": "1 01:00:00"}, "model": "model_fields.durationmodel", "pk": null}]' def test_dumping(self): @@ -59,7 +59,7 @@ class TestSerialization(TestCase): self.assertEqual(instance.field, datetime.timedelta(days=1, hours=1)) -class TestValidation(TestCase): +class TestValidation(SimpleTestCase): def test_invalid_string(self): field = models.DurationField() @@ -73,7 +73,7 @@ class TestValidation(TestCase): ) -class TestFormField(TestCase): +class TestFormField(SimpleTestCase): # Tests for forms.DurationField are in the forms_tests app. def test_formfield(self): diff --git a/tests/model_fields/test_field_flags.py b/tests/model_fields/test_field_flags.py index 6e609e6794..84227d4192 100644 --- a/tests/model_fields/test_field_flags.py +++ b/tests/model_fields/test_field_flags.py @@ -72,7 +72,7 @@ FLAG_PROPERTIES_FOR_RELATIONS = ( ) -class FieldFlagsTests(test.TestCase): +class FieldFlagsTests(test.SimpleTestCase): @classmethod def setUpClass(cls): super(FieldFlagsTests, cls).setUpClass() diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py index 21c2869edf..e72a6bce56 100644 --- a/tests/model_fields/test_uuid.py +++ b/tests/model_fields/test_uuid.py @@ -3,7 +3,7 @@ import uuid from django.core import exceptions, serializers from django.db import models -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from .models import ( NullableUUIDModel, PrimaryKeyUUIDModel, RelatedToUUIDModel, UUIDGrandchild, @@ -47,7 +47,7 @@ class TestSaveLoad(TestCase): UUIDModel.objects.create, field='not-a-uuid') -class TestMigrations(TestCase): +class TestMigrations(SimpleTestCase): def test_deconstruct(self): field = models.UUIDField() @@ -76,7 +76,7 @@ class TestQuerying(TestCase): ) -class TestSerialization(TestCase): +class TestSerialization(SimpleTestCase): test_data = '[{"fields": {"field": "550e8400-e29b-41d4-a716-446655440000"}, "model": "model_fields.uuidmodel", "pk": null}]' def test_dumping(self): @@ -89,7 +89,7 @@ class TestSerialization(TestCase): self.assertEqual(instance.field, uuid.UUID('550e8400-e29b-41d4-a716-446655440000')) -class TestValidation(TestCase): +class TestValidation(SimpleTestCase): def test_invalid_uuid(self): field = models.UUIDField() with self.assertRaises(exceptions.ValidationError) as cm: diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index bb19af263c..8238aeaa93 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -223,7 +223,7 @@ class ForeignKeyTests(test.TestCase): ) -class ManyToManyFieldTests(test.TestCase): +class ManyToManyFieldTests(test.SimpleTestCase): def test_abstract_model_pending_operations(self): """ Many-to-many fields declared on abstract models should not add lazy relations to @@ -425,7 +425,7 @@ class BooleanFieldTests(test.TestCase): nb.save() # no error -class ChoicesTests(test.TestCase): +class ChoicesTests(test.SimpleTestCase): def test_choices_and_field_display(self): """ Check that get_choices and get_flatchoices interact with @@ -466,7 +466,7 @@ class SlugFieldTests(test.TestCase): self.assertEqual(bs.s, 'slug' * 50) -class ValidationTest(test.TestCase): +class ValidationTest(test.SimpleTestCase): def test_charfield_raises_error_on_empty_string(self): f = models.CharField() self.assertRaises(ValidationError, f.clean, "", None) @@ -738,7 +738,7 @@ class GenericIPAddressFieldTests(test.TestCase): self.assertEqual(loaded.ip, instance.ip) -class PromiseTest(test.TestCase): +class PromiseTest(test.SimpleTestCase): def test_AutoField(self): lazy_func = lazy(lambda: 1, int) self.assertIsInstance( diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 377d96e64b..7de74e4343 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -18,7 +18,7 @@ from django.forms.models import ( modelform_factory, ) from django.template import Context, Template -from django.test import TestCase, skipUnlessDBFeature +from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.utils import six from django.utils._os import upath @@ -551,7 +551,7 @@ class FieldOverridesByFormMetaForm(forms.ModelForm): } -class TestFieldOverridesByFormMeta(TestCase): +class TestFieldOverridesByFormMeta(SimpleTestCase): def test_widget_overrides(self): form = FieldOverridesByFormMetaForm() self.assertHTMLEqual( @@ -633,7 +633,7 @@ class IncompleteCategoryFormWithExclude(forms.ModelForm): model = Category -class ValidationTest(TestCase): +class ValidationTest(SimpleTestCase): def test_validates_with_replaced_field_not_specified(self): form = IncompleteCategoryFormWithFields(data={'name': 'some name', 'slug': 'some-slug'}) assert form.is_valid() @@ -2117,7 +2117,7 @@ class FileAndImageFieldTests(TestCase): instance.delete() -class ModelOtherFieldTests(TestCase): +class ModelOtherFieldTests(SimpleTestCase): def test_big_integer_field(self): bif = BigIntForm({'biggie': '-9223372036854775808'}) self.assertTrue(bif.is_valid()) @@ -2326,7 +2326,7 @@ class OtherModelFormTests(TestCase): self.assertFalse(bound_form.has_changed()) -class ModelFormCustomErrorTests(TestCase): +class ModelFormCustomErrorTests(SimpleTestCase): def test_custom_error_messages(self): data = {'name1': '@#$!!**@#$', 'name2': '@#$!!**@#$'} errors = CustomErrorMessageForm(data).errors @@ -2402,7 +2402,7 @@ class CustomCleanTests(TestCase): self.assertEqual(category.name, 'TEST') -class ModelFormInheritanceTests(TestCase): +class ModelFormInheritanceTests(SimpleTestCase): def test_form_subclass_inheritance(self): class Form(forms.Form): age = forms.IntegerField() @@ -2513,7 +2513,7 @@ class LimitChoicesToTest(TestCase): self.assertEqual(f.fields['custom'].queryset, 42) -class FormFieldCallbackTests(TestCase): +class FormFieldCallbackTests(SimpleTestCase): def test_baseform_with_widgets_in_meta(self): """Regression for #13095: Using base forms with widgets defined in Meta should not raise errors.""" @@ -2631,7 +2631,7 @@ class CustomMetaclassForm(six.with_metaclass(CustomMetaclass, forms.ModelForm)): pass -class CustomMetaclassTestCase(TestCase): +class CustomMetaclassTestCase(SimpleTestCase): def test_modelform_factory_metaclass(self): new_cls = modelform_factory(Person, fields="__all__", form=CustomMetaclassForm) self.assertEqual(new_cls.base_fields, {}) diff --git a/tests/model_meta/test_legacy.py b/tests/model_meta/test_legacy.py index c319f28fcc..917a7d4cf3 100644 --- a/tests/model_meta/test_legacy.py +++ b/tests/model_meta/test_legacy.py @@ -10,7 +10,7 @@ from .models import BasePerson, Person from .results import TEST_RESULTS -class OptionsBaseTests(test.TestCase): +class OptionsBaseTests(test.SimpleTestCase): def _map_related_query_names(self, res): return tuple((o.field.related_query_name(), m) for o, m in res) diff --git a/tests/model_meta/tests.py b/tests/model_meta/tests.py index 0db3f66151..b1ac639c40 100644 --- a/tests/model_meta/tests.py +++ b/tests/model_meta/tests.py @@ -5,7 +5,7 @@ from django.contrib.contenttypes.fields import ( from django.core.exceptions import FieldDoesNotExist from django.db.models.fields import CharField, Field, related from django.db.models.options import EMPTY_RELATION_TREE, IMMUTABLE_WARNING -from django.test import TestCase +from django.test import SimpleTestCase from .models import ( AbstractPerson, BasePerson, Child, CommonAncestor, FirstParent, Person, @@ -14,7 +14,7 @@ from .models import ( from .results import TEST_RESULTS -class OptionsBaseTests(TestCase): +class OptionsBaseTests(SimpleTestCase): def _map_related_query_names(self, res): return tuple((o.name, m) for o, m in res) @@ -205,7 +205,7 @@ class GetFieldByNameTests(OptionsBaseTests): opts.apps.models_ready = True -class RelationTreeTests(TestCase): +class RelationTreeTests(SimpleTestCase): all_models = (Relation, AbstractPerson, BasePerson, Person, ProxyPerson, Relating) def setUp(self): @@ -260,7 +260,7 @@ class RelationTreeTests(TestCase): self.assertEqual([field.related_query_name() for field in AbstractPerson._meta._relation_tree], []) -class ParentListTests(TestCase): +class ParentListTests(SimpleTestCase): def test_get_parent_list(self): self.assertEqual(CommonAncestor._meta.get_parent_list(), []) self.assertEqual(FirstParent._meta.get_parent_list(), [CommonAncestor]) diff --git a/tests/model_permalink/tests.py b/tests/model_permalink/tests.py index 6d508c282e..3bc59d930f 100644 --- a/tests/model_permalink/tests.py +++ b/tests/model_permalink/tests.py @@ -1,10 +1,10 @@ -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from .models import Guitarist @override_settings(ROOT_URLCONF='model_permalink.urls') -class PermalinkTests(TestCase): +class PermalinkTests(SimpleTestCase): def test_permalink(self): g = Guitarist(name='Adrien Moignard', slug='adrienmoignard') diff --git a/tests/model_validation/tests.py b/tests/model_validation/tests.py index 677e21b37a..ba91f326ee 100644 --- a/tests/model_validation/tests.py +++ b/tests/model_validation/tests.py @@ -1,7 +1,7 @@ from django.core import management from django.core.checks import Error, run_checks from django.db.models.signals import post_init -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import override_settings from django.utils import six @@ -19,7 +19,7 @@ def on_post_init(**kwargs): INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes'], SILENCED_SYSTEM_CHECKS=['fields.W342'], # ForeignKey(unique=True) ) -class ModelValidationTest(TestCase): +class ModelValidationTest(SimpleTestCase): def test_models_validate(self): # All our models should validate properly # Validation Tests: diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index cc9c8f2de0..14ac030ec9 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -12,7 +12,7 @@ from django.contrib.admin.widgets import AdminDateWidget, AdminRadioSelect from django.core.checks import Error from django.forms.models import BaseModelFormSet from django.forms.widgets import Select -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from django.utils import six from .models import ( @@ -536,7 +536,7 @@ class ModelAdminTests(TestCase): ['extra', 'transport', 'id', 'DELETE', 'main_band']) -class CheckTestCase(TestCase): +class CheckTestCase(SimpleTestCase): def assertIsInvalid(self, model_admin, model, msg, id=None, hint=None, invalid_obj=None): @@ -1526,7 +1526,7 @@ class ListDisplayEditableTests(CheckTestCase): self.assertIsValid(ProductAdmin, ValidationTestModel) -class ModelAdminPermissionTests(TestCase): +class ModelAdminPermissionTests(SimpleTestCase): class MockUser(object): def has_module_perms(self, app_label): diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index 299ada97b1..1dadb3bea4 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -11,7 +11,7 @@ from django.core import management from django.db import DEFAULT_DB_ALIAS, connections, router, transaction from django.db.models import signals from django.db.utils import ConnectionRouter -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, TestCase, override_settings from django.utils.encoding import force_text from django.utils.six import StringIO @@ -862,7 +862,7 @@ class QueryTestCase(TestCase): extra_arg=True) -class ConnectionRouterTestCase(TestCase): +class ConnectionRouterTestCase(SimpleTestCase): @override_settings(DATABASE_ROUTERS=[ 'multiple_database.tests.TestRouter', 'multiple_database.tests.WriteRouter']) diff --git a/tests/no_models/tests.py b/tests/no_models/tests.py index bd17364071..de2d854006 100644 --- a/tests/no_models/tests.py +++ b/tests/no_models/tests.py @@ -1,8 +1,8 @@ from django.apps import apps -from django.test import TestCase +from django.test import SimpleTestCase -class NoModelTests(TestCase): +class NoModelTests(SimpleTestCase): def test_no_models(self): """Test that it's possible to load an app with no models.py file.""" diff --git a/tests/resolve_url/tests.py b/tests/resolve_url/tests.py index b8ccd530e1..14c0fbb364 100644 --- a/tests/resolve_url/tests.py +++ b/tests/resolve_url/tests.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.contrib.auth.views import logout from django.core.urlresolvers import NoReverseMatch, reverse_lazy from django.shortcuts import resolve_url -from django.test import TestCase, ignore_warnings, override_settings +from django.test import SimpleTestCase, ignore_warnings, override_settings from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning @@ -11,7 +11,7 @@ from .models import UnimportantThing @override_settings(ROOT_URLCONF='resolve_url.urls') -class ResolveUrlTests(TestCase): +class ResolveUrlTests(SimpleTestCase): """ Tests for the ``resolve_url`` function. """ diff --git a/tests/select_related/tests.py b/tests/select_related/tests.py index 667ac2f00b..9a027ac18c 100644 --- a/tests/select_related/tests.py +++ b/tests/select_related/tests.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from django.core.exceptions import FieldError -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from .models import ( Bookmark, Domain, Family, Genus, HybridSpecies, Kingdom, Klass, Order, @@ -164,7 +164,7 @@ class SelectRelatedTests(TestCase): self.assertEqual(obj.parent_2, parent_2) -class SelectRelatedValidationTests(TestCase): +class SelectRelatedValidationTests(SimpleTestCase): """ select_related() should thrown an error on fields that do not exist and non-relational fields. diff --git a/tests/select_related_onetoone/tests.py b/tests/select_related_onetoone/tests.py index 2cb17a5ba9..b047168795 100644 --- a/tests/select_related_onetoone/tests.py +++ b/tests/select_related_onetoone/tests.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import unittest from django.core.exceptions import FieldError -from django.test import TestCase +from django.test import SimpleTestCase, TestCase from .models import ( AdvancedUserStat, Child1, Child2, Child3, Child4, Image, Parent1, Parent2, @@ -213,7 +213,7 @@ class ReverseSelectRelatedTestCase(TestCase): self.assertEqual(p.child1.child4.name1, 'n1') -class ReverseSelectRelatedValidationTests(TestCase): +class ReverseSelectRelatedValidationTests(SimpleTestCase): """ Rverse related fields should be listed in the validation message when an invalid field is given in select_related(). diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py index db2f07d41d..c223fc4036 100644 --- a/tests/serializers/tests.py +++ b/tests/serializers/tests.py @@ -11,7 +11,8 @@ from xml.dom import minidom from django.core import management, serializers from django.db import connection, transaction from django.test import ( - TestCase, TransactionTestCase, override_settings, skipUnlessDBFeature, + SimpleTestCase, TestCase, TransactionTestCase, override_settings, + skipUnlessDBFeature, ) from django.test.utils import Approximate from django.utils import six @@ -34,7 +35,7 @@ except ImportError: "json2": "django.core.serializers.json", } ) -class SerializerRegistrationTests(TestCase): +class SerializerRegistrationTests(SimpleTestCase): def setUp(self): self.old_serializers = serializers._serializers serializers._serializers = {} @@ -664,7 +665,7 @@ class YamlImportModuleMock(object): return self._import_module(module_path) -class NoYamlSerializerTestCase(TestCase): +class NoYamlSerializerTestCase(SimpleTestCase): """Not having pyyaml installed provides a misleading error Refs: #12756 diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index e98a721818..6a83c88368 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -19,7 +19,7 @@ from django.core.serializers.base import DeserializationError from django.core.serializers.xml_serializer import DTDForbidden from django.db import connection, models from django.http import HttpResponse -from django.test import TestCase, skipUnlessDBFeature +from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.utils import six from django.utils.functional import curry @@ -584,7 +584,7 @@ for format in [f for f in serializers.get_serializer_formats() setattr(SerializerTests, 'test_' + format + '_serializer_stream', curry(streamTest, format)) -class XmlDeserializerSecurityTests(TestCase): +class XmlDeserializerSecurityTests(SimpleTestCase): def test_no_dtd(self): """ diff --git a/tests/servers/test_basehttp.py b/tests/servers/test_basehttp.py index 2f59b1358a..91dcaa17d9 100644 --- a/tests/servers/test_basehttp.py +++ b/tests/servers/test_basehttp.py @@ -1,6 +1,6 @@ from django.core.handlers.wsgi import WSGIRequest from django.core.servers.basehttp import WSGIRequestHandler -from django.test import TestCase +from django.test import SimpleTestCase from django.test.client import RequestFactory from django.test.utils import captured_stderr from django.utils.six import BytesIO @@ -11,7 +11,7 @@ class Stub(object): self.__dict__.update(kwargs) -class WSGIRequestHandlerTestCase(TestCase): +class WSGIRequestHandlerTestCase(SimpleTestCase): def test_https(self): request = WSGIRequest(RequestFactory().get('/').environ) request.makefile = lambda *args, **kwargs: BytesIO() diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index 377a22916c..97fb72baa5 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -152,7 +152,7 @@ class ChildDecoratedTestCase(ParentDecoratedTestCase): self.assertEqual(settings.TEST, 'override-child') -class SettingsTests(TestCase): +class SettingsTests(SimpleTestCase): def setUp(self): self.testvalue = None signals.setting_changed.connect(self.signal_callback) @@ -279,7 +279,7 @@ class SettingsTests(TestCase): self.assertRaises(AttributeError, getattr, settings, 'TEST2') -class TestComplexSettingOverride(TestCase): +class TestComplexSettingOverride(SimpleTestCase): def setUp(self): self.old_warn_override_settings = signals.COMPLEX_OVERRIDE_SETTINGS.copy() signals.COMPLEX_OVERRIDE_SETTINGS.add('TEST_WARN') @@ -304,7 +304,7 @@ class TestComplexSettingOverride(TestCase): 'Overriding setting TEST_WARN can lead to unexpected behavior.') -class TrailingSlashURLTests(TestCase): +class TrailingSlashURLTests(SimpleTestCase): """ Tests for the MEDIA_URL and STATIC_URL settings. @@ -386,7 +386,7 @@ class TrailingSlashURLTests(TestCase): self.settings_module.STATIC_URL) -class SecureProxySslHeaderTest(TestCase): +class SecureProxySslHeaderTest(SimpleTestCase): settings_module = settings def setUp(self): @@ -418,7 +418,7 @@ class SecureProxySslHeaderTest(TestCase): self.assertEqual(req.is_secure(), True) -class IsOverriddenTest(TestCase): +class IsOverriddenTest(SimpleTestCase): def test_configure(self): s = LazySettings() s.configure(SECRET_KEY='foo') diff --git a/tests/shortcuts/tests.py b/tests/shortcuts/tests.py index 08bcc55343..74acb13d7e 100644 --- a/tests/shortcuts/tests.py +++ b/tests/shortcuts/tests.py @@ -1,4 +1,4 @@ -from django.test import TestCase, ignore_warnings, override_settings +from django.test import SimpleTestCase, ignore_warnings, override_settings from django.test.utils import require_jinja2 from django.utils.deprecation import RemovedInDjango20Warning @@ -6,7 +6,7 @@ from django.utils.deprecation import RemovedInDjango20Warning @override_settings( ROOT_URLCONF='shortcuts.urls', ) -class ShortcutTests(TestCase): +class ShortcutTests(SimpleTestCase): def test_render_to_response(self): response = self.client.get('/render_to_response/') diff --git a/tests/signed_cookies_tests/tests.py b/tests/signed_cookies_tests/tests.py index e53d7bd624..6c3ba8c0ce 100644 --- a/tests/signed_cookies_tests/tests.py +++ b/tests/signed_cookies_tests/tests.py @@ -2,11 +2,11 @@ from __future__ import unicode_literals from django.core import signing from django.http import HttpRequest, HttpResponse -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.test.utils import freeze_time -class SignedCookieTest(TestCase): +class SignedCookieTest(SimpleTestCase): def test_can_set_and_read_signed_cookies(self): response = HttpResponse() diff --git a/tests/signing/tests.py b/tests/signing/tests.py index 006151baf6..80dadee7f4 100644 --- a/tests/signing/tests.py +++ b/tests/signing/tests.py @@ -3,13 +3,13 @@ from __future__ import unicode_literals import datetime from django.core import signing -from django.test import TestCase +from django.test import SimpleTestCase from django.test.utils import freeze_time from django.utils import six from django.utils.encoding import force_str -class TestSigner(TestCase): +class TestSigner(SimpleTestCase): def test_signature(self): "signature() method should generate a signature" @@ -113,7 +113,7 @@ class TestSigner(TestCase): self.assertEqual('foo:6NB0fssLW5RQvZ3Y-MTerq2rX7w', s.sign('foo')) -class TestTimestampSigner(TestCase): +class TestTimestampSigner(SimpleTestCase): def test_timestamp_signer(self): value = 'hello' diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py index 92f36f637a..52a45d2ccf 100644 --- a/tests/staticfiles_tests/tests.py +++ b/tests/staticfiles_tests/tests.py @@ -18,7 +18,7 @@ from django.core.cache.backends.base import BaseCache from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django.template import Context, Template -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.utils import six from django.utils._os import symlinks_supported, upath from django.utils.encoding import force_text @@ -85,7 +85,7 @@ class BaseStaticFilesTestCase(object): @override_settings(**TEST_SETTINGS) -class StaticFilesTestCase(BaseStaticFilesTestCase, TestCase): +class StaticFilesTestCase(BaseStaticFilesTestCase, SimpleTestCase): pass @@ -596,7 +596,7 @@ class TestHashedFiles(object): DEBUG=False, )) class TestCollectionCachedStorage(TestHashedFiles, BaseCollectionTestCase, - BaseStaticFilesTestCase, TestCase): + BaseStaticFilesTestCase, SimpleTestCase): """ Tests for the Cache busting storage """ @@ -633,7 +633,7 @@ class TestCollectionCachedStorage(TestHashedFiles, BaseCollectionTestCase, DEBUG=False, )) class TestCollectionManifestStorage(TestHashedFiles, BaseCollectionTestCase, - BaseStaticFilesTestCase, TestCase): + BaseStaticFilesTestCase, SimpleTestCase): """ Tests for the Cache busting storage """ @@ -701,7 +701,7 @@ class TestCollectionManifestStorage(TestHashedFiles, BaseCollectionTestCase, DEBUG=False, )) class TestCollectionSimpleCachedStorage(BaseCollectionTestCase, - BaseStaticFilesTestCase, TestCase): + BaseStaticFilesTestCase, SimpleTestCase): """ Tests for the Cache busting storage """ @@ -863,7 +863,7 @@ class TestDefaultStorageFinder(StaticFilesTestCase, FinderTestCase): STATICFILES_FINDERS=['django.contrib.staticfiles.finders.FileSystemFinder'], STATICFILES_DIRS=[os.path.join(TEST_ROOT, 'project', 'documents')], ) -class TestMiscFinder(TestCase): +class TestMiscFinder(SimpleTestCase): """ A few misc finder tests. """ diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py index 39f5e5ee18..bef1146172 100644 --- a/tests/test_client/tests.py +++ b/tests/test_client/tests.py @@ -27,7 +27,9 @@ import datetime from django.contrib.auth.models import User from django.core import mail from django.http import HttpResponse -from django.test import Client, RequestFactory, TestCase, override_settings +from django.test import ( + Client, RequestFactory, SimpleTestCase, TestCase, override_settings, +) from .views import get_view, post_view, trace_view @@ -542,7 +544,7 @@ class ClientTest(TestCase): MIDDLEWARE_CLASSES=['django.middleware.csrf.CsrfViewMiddleware'], ROOT_URLCONF='test_client.urls', ) -class CSRFEnabledClientTests(TestCase): +class CSRFEnabledClientTests(SimpleTestCase): def test_csrf_enabled_client(self): "A client can be instantiated with CSRF checks enabled" @@ -561,7 +563,7 @@ class CustomTestClient(Client): i_am_customized = "Yes" -class CustomTestClientTest(TestCase): +class CustomTestClientTest(SimpleTestCase): client_class = CustomTestClient def test_custom_test_client(self): @@ -573,7 +575,7 @@ _generic_view = lambda request: HttpResponse(status=200) @override_settings(ROOT_URLCONF='test_client.urls') -class RequestFactoryTest(TestCase): +class RequestFactoryTest(SimpleTestCase): """Tests for the request factory.""" # A mapping between names of HTTP/1.1 methods and their test views. diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index cddb618792..f47ae10b56 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -14,7 +14,9 @@ from django.core.urlresolvers import NoReverseMatch, reverse from django.http import HttpResponse from django.template import Context, TemplateSyntaxError, engines from django.template.response import SimpleTemplateResponse -from django.test import Client, TestCase, ignore_warnings, override_settings +from django.test import ( + Client, SimpleTestCase, TestCase, ignore_warnings, override_settings, +) from django.test.client import RedirectCycleError, RequestFactory, encode_file from django.test.utils import ContextList, str_prefix from django.utils._os import upath @@ -52,7 +54,7 @@ class TestDataMixin(object): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class AssertContainsTests(TestCase): +class AssertContainsTests(SimpleTestCase): def test_contains(self): "Responses can be inspected for content, including counting repeated substrings" @@ -322,7 +324,7 @@ class AssertTemplateUsedTests(TestDataMixin, TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class AssertRedirectsTests(TestCase): +class AssertRedirectsTests(SimpleTestCase): def test_redirect_page(self): "An assertion is raised if the original page couldn't be retrieved as expected" @@ -529,7 +531,7 @@ class AssertRedirectsTests(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class AssertFormErrorTests(TestCase): +class AssertFormErrorTests(SimpleTestCase): def test_unknown_form(self): "An assertion is raised if the form name is unknown" @@ -646,7 +648,7 @@ class AssertFormErrorTests(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class AssertFormsetErrorTests(TestCase): +class AssertFormsetErrorTests(SimpleTestCase): msg_prefixes = [("", {}), ("abc: ", {"msg_prefix": "abc"})] def setUp(self): @@ -879,7 +881,7 @@ class SessionEngineTests(TestDataMixin, TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls',) -class URLEscapingTests(TestCase): +class URLEscapingTests(SimpleTestCase): def test_simple_argument_get(self): "Get a view that has a simple string argument" @@ -933,7 +935,7 @@ class ExceptionTests(TestDataMixin, TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class TemplateExceptionTests(TestCase): +class TemplateExceptionTests(SimpleTestCase): @override_settings(TEMPLATES=[{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -953,7 +955,7 @@ class TemplateExceptionTests(TestCase): # it was changed, and another one (without self.urls) to check it was reverted on # teardown. This pair of tests relies upon the alphabetical ordering of test execution. @override_settings(ROOT_URLCONF='test_client_regress.urls') -class UrlconfSubstitutionTests(TestCase): +class UrlconfSubstitutionTests(SimpleTestCase): def test_urlconf_was_changed(self): "TestCase can enforce a custom URLconf on a per-test basis" @@ -963,7 +965,7 @@ class UrlconfSubstitutionTests(TestCase): # This test needs to run *after* UrlconfSubstitutionTests; the zz prefix in the # name is to ensure alphabetical ordering. -class zzUrlconfSubstitutionTests(TestCase): +class zzUrlconfSubstitutionTests(SimpleTestCase): def test_urlconf_was_reverted(self): """URLconf is reverted to original value after modification in a TestCase @@ -1184,7 +1186,7 @@ class SessionTests(TestDataMixin, TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class RequestMethodTests(TestCase): +class RequestMethodTests(SimpleTestCase): def test_get(self): "Request a view via request method GET" @@ -1232,7 +1234,7 @@ class RequestMethodTests(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class RequestMethodStringDataTests(TestCase): +class RequestMethodStringDataTests(SimpleTestCase): def test_post(self): "Request a view with string data via request method POST" @@ -1270,7 +1272,7 @@ class RequestMethodStringDataTests(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls',) -class QueryStringTests(TestCase): +class QueryStringTests(SimpleTestCase): def test_get_like_requests(self): # See: https://code.djangoproject.com/ticket/10571. @@ -1316,7 +1318,7 @@ class QueryStringTests(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class UnicodePayloadTests(TestCase): +class UnicodePayloadTests(SimpleTestCase): def test_simple_unicode_payload(self): "A simple ASCII-only unicode JSON document can be POSTed" @@ -1359,7 +1361,7 @@ class DummyFile(object): return b'TEST_FILE_CONTENT' -class UploadedFileEncodingTest(TestCase): +class UploadedFileEncodingTest(SimpleTestCase): def test_file_encoding(self): encoded_file = encode_file('TEST_BOUNDARY', 'TEST_KEY', DummyFile('test_name.bin')) self.assertEqual(b'--TEST_BOUNDARY', encoded_file[0]) @@ -1381,7 +1383,7 @@ class UploadedFileEncodingTest(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls',) -class RequestHeadersTest(TestCase): +class RequestHeadersTest(SimpleTestCase): def test_client_headers(self): "A test client can receive custom headers" response = self.client.get("/check_headers/", HTTP_X_ARG_CHECK='Testing 123') @@ -1397,7 +1399,7 @@ class RequestHeadersTest(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class ReadLimitedStreamTest(TestCase): +class ReadLimitedStreamTest(SimpleTestCase): """ Tests that ensure that HttpRequest.body, HttpRequest.read() and HttpRequest.read(BUFFER) have proper LimitedStream behavior. @@ -1440,7 +1442,7 @@ class ReadLimitedStreamTest(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class RequestFactoryStateTest(TestCase): +class RequestFactoryStateTest(SimpleTestCase): """Regression tests for #15929.""" # These tests are checking that certain middleware don't change certain # global state. Alternatively, from the point of view of a test, they are @@ -1467,7 +1469,7 @@ class RequestFactoryStateTest(TestCase): @override_settings(ROOT_URLCONF='test_client_regress.urls') -class RequestFactoryEnvironmentTests(TestCase): +class RequestFactoryEnvironmentTests(SimpleTestCase): """ Regression tests for #8551 and #17067: ensure that environment variables are set correctly in RequestFactory. diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index dd68acdff9..7056ea33de 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -24,7 +24,7 @@ from .models import Car, Person, PossessedCar from .views import empty_response -class SkippingTestCase(TestCase): +class SkippingTestCase(SimpleTestCase): def _assert_skipping(self, func, expected_exc): # We cannot simply use assertRaises because a SkipTest exception will go unnoticed try: @@ -92,7 +92,7 @@ class SkippingTestCase(TestCase): self._assert_skipping(test_func5, ValueError) -class SkippingClassTestCase(TestCase): +class SkippingClassTestCase(SimpleTestCase): def test_skip_class_unless_db_feature(self): @skipUnlessDBFeature("__class__") class NotSkippedTests(unittest.TestCase): @@ -306,7 +306,7 @@ class AssertNumQueriesContextManagerTests(TestCase): @override_settings(ROOT_URLCONF='test_utils.urls') -class AssertTemplateUsedContextManagerTests(TestCase): +class AssertTemplateUsedContextManagerTests(SimpleTestCase): def test_usage(self): with self.assertTemplateUsed('template_used/base.html'): @@ -403,7 +403,7 @@ class AssertTemplateUsedContextManagerTests(TestCase): self.assertTemplateNotUsed(response, 'template.html') -class HTMLEqualTests(TestCase): +class HTMLEqualTests(SimpleTestCase): def test_html_parser(self): element = parse_html('

Hello

') self.assertEqual(len(element.children), 1) @@ -645,7 +645,7 @@ class HTMLEqualTests(TestCase): self.assertContains(response, '

Some help text for the title (with unicode ŠĐĆŽćžšđ)

', html=True) -class JSONEqualTests(TestCase): +class JSONEqualTests(SimpleTestCase): def test_simple_equal(self): json1 = '{"attr1": "foo", "attr2":"baz"}' json2 = '{"attr1": "foo", "attr2":"baz"}' @@ -690,7 +690,7 @@ class JSONEqualTests(TestCase): self.assertJSONNotEqual(valid_json, invalid_json) -class XMLEqualTests(TestCase): +class XMLEqualTests(SimpleTestCase): def test_simple_equal(self): xml1 = "" xml2 = "" @@ -784,7 +784,7 @@ class SecondUrls: urlpatterns = [url(r'second/$', empty_response, name='second')] -class OverrideSettingsTests(TestCase): +class OverrideSettingsTests(SimpleTestCase): # #21518 -- If neither override_settings nor a setting_changed receiver # clears the URL cache between tests, then one of test_first or diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index 30878e0d30..18539687a8 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -18,8 +18,8 @@ from django.template import ( Context, RequestContext, Template, TemplateSyntaxError, context_processors, ) from django.test import ( - TestCase, TransactionTestCase, override_settings, skipIfDBFeature, - skipUnlessDBFeature, + SimpleTestCase, TestCase, TransactionTestCase, override_settings, + skipIfDBFeature, skipUnlessDBFeature, ) from django.test.utils import requires_tz_support from django.utils import six, timezone @@ -656,7 +656,7 @@ class UnsupportedTimeZoneDatabaseTests(TestCase): @override_settings(TIME_ZONE='Africa/Nairobi') -class SerializationTests(TestCase): +class SerializationTests(SimpleTestCase): # Backend-specific notes: # - JSON supports only milliseconds, microseconds will be truncated. diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py index 82e99f0001..f863a089d4 100644 --- a/tests/urlpatterns_reverse/tests.py +++ b/tests/urlpatterns_reverse/tests.py @@ -183,7 +183,7 @@ test_data = ( @override_settings(ROOT_URLCONF='urlpatterns_reverse.no_urls') -class NoURLPatternsTests(TestCase): +class NoURLPatternsTests(SimpleTestCase): def test_no_urls_exception(self): """ @@ -201,7 +201,7 @@ class NoURLPatternsTests(TestCase): @override_settings(ROOT_URLCONF='urlpatterns_reverse.urls') -class URLPatternReverse(TestCase): +class URLPatternReverse(SimpleTestCase): @ignore_warnings(category=RemovedInDjango20Warning) def test_urlpattern_reverse(self): @@ -399,7 +399,7 @@ LOGIN_URL = reverse_lazy('login')""") @override_settings(ROOT_URLCONF='urlpatterns_reverse.urls') -class ReverseShortcutTests(TestCase): +class ReverseShortcutTests(SimpleTestCase): def test_redirect_to_object(self): # We don't really need a model; just something with a get_absolute_url @@ -458,7 +458,7 @@ class ReverseShortcutTests(TestCase): @override_settings(ROOT_URLCONF='urlpatterns_reverse.namespace_urls') -class NamespaceTests(TestCase): +class NamespaceTests(SimpleTestCase): def test_ambiguous_object(self): "Names deployed via dynamic URL objects that require namespaces can't be resolved" @@ -576,7 +576,7 @@ class NamespaceTests(TestCase): @override_settings(ROOT_URLCONF=urlconf_outer.__name__) -class RequestURLconfTests(TestCase): +class RequestURLconfTests(SimpleTestCase): def test_urlconf(self): response = self.client.get('/test/me/') self.assertEqual(response.status_code, 200) @@ -670,7 +670,7 @@ class RequestURLconfTests(TestCase): b''.join(self.client.get('/second_test/')) -class ErrorHandlerResolutionTests(TestCase): +class ErrorHandlerResolutionTests(SimpleTestCase): """Tests for handler400, handler404 and handler500""" def setUp(self): @@ -693,7 +693,7 @@ class ErrorHandlerResolutionTests(TestCase): @override_settings(ROOT_URLCONF='urlpatterns_reverse.urls_without_full_import') -class DefaultErrorHandlerTests(TestCase): +class DefaultErrorHandlerTests(SimpleTestCase): def test_default_handler(self): "If the urls.py doesn't specify handlers, the defaults are used" @@ -710,7 +710,7 @@ class DefaultErrorHandlerTests(TestCase): @override_settings(ROOT_URLCONF=None) -class NoRootUrlConfTests(TestCase): +class NoRootUrlConfTests(SimpleTestCase): """Tests for handler404 and handler500 if urlconf is None""" def test_no_handler_exception(self): @@ -718,7 +718,7 @@ class NoRootUrlConfTests(TestCase): @override_settings(ROOT_URLCONF='urlpatterns_reverse.namespace_urls') -class ResolverMatchTests(TestCase): +class ResolverMatchTests(SimpleTestCase): def test_urlpattern_resolve(self): for path, url_name, app_name, namespace, view_name, func, args, kwargs in resolve_test_data: @@ -755,7 +755,7 @@ class ResolverMatchTests(TestCase): @override_settings(ROOT_URLCONF='urlpatterns_reverse.erroneous_urls') -class ErroneousViewTests(TestCase): +class ErroneousViewTests(SimpleTestCase): def test_erroneous_resolve(self): self.assertRaises(ImportError, self.client.get, '/erroneous_inner/') @@ -777,7 +777,7 @@ class ErroneousViewTests(TestCase): self.assertRaises(ImproperlyConfigured, reverse, 'whatever blah blah') -class ViewLoadingTests(TestCase): +class ViewLoadingTests(SimpleTestCase): def test_view_loading(self): self.assertEqual(get_callable('urlpatterns_reverse.views.empty_view'), empty_view) @@ -803,7 +803,7 @@ class IncludeTests(SimpleTestCase): @override_settings(ROOT_URLCONF='urlpatterns_reverse.urls') -class LookaheadTests(TestCase): +class LookaheadTests(SimpleTestCase): def test_valid_resolve(self): test_urls = [ '/lookahead-/a-city/', diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index 89633bda60..11034c1c59 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -4,7 +4,7 @@ from importlib import import_module from django import conf from django.contrib import admin -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.test.utils import extend_sys_path from django.utils._os import npath, upath from django.utils.autoreload import gen_filenames @@ -12,7 +12,7 @@ from django.utils.autoreload import gen_filenames LOCALE_PATH = os.path.join(os.path.dirname(__file__), 'locale') -class TestFilenameGenerator(TestCase): +class TestFilenameGenerator(SimpleTestCase): def setUp(self): # Empty cached variables from django.utils import autoreload diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py index 1edf01422d..faf4b6605b 100644 --- a/tests/utils_tests/test_dateformat.py +++ b/tests/utils_tests/test_dateformat.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from datetime import date, datetime -from django.test import TestCase, override_settings +from django.test import SimpleTestCase, override_settings from django.test.utils import TZ_SUPPORT, requires_tz_support from django.utils import dateformat, translation from django.utils.dateformat import format @@ -12,7 +12,7 @@ from django.utils.timezone import ( @override_settings(TIME_ZONE='Europe/Copenhagen') -class DateFormatTests(TestCase): +class DateFormatTests(SimpleTestCase): def setUp(self): self._orig_lang = translation.get_language() diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py index 16b861bf1a..10531937ad 100644 --- a/tests/utils_tests/test_decorators.py +++ b/tests/utils_tests/test_decorators.py @@ -1,7 +1,7 @@ from django.http import HttpResponse from django.template import engines from django.template.response import TemplateResponse -from django.test import RequestFactory, TestCase +from django.test import RequestFactory, SimpleTestCase from django.utils.decorators import decorator_from_middleware @@ -28,7 +28,7 @@ class FullMiddleware(object): def process_request(self, request): request.process_request_reached = True - def process_view(sef, request, view_func, view_args, view_kwargs): + def process_view(self, request, view_func, view_args, view_kwargs): request.process_view_reached = True def process_template_response(self, request, response): @@ -44,7 +44,7 @@ class FullMiddleware(object): full_dec = decorator_from_middleware(FullMiddleware) -class DecoratorFromMiddlewareTests(TestCase): +class DecoratorFromMiddlewareTests(SimpleTestCase): """ Tests for view decorators created using ``django.utils.decorators.decorator_from_middleware``. diff --git a/tests/utils_tests/test_jslex.py b/tests/utils_tests/test_jslex.py index 2186af976b..42d0346144 100644 --- a/tests/utils_tests/test_jslex.py +++ b/tests/utils_tests/test_jslex.py @@ -3,11 +3,11 @@ # originally from https://bitbucket.org/ned/jslex from __future__ import unicode_literals -from django.test import TestCase +from django.test import SimpleTestCase from django.utils.jslex import JsLexer, prepare_js_for_gettext -class JsTokensTest(TestCase): +class JsTokensTest(SimpleTestCase): LEX_CASES = [ # ids ("a ABC $ _ a123", ["id a", "id ABC", "id $", "id _", "id a123"]), @@ -207,7 +207,7 @@ GETTEXT_CASES = ( ) -class JsToCForGettextTest(TestCase): +class JsToCForGettextTest(SimpleTestCase): pass diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py index c3f18f12d4..acd36053d6 100644 --- a/tests/utils_tests/test_safestring.py +++ b/tests/utils_tests/test_safestring.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from django.template import Context, Template -from django.test import TestCase +from django.test import SimpleTestCase from django.utils import html, six, text from django.utils.encoding import force_bytes, force_text from django.utils.functional import lazy @@ -20,7 +20,7 @@ class customescape(six.text_type): return self.replace('<', '<<').replace('>', '>>') -class SafeStringTest(TestCase): +class SafeStringTest(SimpleTestCase): def assertRenderEqual(self, tpl, expected, **context): context = Context(context) tpl = Template(tpl) diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py index 9baee9ce34..ff30becc11 100644 --- a/tests/view_tests/tests/test_csrf.py +++ b/tests/view_tests/tests/test_csrf.py @@ -1,9 +1,9 @@ -from django.test import Client, TestCase, override_settings +from django.test import Client, SimpleTestCase, override_settings from django.utils.translation import override @override_settings(ROOT_URLCONF="view_tests.urls") -class CsrfViewTests(TestCase): +class CsrfViewTests(SimpleTestCase): def setUp(self): super(CsrfViewTests, self).setUp() diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index a98b776f78..ac8cbcdb11 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -15,7 +15,7 @@ from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse from django.template import TemplateDoesNotExist -from django.test import RequestFactory, TestCase, override_settings +from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.utils import LoggingCaptureMixin from django.utils import six from django.utils.encoding import force_bytes, force_text @@ -33,7 +33,7 @@ if six.PY3: from .py3_test_debug import Py3ExceptionReporterTests # NOQA -class CallableSettingWrapperTests(TestCase): +class CallableSettingWrapperTests(SimpleTestCase): """ Unittests for CallableSettingWrapper """ def test_repr(self): @@ -49,7 +49,7 @@ class CallableSettingWrapperTests(TestCase): @override_settings(DEBUG=True, ROOT_URLCONF="view_tests.urls") -class DebugViewTests(LoggingCaptureMixin, TestCase): +class DebugViewTests(LoggingCaptureMixin, SimpleTestCase): def test_files(self): response = self.client.get('/raises/') @@ -202,7 +202,7 @@ class DebugViewTests(LoggingCaptureMixin, TestCase): 'BACKEND': 'django.template.backends.dummy.TemplateStrings', }], ) -class NonDjangoTemplatesDebugViewTests(TestCase): +class NonDjangoTemplatesDebugViewTests(SimpleTestCase): def test_400(self): # Ensure that when DEBUG=True, technical_500_template() is called. @@ -224,7 +224,7 @@ class NonDjangoTemplatesDebugViewTests(TestCase): self.assertContains(response, '