Skip to content

Commit

Permalink
Refs #24652 -- Used SimpleTestCase where appropriate.
Browse files Browse the repository at this point in the history
  • Loading branch information
charettes committed May 20, 2015
1 parent e2b77ac commit be67400
Show file tree
Hide file tree
Showing 93 changed files with 362 additions and 340 deletions.
4 changes: 2 additions & 2 deletions tests/absolute_url_overrides/tests.py
Original file line number Diff line number Diff line change
@@ -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):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/admin_checks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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

Expand Down Expand Up @@ -41,7 +41,7 @@ def check(cls, model, **kwargs):
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):
Expand Down
6 changes: 3 additions & 3 deletions tests/admin_registration/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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

Expand All @@ -18,7 +18,7 @@ class CustomSite(admin.AdminSite):
pass


class TestRegistration(TestCase):
class TestRegistration(SimpleTestCase):
def setUp(self):
self.site = admin.AdminSite()

Expand Down Expand Up @@ -80,7 +80,7 @@ def test_is_registered_not_registered_model(self):
self.assertFalse(self.site.is_registered(Person))


class TestRegistrationDecorator(TestCase):
class TestRegistrationDecorator(SimpleTestCase):
"""
Tests the register decorator in admin.decorators
Expand Down
6 changes: 4 additions & 2 deletions tests/admin_scripts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
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
Expand Down Expand Up @@ -1695,7 +1697,7 @@ def test_label_command_multiple_label(self):
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):
"""
Expand Down
5 changes: 3 additions & 2 deletions tests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
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
Expand Down Expand Up @@ -6150,7 +6151,7 @@ def test_callable(self):


@override_settings(ROOT_URLCONF="admin_views.urls")
class TestEtagWithAdminView(TestCase):
class TestEtagWithAdminView(SimpleTestCase):
# See https://code.djangoproject.com/ticket/16003

def test_admin(self):
Expand Down
30 changes: 15 additions & 15 deletions tests/admin_widgets/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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
Expand All @@ -17,7 +17,7 @@
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
Expand Down Expand Up @@ -59,7 +59,7 @@ def setUp(self):
)


class AdminFormfieldForDBFieldTests(TestCase):
class AdminFormfieldForDBFieldTests(SimpleTestCase):
"""
Tests for correct behavior of ModelAdmin.formfield_for_dbfield
"""
Expand Down Expand Up @@ -194,7 +194,7 @@ class AdvisorAdmin(admin.ModelAdmin):

@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):
"""
Expand All @@ -208,7 +208,7 @@ def test_filter_choices_by_request_user(self):

@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")
Expand All @@ -220,7 +220,7 @@ def test_changelist_ForeignKey(self):

@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")
Expand Down Expand Up @@ -262,7 +262,7 @@ def my_callable():
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)
Expand All @@ -284,7 +284,7 @@ def test_stacked_render(self):
)


class AdminDateWidgetTest(DjangoTestCase):
class AdminDateWidgetTest(SimpleTestCase):
def test_attrs(self):
"""
Ensure that user-supplied attrs are used.
Expand All @@ -303,7 +303,7 @@ def test_attrs(self):
)


class AdminTimeWidgetTest(DjangoTestCase):
class AdminTimeWidgetTest(SimpleTestCase):
def test_attrs(self):
"""
Ensure that user-supplied attrs are used.
Expand All @@ -322,7 +322,7 @@ def test_attrs(self):
)


class AdminSplitDateTimeWidgetTest(DjangoTestCase):
class AdminSplitDateTimeWidgetTest(SimpleTestCase):
def test_render(self):
w = widgets.AdminSplitDateTime()
self.assertHTMLEqual(
Expand All @@ -341,7 +341,7 @@ def test_localization(self):
)


class AdminURLWidgetTest(DjangoTestCase):
class AdminURLWidgetTest(SimpleTestCase):
def test_render(self):
w = widgets.AdminURLFieldWidget()
self.assertHTMLEqual(
Expand Down Expand Up @@ -382,7 +382,7 @@ def test_render_quoting(self):
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls',
)
class AdminFileWidgetTests(TestDataMixin, DjangoTestCase):
class AdminFileWidgetTests(TestDataMixin, TestCase):

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -436,7 +436,7 @@ def test_readonly_fields(self):


@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')
Expand Down Expand Up @@ -519,7 +519,7 @@ def test_proper_manager_for_label_lookup(self):


@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')
Expand Down Expand Up @@ -566,7 +566,7 @@ def test_m2m_related_model_not_in_admin(self):
)


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()
Expand Down
6 changes: 3 additions & 3 deletions tests/app_loading/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
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__))
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_egg5(self):
pass


class GetModelsTest(TestCase):
class GetModelsTest(SimpleTestCase):
def setUp(self):
from .not_installed import models
self.not_installed_module = models
Expand Down
8 changes: 4 additions & 4 deletions tests/apps/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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
Expand Down Expand Up @@ -38,7 +38,7 @@
HERE = os.path.dirname(upath(__file__))


class AppsTests(TestCase):
class AppsTests(SimpleTestCase):

def test_singleton_master(self):
"""
Expand Down Expand Up @@ -303,7 +303,7 @@ def __init__(self, **kwargs):
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."""
Expand Down Expand Up @@ -366,7 +366,7 @@ def test_multiple_dunder_path_no_dunder_file(self):
@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
Expand Down
6 changes: 4 additions & 2 deletions tests/auth_tests/test_auth_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
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

Expand Down Expand Up @@ -394,7 +396,7 @@ def test_get_group_permissions(self):
@override_settings(
AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend'],
)
class AnonymousUserBackendTest(TestCase):
class AnonymousUserBackendTest(SimpleTestCase):
"""
Tests for AnonymousUser delegating to backend.
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/auth_tests/test_context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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

Expand All @@ -22,7 +22,7 @@ def has_perm(self, perm):
return False


class PermWrapperTests(TestCase):
class PermWrapperTests(SimpleTestCase):
"""
Test some details of the PermWrapper implementation.
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/auth_tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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
Expand Down Expand Up @@ -553,7 +553,7 @@ def test_save_html_email_template_name(self):
)


class ReadOnlyPasswordHashTest(TestCase):
class ReadOnlyPasswordHashTest(SimpleTestCase):

def test_bug_19349_render_with_none_value(self):
# Rendering the widget with value set to None
Expand Down
6 changes: 4 additions & 2 deletions tests/auth_tests/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
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 _
Expand Down Expand Up @@ -415,7 +417,7 @@ def test(self):
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):
Expand Down
8 changes: 4 additions & 4 deletions tests/backends/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
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
Expand All @@ -35,7 +35,7 @@
from . import models


class DummyBackendTest(TestCase):
class DummyBackendTest(SimpleTestCase):

def test_no_databases(self):
"""
Expand Down Expand Up @@ -1096,7 +1096,7 @@ def test_many_to_many(self):
self.assertEqual(intermediary_model.objects.count(), 2)


class BackendUtilTests(TestCase):
class BackendUtilTests(SimpleTestCase):

def test_format_number(self):
"""
Expand Down
Loading

0 comments on commit be67400

Please sign in to comment.