summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-07-01 14:22:27 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-07-01 14:29:33 +0200
commitcfcf4b3605f9653e4e056088d89932b2a0e4281b (patch)
tree1eed1ebdb087b26abeddf5245fc723930d14d847
parent7f264e02f4480c49d1440be882416a10951c2165 (diff)
Stopped using django.utils.unittest in the test suite.
Refs #20680.
-rw-r--r--django/contrib/admin/tests.py2
-rw-r--r--django/contrib/admindocs/tests/test_fields.py3
-rw-r--r--django/contrib/auth/tests/test_hashers.py5
-rw-r--r--django/contrib/auth/tests/test_tokens.py4
-rw-r--r--django/contrib/auth/tests/utils.py3
-rw-r--r--django/contrib/formtools/tests/tests.py2
-rw-r--r--django/contrib/gis/gdal/tests/test_driver.py5
-rw-r--r--django/contrib/gis/gdal/tests/test_ds.py4
-rw-r--r--django/contrib/gis/gdal/tests/test_envelope.py7
-rw-r--r--django/contrib/gis/gdal/tests/test_geom.py4
-rw-r--r--django/contrib/gis/gdal/tests/test_srs.py5
-rw-r--r--django/contrib/gis/geoip/tests.py5
-rw-r--r--django/contrib/gis/geos/tests/test_geos.py4
-rw-r--r--django/contrib/gis/geos/tests/test_geos_mutation.py4
-rw-r--r--django/contrib/gis/geos/tests/test_io.py2
-rw-r--r--django/contrib/gis/geos/tests/test_mutable_list.py4
-rw-r--r--django/contrib/gis/tests/distapp/tests.py3
-rw-r--r--django/contrib/gis/tests/geo3d/tests.py2
-rw-r--r--django/contrib/gis/tests/geoadmin/tests.py3
-rw-r--r--django/contrib/gis/tests/geoapp/test_feeds.py2
-rw-r--r--django/contrib/gis/tests/geoapp/test_regress.py2
-rw-r--r--django/contrib/gis/tests/geoapp/test_sitemaps.py2
-rw-r--r--django/contrib/gis/tests/geoapp/tests.py2
-rw-r--r--django/contrib/gis/tests/geogapp/tests.py2
-rw-r--r--django/contrib/gis/tests/inspectapp/tests.py2
-rw-r--r--django/contrib/gis/tests/layermap/tests.py6
-rw-r--r--django/contrib/gis/tests/relatedapp/tests.py3
-rw-r--r--django/contrib/gis/tests/test_geoforms.py7
-rw-r--r--django/contrib/gis/tests/test_measure.py3
-rw-r--r--django/contrib/gis/tests/test_spatialrefsys.py3
-rw-r--r--django/contrib/humanize/tests.py2
-rw-r--r--django/contrib/messages/tests/base.py3
-rw-r--r--django/contrib/messages/tests/test_middleware.py3
-rw-r--r--django/contrib/sessions/tests.py2
-rw-r--r--django/contrib/sitemaps/tests/test_flatpages.py3
-rw-r--r--django/contrib/sitemaps/tests/test_http.py2
-rw-r--r--django/test/runner.py4
-rw-r--r--django/test/testcases.py17
-rw-r--r--docs/topics/testing/advanced.txt2
-rw-r--r--docs/topics/testing/overview.txt4
-rw-r--r--tests/admin_scripts/tests.py4
-rw-r--r--tests/admin_widgets/tests.py2
-rw-r--r--tests/aggregation_regress/tests.py1
-rw-r--r--tests/app_loading/tests.py3
-rw-r--r--tests/bash_completion/tests.py2
-rw-r--r--tests/bug639/tests.py2
-rw-r--r--tests/bug8245/tests.py3
-rw-r--r--tests/builtin_server/tests.py2
-rw-r--r--tests/db_typecasts/tests.py2
-rw-r--r--tests/decorators/tests.py2
-rw-r--r--tests/defaultfilters/tests.py3
-rw-r--r--tests/dispatch/tests/test_dispatcher.py2
-rw-r--r--tests/dispatch/tests/test_saferef.py3
-rw-r--r--tests/file_storage/tests.py2
-rw-r--r--tests/file_uploads/tests.py2
-rw-r--r--tests/files/tests.py2
-rw-r--r--tests/forms_tests/tests/test_validators.py3
-rw-r--r--tests/generic_views/test_base.py2
-rw-r--r--tests/generic_views/test_dates.py2
-rw-r--r--tests/generic_views/test_edit.py2
-rw-r--r--tests/httpwrappers/tests.py2
-rw-r--r--tests/indexes/tests.py3
-rw-r--r--tests/inspectdb/tests.py2
-rw-r--r--tests/introspection/tests.py3
-rw-r--r--tests/invalid_models/tests.py3
-rw-r--r--tests/logging_tests/tests.py2
-rw-r--r--tests/max_lengths/tests.py4
-rw-r--r--tests/middleware/tests.py2
-rw-r--r--tests/model_fields/test_imagefield.py2
-rw-r--r--tests/model_fields/tests.py2
-rw-r--r--tests/model_forms/tests.py2
-rw-r--r--tests/model_forms_regress/tests.py2
-rw-r--r--tests/model_inheritance_regress/tests.py4
-rw-r--r--tests/model_regress/tests.py2
-rw-r--r--tests/modeladmin/tests.py3
-rw-r--r--tests/pagination/tests.py2
-rw-r--r--tests/queries/tests.py2
-rw-r--r--tests/requests/tests.py6
-rw-r--r--tests/resolve_url/tests.py3
-rw-r--r--tests/select_for_update/tests.py2
-rw-r--r--tests/select_related_onetoone/tests.py3
-rw-r--r--tests/serializers/tests.py2
-rw-r--r--tests/serializers_regress/tests.py4
-rw-r--r--tests/settings_tests/tests.py3
-rw-r--r--tests/str/tests.py2
-rw-r--r--tests/template_tests/loaders.py7
-rw-r--r--tests/template_tests/test_callables.py3
-rw-r--r--tests/template_tests/test_context.py4
-rw-r--r--tests/template_tests/test_custom.py3
-rw-r--r--tests/template_tests/test_nodelist.py3
-rw-r--r--tests/template_tests/test_parser.py3
-rw-r--r--tests/template_tests/test_smartif.py3
-rw-r--r--tests/template_tests/test_unicode.py3
-rw-r--r--tests/template_tests/tests.py2
-rw-r--r--tests/test_runner/test_discover_runner.py2
-rw-r--r--tests/test_runner/tests.py4
-rw-r--r--tests/test_suite_override/tests.py3
-rw-r--r--tests/test_utils/tests.py5
-rw-r--r--tests/timezones/tests.py2
-rw-r--r--tests/transactions/tests.py2
-rw-r--r--tests/transactions_regress/tests.py3
-rw-r--r--tests/urlpatterns_reverse/tests.py4
-rw-r--r--tests/utils_tests/test_archive.py2
-rw-r--r--tests/utils_tests/test_baseconv.py3
-rw-r--r--tests/utils_tests/test_crypto.py4
-rw-r--r--tests/utils_tests/test_dateparse.py2
-rw-r--r--tests/utils_tests/test_encoding.py3
-rw-r--r--tests/utils_tests/test_functional.py3
-rw-r--r--tests/utils_tests/test_html.py2
-rw-r--r--tests/utils_tests/test_http.py2
-rw-r--r--tests/utils_tests/test_ipv6.py3
-rw-r--r--tests/utils_tests/test_module_loading.py4
-rw-r--r--tests/utils_tests/test_os_utils.py2
-rw-r--r--tests/utils_tests/test_regex_helper.py3
-rw-r--r--tests/utils_tests/test_simplelazyobject.py2
-rw-r--r--tests/utils_tests/test_termcolors.py3
-rw-r--r--tests/utils_tests/test_timezone.py3
-rw-r--r--tests/utils_tests/test_tzinfo.py3
-rw-r--r--tests/validation/test_error_messages.py3
-rw-r--r--tests/validation/test_unique.py2
-rw-r--r--tests/validators/tests.py4
-rw-r--r--tests/version/tests.py2
-rw-r--r--tests/view_tests/tests/test_debug.py2
123 files changed, 212 insertions, 161 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py
index 25ea230b28..82d0bdcb7b 100644
--- a/django/contrib/admin/tests.py
+++ b/django/contrib/admin/tests.py
@@ -1,8 +1,8 @@
import os
+from unittest import SkipTest
from django.test import LiveServerTestCase
from django.utils.module_loading import import_by_path
-from django.utils.unittest import SkipTest
from django.utils.translation import ugettext as _
diff --git a/django/contrib/admindocs/tests/test_fields.py b/django/contrib/admindocs/tests/test_fields.py
index c048f20287..b505d2deeb 100644
--- a/django/contrib/admindocs/tests/test_fields.py
+++ b/django/contrib/admindocs/tests/test_fields.py
@@ -1,9 +1,10 @@
from __future__ import absolute_import, unicode_literals
+import unittest
+
from django.contrib.admindocs import views
from django.db import models
from django.db.models import fields
-from django.utils import unittest
from django.utils.translation import ugettext as _
diff --git a/django/contrib/auth/tests/test_hashers.py b/django/contrib/auth/tests/test_hashers.py
index 9b7811a335..8e8119b741 100644
--- a/django/contrib/auth/tests/test_hashers.py
+++ b/django/contrib/auth/tests/test_hashers.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+import unittest
+from unittest import skipUnless
+
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable, BasePasswordHasher,
check_password, make_password, PBKDF2PasswordHasher, load_hashers, PBKDF2SHA1PasswordHasher,
get_hasher, identify_hasher, UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH)
from django.utils import six
-from django.utils import unittest
-from django.utils.unittest import skipUnless
try:
diff --git a/django/contrib/auth/tests/test_tokens.py b/django/contrib/auth/tests/test_tokens.py
index e8aeb46326..7afafc3e94 100644
--- a/django/contrib/auth/tests/test_tokens.py
+++ b/django/contrib/auth/tests/test_tokens.py
@@ -1,12 +1,12 @@
-import sys
from datetime import date, timedelta
+import sys
+import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase
-from django.utils import unittest
@skipIfCustomUser
diff --git a/django/contrib/auth/tests/utils.py b/django/contrib/auth/tests/utils.py
index 6bb3d9994f..09b34156b5 100644
--- a/django/contrib/auth/tests/utils.py
+++ b/django/contrib/auth/tests/utils.py
@@ -1,5 +1,6 @@
+from unittest import skipIf
+
from django.conf import settings
-from django.utils.unittest import skipIf
def skipIfCustomUser(test_func):
diff --git a/django/contrib/formtools/tests/tests.py b/django/contrib/formtools/tests/tests.py
index 58c59f4041..e1e6ab860b 100644
--- a/django/contrib/formtools/tests/tests.py
+++ b/django/contrib/formtools/tests/tests.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import datetime
import os
+import unittest
import warnings
from django import http
@@ -10,7 +11,6 @@ from django.contrib.formtools import preview, utils
from django.test import TestCase
from django.test.utils import override_settings
from django.utils._os import upath
-from django.utils import unittest
from django.contrib.formtools.tests.forms import *
diff --git a/django/contrib/gis/gdal/tests/test_driver.py b/django/contrib/gis/gdal/tests/test_driver.py
index c27302da72..af0ecf5dc8 100644
--- a/django/contrib/gis/gdal/tests/test_driver.py
+++ b/django/contrib/gis/gdal/tests/test_driver.py
@@ -1,6 +1,7 @@
+import unittest
+from unittest import skipUnless
+
from django.contrib.gis.gdal import HAS_GDAL
-from django.utils import unittest
-from django.utils.unittest import skipUnless
if HAS_GDAL:
from django.contrib.gis.gdal import Driver, OGRException
diff --git a/django/contrib/gis/gdal/tests/test_ds.py b/django/contrib/gis/gdal/tests/test_ds.py
index 3664f055f2..3ac2370fb7 100644
--- a/django/contrib/gis/gdal/tests/test_ds.py
+++ b/django/contrib/gis/gdal/tests/test_ds.py
@@ -1,9 +1,9 @@
import os
+import unittest
+from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import get_ds_file, TestDS, TEST_DATA
-from django.utils import unittest
-from django.utils.unittest import skipUnless
if HAS_GDAL:
from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError, GDAL_VERSION
diff --git a/django/contrib/gis/gdal/tests/test_envelope.py b/django/contrib/gis/gdal/tests/test_envelope.py
index 7518dc69aa..14258ff816 100644
--- a/django/contrib/gis/gdal/tests/test_envelope.py
+++ b/django/contrib/gis/gdal/tests/test_envelope.py
@@ -1,6 +1,7 @@
+import unittest
+from unittest import skipUnless
+
from django.contrib.gis.gdal import HAS_GDAL
-from django.utils import unittest
-from django.utils.unittest import skipUnless
if HAS_GDAL:
from django.contrib.gis.gdal import Envelope, OGRException
@@ -17,7 +18,7 @@ class EnvelopeTest(unittest.TestCase):
def setUp(self):
self.e = Envelope(0, 0, 5, 5)
-
+
def test01_init(self):
"Testing Envelope initilization."
e1 = Envelope((0, 0, 5, 5))
diff --git a/django/contrib/gis/gdal/tests/test_geom.py b/django/contrib/gis/gdal/tests/test_geom.py
index c048d2bb82..74b1e894e1 100644
--- a/django/contrib/gis/gdal/tests/test_geom.py
+++ b/django/contrib/gis/gdal/tests/test_geom.py
@@ -4,12 +4,12 @@ try:
from django.utils.six.moves import cPickle as pickle
except ImportError:
import pickle
+import unittest
+from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TestDataMixin
from django.utils.six.moves import xrange
-from django.utils import unittest
-from django.utils.unittest import skipUnless
if HAS_GDAL:
from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType,
diff --git a/django/contrib/gis/gdal/tests/test_srs.py b/django/contrib/gis/gdal/tests/test_srs.py
index 363b597dae..cacff4be04 100644
--- a/django/contrib/gis/gdal/tests/test_srs.py
+++ b/django/contrib/gis/gdal/tests/test_srs.py
@@ -1,6 +1,7 @@
+import unittest
+from unittest import skipUnless
+
from django.contrib.gis.gdal import HAS_GDAL
-from django.utils import unittest
-from django.utils.unittest import skipUnless
if HAS_GDAL:
from django.contrib.gis.gdal import SpatialReference, CoordTransform, OGRException, SRSException
diff --git a/django/contrib/gis/geoip/tests.py b/django/contrib/gis/geoip/tests.py
index 3fa64bf6be..c49ffb5bf1 100644
--- a/django/contrib/gis/geoip/tests.py
+++ b/django/contrib/gis/geoip/tests.py
@@ -2,11 +2,12 @@
from __future__ import unicode_literals
import os
+import unittest
+from unittest import skipUnless
+
from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.geoip import HAS_GEOIP
-from django.utils import unittest
-from django.utils.unittest import skipUnless
from django.utils import six
diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py
index c7fe5b2321..900a0adb40 100644
--- a/django/contrib/gis/geos/tests/test_geos.py
+++ b/django/contrib/gis/geos/tests/test_geos.py
@@ -3,6 +3,8 @@ from __future__ import unicode_literals
import ctypes
import json
import random
+import unittest
+from unittest import skipUnless
from binascii import a2b_hex, b2a_hex
from io import BytesIO
@@ -14,8 +16,6 @@ from django.contrib.gis.geometry.test_data import TestDataMixin
from django.utils.encoding import force_bytes
from django.utils import six
from django.utils.six.moves import xrange
-from django.utils import unittest
-from django.utils.unittest import skipUnless
from .. import HAS_GEOS
diff --git a/django/contrib/gis/geos/tests/test_geos_mutation.py b/django/contrib/gis/geos/tests/test_geos_mutation.py
index 40b708a0ef..337abb4d8b 100644
--- a/django/contrib/gis/geos/tests/test_geos_mutation.py
+++ b/django/contrib/gis/geos/tests/test_geos_mutation.py
@@ -2,8 +2,8 @@
# Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license.
-from django.utils import unittest
-from django.utils.unittest import skipUnless
+import unittest
+from unittest import skipUnless
from .. import HAS_GEOS
diff --git a/django/contrib/gis/geos/tests/test_io.py b/django/contrib/gis/geos/tests/test_io.py
index 34eeaf95b9..2278be8a87 100644
--- a/django/contrib/gis/geos/tests/test_io.py
+++ b/django/contrib/gis/geos/tests/test_io.py
@@ -2,9 +2,9 @@ from __future__ import unicode_literals
import binascii
import unittest
+from unittest import skipUnless
from django.contrib.gis import memoryview
-from django.utils.unittest import skipUnless
from ..import HAS_GEOS
diff --git a/django/contrib/gis/geos/tests/test_mutable_list.py b/django/contrib/gis/geos/tests/test_mutable_list.py
index a4a56f2e5f..ae50a5f616 100644
--- a/django/contrib/gis/geos/tests/test_mutable_list.py
+++ b/django/contrib/gis/geos/tests/test_mutable_list.py
@@ -3,9 +3,11 @@
#
# Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license.
+
+import unittest
+
from django.contrib.gis.geos.mutable_list import ListMixin
from django.utils import six
-from django.utils import unittest
class UserListA(ListMixin):
diff --git a/django/contrib/gis/tests/distapp/tests.py b/django/contrib/gis/tests/distapp/tests.py
index 2ed17a03bd..8915f01e50 100644
--- a/django/contrib/gis/tests/distapp/tests.py
+++ b/django/contrib/gis/tests/distapp/tests.py
@@ -1,5 +1,7 @@
from __future__ import absolute_import
+from unittest import skipUnless
+
from django.db import connection
from django.db.models import Q
from django.contrib.gis.geos import HAS_GEOS
@@ -8,7 +10,6 @@ from django.contrib.gis.tests.utils import (
HAS_SPATIAL_DB, mysql, oracle, postgis, spatialite, no_oracle, no_spatialite
)
from django.test import TestCase
-from django.utils.unittest import skipUnless
if HAS_GEOS and HAS_SPATIAL_DB:
from django.contrib.gis.geos import GEOSGeometry, LineString
diff --git a/django/contrib/gis/tests/geo3d/tests.py b/django/contrib/gis/tests/geo3d/tests.py
index df9f35690b..6c17003982 100644
--- a/django/contrib/gis/tests/geo3d/tests.py
+++ b/django/contrib/gis/tests/geo3d/tests.py
@@ -2,13 +2,13 @@ from __future__ import absolute_import, unicode_literals
import os
import re
+from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import postgis
from django.test import TestCase
from django.utils._os import upath
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from django.contrib.gis.db.models import Union, Extent3D
diff --git a/django/contrib/gis/tests/geoadmin/tests.py b/django/contrib/gis/tests/geoadmin/tests.py
index 15874758be..c34964a2da 100644
--- a/django/contrib/gis/tests/geoadmin/tests.py
+++ b/django/contrib/gis/tests/geoadmin/tests.py
@@ -1,9 +1,10 @@
from __future__ import absolute_import
+from unittest import skipUnless
+
from django.test import TestCase
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
-from django.utils.unittest import skipUnless
if HAS_GEOS and HAS_SPATIAL_DB:
from django.contrib.gis import admin
diff --git a/django/contrib/gis/tests/geoapp/test_feeds.py b/django/contrib/gis/tests/geoapp/test_feeds.py
index 778cadc9d4..b2953b4a70 100644
--- a/django/contrib/gis/tests/geoapp/test_feeds.py
+++ b/django/contrib/gis/tests/geoapp/test_feeds.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import
+from unittest import skipUnless
from xml.dom import minidom
from django.conf import settings
@@ -7,7 +8,6 @@ from django.contrib.sites.models import Site
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.test import TestCase
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from .models import City
diff --git a/django/contrib/gis/tests/geoapp/test_regress.py b/django/contrib/gis/tests/geoapp/test_regress.py
index 43dbcfd852..2ffbaec9a9 100644
--- a/django/contrib/gis/tests/geoapp/test_regress.py
+++ b/django/contrib/gis/tests/geoapp/test_regress.py
@@ -2,6 +2,7 @@
from __future__ import absolute_import, unicode_literals
from datetime import datetime
+from unittest import skipUnless
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import no_mysql, no_spatialite
@@ -9,7 +10,6 @@ from django.contrib.gis.shortcuts import render_to_kmz
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.db.models import Count, Min
from django.test import TestCase
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from .models import City, PennsylvaniaCity, State, Truth
diff --git a/django/contrib/gis/tests/geoapp/test_sitemaps.py b/django/contrib/gis/tests/geoapp/test_sitemaps.py
index 337b4b75c6..facd94c247 100644
--- a/django/contrib/gis/tests/geoapp/test_sitemaps.py
+++ b/django/contrib/gis/tests/geoapp/test_sitemaps.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import
from io import BytesIO
+from unittest import skipUnless
from xml.dom import minidom
import zipfile
@@ -9,7 +10,6 @@ from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.contrib.sites.models import Site
from django.test import TestCase
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from .models import City, Country
diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py
index cf6e316919..89505ae1f2 100644
--- a/django/contrib/gis/tests/geoapp/tests.py
+++ b/django/contrib/gis/tests/geoapp/tests.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import re
+from unittest import skipUnless
from django.db import connection
from django.contrib.gis import gdal
@@ -10,7 +11,6 @@ from django.contrib.gis.tests.utils import (
mysql, oracle, postgis, spatialite)
from django.test import TestCase
from django.utils import six, unittest
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from django.contrib.gis.geos import (fromstr, GEOSGeometry,
diff --git a/django/contrib/gis/tests/geogapp/tests.py b/django/contrib/gis/tests/geogapp/tests.py
index ed54999f90..2a60f623fa 100644
--- a/django/contrib/gis/tests/geogapp/tests.py
+++ b/django/contrib/gis/tests/geogapp/tests.py
@@ -4,6 +4,7 @@ Tests for geography support in PostGIS 1.5+
from __future__ import absolute_import
import os
+from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS
@@ -11,7 +12,6 @@ from django.contrib.gis.measure import D
from django.contrib.gis.tests.utils import postgis
from django.test import TestCase
from django.utils._os import upath
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from .models import City, County, Zipcode
diff --git a/django/contrib/gis/tests/inspectapp/tests.py b/django/contrib/gis/tests/inspectapp/tests.py
index 668b87ba86..34dab1ab7d 100644
--- a/django/contrib/gis/tests/inspectapp/tests.py
+++ b/django/contrib/gis/tests/inspectapp/tests.py
@@ -1,13 +1,13 @@
from __future__ import absolute_import
import os
+from unittest import skipUnless
from django.db import connections
from django.test import TestCase
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
-from django.utils.unittest import skipUnless
if HAS_GDAL:
from django.contrib.gis.gdal import Driver
diff --git a/django/contrib/gis/tests/layermap/tests.py b/django/contrib/gis/tests/layermap/tests.py
index 8379311a2b..c4c27b353e 100644
--- a/django/contrib/gis/tests/layermap/tests.py
+++ b/django/contrib/gis/tests/layermap/tests.py
@@ -1,17 +1,17 @@
# coding: utf-8
from __future__ import absolute_import, unicode_literals
-import os
from copy import copy
from decimal import Decimal
+import os
+import unittest
+from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql
from django.db import router
from django.conf import settings
from django.test import TestCase
-from django.utils import unittest
-from django.utils.unittest import skipUnless
from django.utils._os import upath
if HAS_GDAL:
diff --git a/django/contrib/gis/tests/relatedapp/tests.py b/django/contrib/gis/tests/relatedapp/tests.py
index d93adbcd4c..653bda8aaf 100644
--- a/django/contrib/gis/tests/relatedapp/tests.py
+++ b/django/contrib/gis/tests/relatedapp/tests.py
@@ -1,9 +1,10 @@
from __future__ import absolute_import
+from unittest import skipUnless
+
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql, oracle, no_mysql, no_oracle, no_spatialite
from django.test import TestCase
-from django.utils.unittest import skipUnless
if HAS_GEOS:
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
diff --git a/django/contrib/gis/tests/test_geoforms.py b/django/contrib/gis/tests/test_geoforms.py
index 402d9b944b..b04bdea71d 100644
--- a/django/contrib/gis/tests/test_geoforms.py
+++ b/django/contrib/gis/tests/test_geoforms.py
@@ -1,15 +1,16 @@
+from unittest import skipUnless
+
from django.forms import ValidationError
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS
from django.test import SimpleTestCase
from django.utils import six
-from django.utils.unittest import skipUnless
-
if HAS_SPATIALREFSYS:
from django.contrib.gis import forms
from django.contrib.gis.geos import GEOSGeometry
+
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS, "GeometryFieldTest needs gdal support and a spatial database")
class GeometryFieldTest(SimpleTestCase):
@@ -143,7 +144,7 @@ class SpecializedFieldTest(SimpleTestCase):
def assertTextarea(self, geom, rendered):
"""Makes sure the wkt and a textarea are in the content"""
-
+
self.assertIn('<textarea ', rendered)
self.assertIn('required', rendered)
self.assertIn(geom.wkt, rendered)
diff --git a/django/contrib/gis/tests/test_measure.py b/django/contrib/gis/tests/test_measure.py
index 0428704d6c..8ce37994eb 100644
--- a/django/contrib/gis/tests/test_measure.py
+++ b/django/contrib/gis/tests/test_measure.py
@@ -3,8 +3,9 @@ Distance and Area objects to allow for sensible and convienient calculation
and conversions. Here are some tests.
"""
+import unittest
+
from django.contrib.gis.measure import Distance, Area, D, A
-from django.utils import unittest
class DistanceTest(unittest.TestCase):
diff --git a/django/contrib/gis/tests/test_spatialrefsys.py b/django/contrib/gis/tests/test_spatialrefsys.py
index f33883e9f1..8daa6acc23 100644
--- a/django/contrib/gis/tests/test_spatialrefsys.py
+++ b/django/contrib/gis/tests/test_spatialrefsys.py
@@ -1,8 +1,9 @@
+import unittest
+
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis,
spatialite, HAS_SPATIALREFSYS, SpatialRefSys)
from django.utils import six
-from django.utils import unittest
test_srs = ({'srid' : 4326,
diff --git a/django/contrib/humanize/tests.py b/django/contrib/humanize/tests.py
index 54a60f8fd6..f1fcbf2bb3 100644
--- a/django/contrib/humanize/tests.py
+++ b/django/contrib/humanize/tests.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
import datetime
from decimal import Decimal
+from unittest import skipIf
try:
import pytz
@@ -17,7 +18,6 @@ from django.utils.timezone import utc
from django.utils import translation
from django.utils.translation import ugettext as _
from django.utils import tzinfo
-from django.utils.unittest import skipIf
from i18n import TransRealMixin
diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py
index 0d689729aa..7011a5779a 100644
--- a/django/contrib/messages/tests/base.py
+++ b/django/contrib/messages/tests/base.py
@@ -1,3 +1,5 @@
+from unittest import skipIf
+
from django import http
from django.conf import settings, global_settings
from django.contrib.messages import constants, utils, get_level, set_level
@@ -7,7 +9,6 @@ from django.contrib.messages.storage.base import Message
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from django.utils.translation import ugettext_lazy
-from django.utils.unittest import skipIf
def skipUnlessAuthIsInstalled(func):
diff --git a/django/contrib/messages/tests/test_middleware.py b/django/contrib/messages/tests/test_middleware.py
index 5618c2d2b2..855f6b32a7 100644
--- a/django/contrib/messages/tests/test_middleware.py
+++ b/django/contrib/messages/tests/test_middleware.py
@@ -1,6 +1,7 @@
+import unittest
+
from django import http
from django.contrib.messages.middleware import MessageMiddleware
-from django.utils import unittest
class MiddlewareTest(unittest.TestCase):
diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py
index cd8191a6a4..f2a35c544e 100644
--- a/django/contrib/sessions/tests.py
+++ b/django/contrib/sessions/tests.py
@@ -4,6 +4,7 @@ import os
import shutil
import string
import tempfile
+import unittest
import warnings
from django.conf import settings
@@ -22,7 +23,6 @@ from django.test import TestCase, RequestFactory
from django.test.utils import override_settings, patch_logger
from django.utils import six
from django.utils import timezone
-from django.utils import unittest
from django.contrib.sessions.exceptions import InvalidSessionKey
diff --git a/django/contrib/sitemaps/tests/test_flatpages.py b/django/contrib/sitemaps/tests/test_flatpages.py
index 930f24f22c..e034a457c2 100644
--- a/django/contrib/sitemaps/tests/test_flatpages.py
+++ b/django/contrib/sitemaps/tests/test_flatpages.py
@@ -1,7 +1,8 @@
from __future__ import unicode_literals
+from unittest import skipUnless
+
from django.conf import settings
-from django.utils.unittest import skipUnless
from .base import SitemapTestsBase
diff --git a/django/contrib/sitemaps/tests/test_http.py b/django/contrib/sitemaps/tests/test_http.py
index a99025e6e2..f68f345815 100644
--- a/django/contrib/sitemaps/tests/test_http.py
+++ b/django/contrib/sitemaps/tests/test_http.py
@@ -2,13 +2,13 @@ from __future__ import unicode_literals
import os
from datetime import date
+from unittest import skipUnless
from django.conf import settings
from django.contrib.sitemaps import Sitemap, GenericSitemap
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.test.utils import override_settings
-from django.utils.unittest import skipUnless
from django.utils.formats import localize
from django.utils._os import upath
from django.utils.translation import activate, deactivate
diff --git a/django/test/runner.py b/django/test/runner.py
index e753e365fa..709b685de5 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -1,12 +1,12 @@
import os
from optparse import make_option
+import unittest
+from unittest import TestSuite, defaultTestLoader
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import setup_test_environment, teardown_test_environment
-from django.utils import unittest
-from django.utils.unittest import TestSuite, defaultTestLoader
class DiscoverRunner(object):
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 53b15158ca..c5299bdabc 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -8,13 +8,16 @@ import json
import os
import re
import sys
+import select
+import socket
+import threading
+import unittest
+from unittest import skipIf # Imported here for backward compatibility
+from unittest.util import safe_repr
try:
from urllib.parse import urlsplit, urlunsplit
except ImportError: # Python 2
from urlparse import urlsplit, urlunsplit
-import select
-import socket
-import threading
from django.conf import settings
from django.contrib.staticfiles.handlers import StaticFilesHandler
@@ -36,10 +39,8 @@ from django.test.html import HTMLParseError, parse_html
from django.test.signals import template_rendered
from django.test.utils import (CaptureQueriesContext, ContextList,
override_settings, compare_xml)
-from django.utils import six, unittest as ut2
+from django.utils import six
from django.utils.encoding import force_text
-from django.utils.unittest import skipIf # Imported here for backward compatibility
-from django.utils.unittest.util import safe_repr
from django.views.static import serve
@@ -155,7 +156,7 @@ class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext):
return '%s was rendered.' % self.template_name
-class SimpleTestCase(ut2.TestCase):
+class SimpleTestCase(unittest.TestCase):
# The class we'll use for the test client self.client.
# Can be overridden in derived classes.
@@ -886,7 +887,7 @@ def _deferredSkip(condition, reason):
@wraps(test_func)
def skip_wrapper(*args, **kwargs):
if condition():
- raise ut2.SkipTest(reason)
+ raise unittest.SkipTest(reason)
return test_func(*args, **kwargs)
test_item = skip_wrapper
else:
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index 8f7f093901..b8e70b592b 100644
--- a/docs/topics/testing/advanced.txt
+++ b/docs/topics/testing/advanced.txt
@@ -37,7 +37,7 @@ Example
The following is a simple unit test using the request factory::
- from django.utils import unittest
+ import unittest
from django.test.client import RequestFactory
class SimpleTest(unittest.TestCase):
diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt
index 9cf805e371..6f75a3b7a8 100644
--- a/docs/topics/testing/overview.txt
+++ b/docs/topics/testing/overview.txt
@@ -800,7 +800,7 @@ Example
The following is a simple unit test using the test client::
- from django.utils import unittest
+ import unittest
from django.test.client import Client
class SimpleTest(unittest.TestCase):
@@ -1143,7 +1143,7 @@ worry about state (such as cookies) carrying over from one test to another.
This means, instead of instantiating a ``Client`` in each test::
- from django.utils import unittest
+ import unittest
from django.test.client import Client
class SimpleTest(unittest.TestCase):
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 2b772598d3..28f2dcb841 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -6,13 +6,14 @@ and default settings.py files.
"""
from __future__ import unicode_literals
+import codecs
import os
import re
import shutil
import socket
import subprocess
import sys
-import codecs
+import unittest
import django
from django import conf, get_version
@@ -20,7 +21,6 @@ from django.conf import settings
from django.core.management import BaseCommand, CommandError
from django.db import connection
from django.test.runner import DiscoverRunner
-from django.utils import unittest
from django.utils.encoding import force_text
from django.utils._os import upath
from django.utils.six import StringIO
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index 4823883f42..8edb2f5904 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -2,6 +2,7 @@
from __future__ import absolute_import, unicode_literals
from datetime import datetime
+from unittest import TestCase
from django import forms
from django.conf import settings
@@ -16,7 +17,6 @@ from django.test.utils import override_settings
from django.utils import six
from django.utils import translation
from django.utils.html import conditional_escape
-from django.utils.unittest import TestCase
from . import models
from .widgetadmin import site as widget_admin_site
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 80441b9a60..35ac57d9be 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -10,7 +10,6 @@ from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F, Q
from django.test import TestCase, Approximate, skipUnlessDBFeature
from django.utils import six
-from django.utils.unittest import expectedFailure
from .models import (Author, Book, Publisher, Clues, Entries, HardbackBook,
ItemTag, WithManualPK)
diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py
index 6dd0be2194..e0c7cbd78c 100644
--- a/tests/app_loading/tests.py
+++ b/tests/app_loading/tests.py
@@ -4,11 +4,12 @@ import copy
import os
import sys
import time
+from unittest import TestCase
from django.conf import Settings
from django.db.models.loading import cache, load_app, get_model, get_models
from django.utils._os import upath
-from django.utils.unittest import TestCase
+
class EggLoadingTest(TestCase):
diff --git a/tests/bash_completion/tests.py b/tests/bash_completion/tests.py
index 4fdb793feb..2da68b588a 100644
--- a/tests/bash_completion/tests.py
+++ b/tests/bash_completion/tests.py
@@ -3,10 +3,10 @@ A series of tests to establish that the command-line bash completion works.
"""
import os
import sys
+import unittest
from django.conf import settings
from django.core.management import ManagementUtility
-from django.utils import unittest
from django.utils.six import StringIO
diff --git a/tests/bug639/tests.py b/tests/bug639/tests.py
index fcc1e0f7d1..71c50e14aa 100644
--- a/tests/bug639/tests.py
+++ b/tests/bug639/tests.py
@@ -8,9 +8,9 @@ from __future__ import absolute_import
import os
import shutil
+import unittest
from django.core.files.uploadedfile import SimpleUploadedFile
-from django.utils import unittest
from django.utils._os import upath
from .models import Photo, PhotoForm, temp_storage_dir
diff --git a/tests/bug8245/tests.py b/tests/bug8245/tests.py
index 5da0b1f718..7a91d04af1 100644
--- a/tests/bug8245/tests.py
+++ b/tests/bug8245/tests.py
@@ -1,5 +1,6 @@
+from unittest import TestCase
+
from django.contrib import admin
-from django.utils.unittest import TestCase
class Bug8245Test(TestCase):
diff --git a/tests/builtin_server/tests.py b/tests/builtin_server/tests.py
index 662466a110..ef215ccf97 100644
--- a/tests/builtin_server/tests.py
+++ b/tests/builtin_server/tests.py
@@ -1,9 +1,9 @@
from __future__ import unicode_literals
from io import BytesIO
+from unittest import TestCase
from django.core.servers.basehttp import ServerHandler, MAX_SOCKET_CHUNK_SIZE
-from django.utils.unittest import TestCase
class DummyHandler(object):
diff --git a/tests/db_typecasts/tests.py b/tests/db_typecasts/tests.py
index 2cf835d94e..fc5305dcdd 100644
--- a/tests/db_typecasts/tests.py
+++ b/tests/db_typecasts/tests.py
@@ -1,10 +1,10 @@
# Unit tests for typecast functions in django.db.backends.util
import datetime
+import unittest
from django.db.backends import util as typecasts
from django.utils import six
-from django.utils import unittest
TEST_CASES = {
diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
index 05016be231..2aaea49500 100644
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -1,4 +1,5 @@
from functools import wraps
+from unittest import TestCase
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
@@ -6,7 +7,6 @@ from django.http import HttpResponse, HttpRequest, HttpResponseNotAllowed
from django.middleware.clickjacking import XFrameOptionsMiddleware
from django.utils.decorators import method_decorator
from django.utils.functional import allow_lazy, lazy, memoize
-from django.utils.unittest import TestCase
from django.views.decorators.cache import cache_page, never_cache, cache_control
from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt
from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition
diff --git a/tests/defaultfilters/tests.py b/tests/defaultfilters/tests.py
index d0009c6e66..15b96be881 100644
--- a/tests/defaultfilters/tests.py
+++ b/tests/defaultfilters/tests.py
@@ -3,11 +3,12 @@ from __future__ import unicode_literals
import datetime
import decimal
+import unittest
from django.template.defaultfilters import *
from django.test import TestCase
from django.utils import six
-from django.utils import unittest, translation
+from django.utils import translation
from django.utils.safestring import SafeData
from django.utils.encoding import python_2_unicode_compatible
diff --git a/tests/dispatch/tests/test_dispatcher.py b/tests/dispatch/tests/test_dispatcher.py
index a1d4c7e176..5f7dca87cc 100644
--- a/tests/dispatch/tests/test_dispatcher.py
+++ b/tests/dispatch/tests/test_dispatcher.py
@@ -1,9 +1,9 @@
import gc
import sys
import time
+import unittest
from django.dispatch import Signal, receiver
-from django.utils import unittest
if sys.platform.startswith('java'):
diff --git a/tests/dispatch/tests/test_saferef.py b/tests/dispatch/tests/test_saferef.py
index 30eaddfe18..a9a246304e 100644
--- a/tests/dispatch/tests/test_saferef.py
+++ b/tests/dispatch/tests/test_saferef.py
@@ -1,6 +1,7 @@
+import unittest
+
from django.dispatch.saferef import safeRef
from django.utils.six.moves import xrange
-from django.utils import unittest
class Test1(object):
def x(self):
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index e6caabf9d9..8cf4c33091 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -7,6 +7,7 @@ import shutil
import sys
import tempfile
import time
+import unittest
try:
from urllib.request import urlopen
except ImportError: # Python 2
@@ -28,7 +29,6 @@ from django.core.files.storage import FileSystemStorage, get_storage_class
from django.core.files.uploadedfile import UploadedFile
from django.test import LiveServerTestCase, SimpleTestCase
from django.utils import six
-from django.utils import unittest
from django.utils._os import upath
from django.test.utils import override_settings
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 45e7342abd..66bc4465a2 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -8,6 +8,7 @@ import json
import os
import shutil
import tempfile as sys_tempfile
+import unittest
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
@@ -16,7 +17,6 @@ from django.test import TestCase, client
from django.test.utils import override_settings
from django.utils.encoding import force_bytes
from django.utils.six import StringIO
-from django.utils import unittest
from . import uploadhandler
from .models import FileModel
diff --git a/tests/files/tests.py b/tests/files/tests.py
index f1e3d5b14b..54eeee13e4 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -4,6 +4,7 @@ import os
import gzip
import shutil
import tempfile
+import unittest
from django.core.cache import cache
from django.core.files import File
@@ -11,7 +12,6 @@ from django.core.files.move import file_move_safe
from django.core.files.base import ContentFile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
-from django.utils import unittest
from django.utils.six import StringIO
from .models import Storage, temp_storage, temp_storage_location
diff --git a/tests/forms_tests/tests/test_validators.py b/tests/forms_tests/tests/test_validators.py
index 0598835cff..08fb96618c 100644
--- a/tests/forms_tests/tests/test_validators.py
+++ b/tests/forms_tests/tests/test_validators.py
@@ -1,9 +1,10 @@
from __future__ import unicode_literals
+from unittest import TestCase
+
from django import forms
from django.core import validators
from django.core.exceptions import ValidationError
-from django.utils.unittest import TestCase
class UserForm(forms.Form):
diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py
index f95732f8b5..013a8f282c 100644
--- a/tests/generic_views/test_base.py
+++ b/tests/generic_views/test_base.py
@@ -1,11 +1,11 @@
from __future__ import absolute_import
import time
+import unittest
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from django.test import TestCase, RequestFactory
-from django.utils import unittest
from django.views.generic import View, TemplateView, RedirectView
from . import views
diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py
index 263326322e..bff909f7d0 100644
--- a/tests/generic_views/test_dates.py
+++ b/tests/generic_views/test_dates.py
@@ -2,12 +2,12 @@ from __future__ import absolute_import
import time
import datetime
+from unittest import skipUnless
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import override_settings
from django.utils import timezone
-from django.utils.unittest import skipUnless
from .models import Book, BookSigning
diff --git a/tests/generic_views/test_edit.py b/tests/generic_views/test_edit.py
index 982d9e5778..9ed18833e4 100644
--- a/tests/generic_views/test_edit.py
+++ b/tests/generic_views/test_edit.py
@@ -1,12 +1,12 @@
from __future__ import absolute_import
import warnings
+from unittest import expectedFailure
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django import forms
from django.test import TestCase
-from django.utils.unittest import expectedFailure
from django.test.client import RequestFactory
from django.views.generic.base import View
from django.views.generic.edit import FormMixin, CreateView
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index 673409fd99..3a2ec23864 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
import copy
import os
import pickle
+import unittest
import warnings
from django.core.exceptions import SuspiciousOperation
@@ -18,7 +19,6 @@ from django.test import TestCase
from django.utils.encoding import smart_str
from django.utils._os import upath
from django.utils import six
-from django.utils import unittest
class QueryDictTests(unittest.TestCase):
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py
index 672e35d286..605fe9037c 100644
--- a/tests/indexes/tests.py
+++ b/tests/indexes/tests.py
@@ -1,7 +1,8 @@
+from unittest import skipUnless
+
from django.core.management.color import no_style
from django.db import connections, DEFAULT_DB_ALIAS
from django.test import TestCase
-from django.utils.unittest import skipUnless
from .models import Article
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index 79cbbfa3f2..c9093b9e9e 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -2,11 +2,11 @@
from __future__ import unicode_literals
import re
+from unittest import expectedFailure
from django.core.management import call_command
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
-from django.utils.unittest import expectedFailure
from django.utils.six import PY3, StringIO
if connection.vendor == 'oracle':
diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
index 67e0266a66..f1c87bbf14 100644
--- a/tests/introspection/tests.py
+++ b/tests/introspection/tests.py
@@ -1,8 +1,9 @@
from __future__ import absolute_import, unicode_literals
+import unittest
+
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
-from django.utils import unittest
from .models import Reporter, Article
diff --git a/tests/invalid_models/tests.py b/tests/invalid_models/tests.py
index f878525b3b..9c9db91da9 100644
--- a/tests/invalid_models/tests.py
+++ b/tests/invalid_models/tests.py
@@ -1,11 +1,10 @@
import copy
import sys
+import unittest
from django.core.management.validation import get_validation_errors
from django.db.models.loading import cache, load_app
-
from django.test.utils import override_settings
-from django.utils import unittest
from django.utils.six import StringIO
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index 0c2d269464..cae2860306 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import copy
import logging
import sys
+from unittest import skipUnless
import warnings
from django.conf import LazySettings
@@ -13,7 +14,6 @@ from django.utils.encoding import force_text
from django.utils.log import (CallbackFilter, RequireDebugFalse,
RequireDebugTrue)
from django.utils.six import StringIO
-from django.utils.unittest import skipUnless
from admin_scripts.tests import AdminScriptTestCase
diff --git a/tests/max_lengths/tests.py b/tests/max_lengths/tests.py
index 9dfcabff45..0f525864d5 100644
--- a/tests/max_lengths/tests.py
+++ b/tests/max_lengths/tests.py
@@ -1,6 +1,6 @@
from __future__ import absolute_import
-from django.utils import unittest
+import unittest
from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
@@ -36,4 +36,4 @@ class MaxLengthORMTests(unittest.TestCase):
new_args = args.copy()
new_args[field] = "X" * 250 # a value longer than any of the default fields could hold.
p = PersonWithCustomMaxLengths.objects.create(**new_args)
- self.assertEqual(getattr(p, field), ("X" * 250)) \ No newline at end of file
+ self.assertEqual(getattr(p, field), ("X" * 250))
diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py
index f3165f939f..5ceab2e594 100644
--- a/tests/middleware/tests.py
+++ b/tests/middleware/tests.py
@@ -5,6 +5,7 @@ import gzip
from io import BytesIO
import random
import re
+from unittest import expectedFailure, skipIf
import warnings
from django.conf import settings
@@ -22,7 +23,6 @@ from django.test.utils import override_settings, IgnoreDeprecationWarningsMixin
from django.utils import six
from django.utils.encoding import force_str
from django.utils.six.moves import xrange
-from django.utils.unittest import expectedFailure, skipIf
from .models import Band
diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py
index 457892ddb8..f6019bd77f 100644
--- a/tests/model_fields/test_imagefield.py
+++ b/tests/model_fields/test_imagefield.py
@@ -2,13 +2,13 @@ from __future__ import absolute_import
import os
import shutil
+from unittest import skipIf
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.core.files.images import ImageFile
from django.test import TestCase
from django.utils._os import upath
-from django.utils.unittest import skipIf
try:
from .models import Image
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 6abeed8c42..6546c49ec7 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
import datetime
from decimal import Decimal
+import unittest
from django import test
from django import forms
@@ -9,7 +10,6 @@ from django.core.exceptions import ValidationError
from django.db import connection, models, IntegrityError
from django.db.models.fields.files import FieldFile
from django.utils import six
-from django.utils import unittest
from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post,
NullBooleanModel, BooleanModel, DataModel, Document, RenamedField,
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 2c3caef016..9d71798b3d 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
import datetime
import os
from decimal import Decimal
+from unittest import skipUnless
import warnings
from django import forms
@@ -13,7 +14,6 @@ from django.db import connection
from django.db.models.query import EmptyQuerySet
from django.forms.models import model_to_dict
from django.utils._os import upath
-from django.utils.unittest import skipUnless
from django.test import TestCase
from django.utils import six
diff --git a/tests/model_forms_regress/tests.py b/tests/model_forms_regress/tests.py
index 29d66a2cf0..35e706ac4c 100644
--- a/tests/model_forms_regress/tests.py
+++ b/tests/model_forms_regress/tests.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import, unicode_literals
from datetime import date
+import unittest
import warnings
from django import forms
@@ -9,7 +10,6 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms.models import (modelform_factory, ModelChoiceField,
fields_for_model, construct_instance, ModelFormMetaclass)
from django.utils import six
-from django.utils import unittest
from django.test import TestCase
from .models import (Person, RealPerson, Triple, FilePathModel, Article,
diff --git a/tests/model_inheritance_regress/tests.py b/tests/model_inheritance_regress/tests.py
index 28635a29a9..7ca16647fa 100644
--- a/tests/model_inheritance_regress/tests.py
+++ b/tests/model_inheritance_regress/tests.py
@@ -5,10 +5,10 @@ from __future__ import absolute_import, unicode_literals
import datetime
from operator import attrgetter
-from django import forms
+from unittest import expectedFailure
+from django import forms
from django.test import TestCase
-from django.utils.unittest import expectedFailure
from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,
diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py
index 71ccb071d2..2924b220e6 100644
--- a/tests/model_regress/tests.py
+++ b/tests/model_regress/tests.py
@@ -3,12 +3,12 @@ from __future__ import absolute_import, unicode_literals
import datetime
from operator import attrgetter
import sys
+import unittest
from django.core.exceptions import ValidationError
from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
from django.utils import tzinfo
-from django.utils import unittest
from django.db import connection, router
from django.db.models.sql import InsertQuery
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 805b57c070..0d0fed394a 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import, unicode_literals
from datetime import date
+import unittest
from django import forms
from django.conf import settings
@@ -15,7 +16,7 @@ from django.forms.models import BaseModelFormSet
from django.forms.widgets import Select
from django.test import TestCase
from django.test.utils import str_prefix
-from django.utils import unittest, six
+from django.utils import six
from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py
index 1dea4526e3..76799bec46 100644
--- a/tests/pagination/tests.py
+++ b/tests/pagination/tests.py
@@ -1,12 +1,12 @@
from __future__ import absolute_import, unicode_literals
from datetime import datetime
+import unittest
from django.core.paginator import (Paginator, EmptyPage, InvalidPage,
PageNotAnInteger)
from django.test import TestCase
from django.utils import six
-from django.utils import unittest
from .models import Article
from .custom import ValidAdjacentNumsPaginator
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 352e87a634..6520eb0176 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -4,6 +4,7 @@ import datetime
from operator import attrgetter
import pickle
import sys
+import unittest
from django.conf import settings
from django.core.exceptions import FieldError
@@ -13,7 +14,6 @@ from django.db.models.sql.where import WhereNode, EverythingNode, NothingNode
from django.db.models.sql.datastructures import EmptyResultSet
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import str_prefix
-from django.utils import unittest
from django.utils.datastructures import SortedDict
from .models import (
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index d9120db4e7..b00eec87a9 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -1,10 +1,11 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
-import time
-import warnings
from datetime import datetime, timedelta
from io import BytesIO
+import time
+from unittest import skipIf
+import warnings
from django.db import connection, connections, DEFAULT_DB_ALIAS
from django.core import signals
@@ -15,7 +16,6 @@ from django.test import SimpleTestCase, TransactionTestCase
from django.test.client import FakePayload
from django.test.utils import override_settings, str_prefix
from django.utils import six
-from django.utils.unittest import skipIf
from django.utils.http import cookie_date, urlencode
from django.utils.timezone import utc
diff --git a/tests/resolve_url/tests.py b/tests/resolve_url/tests.py
index d0bf44abde..70f9e51781 100644
--- a/tests/resolve_url/tests.py
+++ b/tests/resolve_url/tests.py
@@ -1,8 +1,9 @@
from __future__ import unicode_literals
+from unittest import TestCase
+
from django.core.urlresolvers import NoReverseMatch
from django.contrib.auth.views import logout
-from django.utils.unittest import TestCase
from django.shortcuts import resolve_url
from .models import UnimportantThing
diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py
index f087ca123a..b8a8ad19bf 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -2,13 +2,13 @@ from __future__ import absolute_import
import sys
import time
+import unittest
from django.conf import settings
from django.db import transaction, connection
from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError
from django.test import (TransactionTestCase, skipIfDBFeature,
skipUnlessDBFeature)
-from django.utils import unittest
from .models import Person
diff --git a/tests/select_related_onetoone/tests.py b/tests/select_related_onetoone/tests.py
index fce8fc4e73..d8ba4d0484 100644
--- a/tests/select_related_onetoone/tests.py
+++ b/tests/select_related_onetoone/tests.py
@@ -1,7 +1,8 @@
from __future__ import absolute_import
+import unittest
+
from django.test import TestCase
-from django.utils import unittest
from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
AdvancedUserStat, Image, Product, Parent1, Parent2, Child1, Child2, Child3,
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index 038276ca21..bff7c53249 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
# -*- coding: utf-8 -*-
import json
from datetime import datetime
+import unittest
from xml.dom import minidom
from django.conf import settings
@@ -11,7 +12,6 @@ from django.db import transaction, connection
from django.test import TestCase, TransactionTestCase, Approximate
from django.utils import six
from django.utils.six import StringIO
-from django.utils import unittest
from .models import (Category, Author, Article, AuthorProfile, Actor, Movie,
Score, Player, Team)
diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py
index 04b4d4c839..1751816cee 100644
--- a/tests/serializers_regress/tests.py
+++ b/tests/serializers_regress/tests.py
@@ -10,7 +10,7 @@ from __future__ import absolute_import, unicode_literals
import datetime
import decimal
-from django.core.serializers.xml_serializer import DTDForbidden
+from unittest import expectedFailure, skipUnless
try:
import yaml
@@ -20,13 +20,13 @@ except ImportError:
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
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
from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import curry
-from django.utils.unittest import expectedFailure, skipUnless
from .models import (BinaryData, BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index 625c4f31df..bfd8d607a9 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -1,4 +1,5 @@
import os
+import unittest
import warnings
from django.conf import settings, global_settings
@@ -6,7 +7,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
from django.test import SimpleTestCase, TransactionTestCase, TestCase, signals
from django.test.utils import override_settings
-from django.utils import unittest, six
+from django.utils import six
@override_settings(TEST='override', TEST_OUTER='outer')
diff --git a/tests/str/tests.py b/tests/str/tests.py
index bd85c48d05..d82908a0ee 100644
--- a/tests/str/tests.py
+++ b/tests/str/tests.py
@@ -2,10 +2,10 @@
from __future__ import absolute_import, unicode_literals
import datetime
+from unittest import skipIf
from django.test import TestCase
from django.utils import six
-from django.utils.unittest import skipIf
from .models import Article, BrokenArticle, InternationalArticle
diff --git a/tests/template_tests/loaders.py b/tests/template_tests/loaders.py
index b77965203f..497b422e7f 100644
--- a/tests/template_tests/loaders.py
+++ b/tests/template_tests/loaders.py
@@ -9,15 +9,16 @@ from django.conf import settings
if __name__ == '__main__':
settings.configure()
-import sys
-import pkg_resources
import imp
import os.path
+import pkg_resources
+import sys
+import unittest
from django.template import TemplateDoesNotExist, Context
from django.template.loaders.eggs import Loader as EggLoader
from django.template import loader
-from django.utils import unittest, six
+from django.utils import six
from django.utils._os import upath
from django.utils.six import StringIO
diff --git a/tests/template_tests/test_callables.py b/tests/template_tests/test_callables.py
index 882a8c6e06..718b7740d9 100644
--- a/tests/template_tests/test_callables.py
+++ b/tests/template_tests/test_callables.py
@@ -1,7 +1,8 @@
from __future__ import unicode_literals
+from unittest import TestCase
+
from django import template
-from django.utils.unittest import TestCase
class CallableVariablesTests(TestCase):
diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py
index 05c1dd57b9..224b94d060 100644
--- a/tests/template_tests/test_context.py
+++ b/tests/template_tests/test_context.py
@@ -1,6 +1,8 @@
# coding: utf-8
+
+from unittest import TestCase
+
from django.template import Context
-from django.utils.unittest import TestCase
class ContextTests(TestCase):
diff --git a/tests/template_tests/test_custom.py b/tests/template_tests/test_custom.py
index 4aea08237d..e941bc223e 100644
--- a/tests/template_tests/test_custom.py
+++ b/tests/template_tests/test_custom.py
@@ -1,8 +1,9 @@
from __future__ import absolute_import, unicode_literals
+from unittest import TestCase
+
from django import template
from django.utils import six
-from django.utils.unittest import TestCase
from .templatetags import custom
diff --git a/tests/template_tests/test_nodelist.py b/tests/template_tests/test_nodelist.py
index 97aa5af6a7..755c0c3bea 100644
--- a/tests/template_tests/test_nodelist.py
+++ b/tests/template_tests/test_nodelist.py
@@ -1,6 +1,7 @@
+from unittest import TestCase
+
from django.template import VariableNode, Context
from django.template.loader import get_template_from_string
-from django.utils.unittest import TestCase
from django.test.utils import override_settings
class NodelistTest(TestCase):
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py
index 9422da80d7..e626bfd34f 100644
--- a/tests/template_tests/test_parser.py
+++ b/tests/template_tests/test_parser.py
@@ -3,10 +3,11 @@ Testing some internals of the template processing. These are *not* examples to b
"""
from __future__ import unicode_literals
+from unittest import TestCase
+
from django.template import (TokenParser, FilterExpression, Parser, Variable,
Template, TemplateSyntaxError)
from django.test.utils import override_settings
-from django.utils.unittest import TestCase
from django.utils import six
diff --git a/tests/template_tests/test_smartif.py b/tests/template_tests/test_smartif.py
index 3a705ca663..4345e04126 100644
--- a/tests/template_tests/test_smartif.py
+++ b/tests/template_tests/test_smartif.py
@@ -1,5 +1,6 @@
+import unittest
+
from django.template.smartif import IfParser
-from django.utils import unittest
class SmartIfTests(unittest.TestCase):
diff --git a/tests/template_tests/test_unicode.py b/tests/template_tests/test_unicode.py
index 7cb2a28d15..773dd543b7 100644
--- a/tests/template_tests/test_unicode.py
+++ b/tests/template_tests/test_unicode.py
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+from unittest import TestCase
+
from django.template import Template, TemplateEncodingError, Context
from django.utils.safestring import SafeData
from django.utils import six
-from django.utils.unittest import TestCase
class UnicodeTests(TestCase):
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index ff31795fff..6b8a106623 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -13,6 +13,7 @@ import time
import os
import sys
import traceback
+import unittest
try:
from urllib.parse import urljoin
except ImportError: # Python 2
@@ -27,7 +28,6 @@ from django.template.loaders import app_directories, filesystem, cached
from django.test import RequestFactory, TestCase
from django.test.utils import (setup_test_template_loader,
restore_template_loaders, override_settings)
-from django.utils import unittest
from django.utils.encoding import python_2_unicode_compatible
from django.utils.formats import date_format
from django.utils._os import upath
diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py
index 1a0fb88367..b4f04e8bb0 100644
--- a/tests/test_runner/test_discover_runner.py
+++ b/tests/test_runner/test_discover_runner.py
@@ -1,10 +1,10 @@
from contextlib import contextmanager
import os
import sys
+from unittest import expectedFailure
from django.test import TestCase
from django.test.runner import DiscoverRunner
-from django.utils.unittest import expectedFailure
try:
import unittest2
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index 53a268e823..28ae0833c9 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -3,8 +3,9 @@ Tests for django test runner
"""
from __future__ import absolute_import, unicode_literals
-import sys
from optparse import make_option
+import sys
+import unittest
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
@@ -12,7 +13,6 @@ from django import db
from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature
from django.test.testcases import connections_support_transactions
from django.test.utils import IgnoreDeprecationWarningsMixin
-from django.utils import unittest
from django.utils.importlib import import_module
from admin_scripts.tests import AdminScriptTestCase
diff --git a/tests/test_suite_override/tests.py b/tests/test_suite_override/tests.py
index 6050e0c509..e647c02d76 100644
--- a/tests/test_suite_override/tests.py
+++ b/tests/test_suite_override/tests.py
@@ -1,6 +1,7 @@
+import unittest
+
from django.db.models import get_app
from django.test.utils import IgnoreDeprecationWarningsMixin
-from django.utils import unittest
def suite():
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index ec98a845a0..775a4a7c11 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
+import unittest
+from unittest import skip
+
from django.db import connection
from django.forms import EmailField, IntegerField
from django.http import HttpResponse
@@ -9,8 +12,6 @@ from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.html import HTMLParseError, parse_html
from django.test.utils import CaptureQueriesContext, IgnoreDeprecationWarningsMixin
from django.utils import six
-from django.utils import unittest
-from django.utils.unittest import skip
from .models import Person
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py
index dce5c3041d..49169f90f2 100644
--- a/tests/timezones/tests.py
+++ b/tests/timezones/tests.py
@@ -5,6 +5,7 @@ import os
import re
import sys
import time
+from unittest import skipIf, skipUnless
import warnings
from xml.dom.minidom import parseString
@@ -25,7 +26,6 @@ from django.test.utils import override_settings
from django.utils import six
from django.utils import timezone
from django.utils.tzinfo import FixedOffset
-from django.utils.unittest import skipIf, skipUnless
from .forms import EventForm, EventSplitForm, EventModelForm
from .models import Event, MaybeEvent, Session, SessionEvent, Timestamp, AllDayEvent
diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
index 2da4d9fc9a..afb573f366 100644
--- a/tests/transactions/tests.py
+++ b/tests/transactions/tests.py
@@ -1,12 +1,12 @@
from __future__ import absolute_import
import sys
+from unittest import skipIf, skipUnless
from django.db import connection, transaction, DatabaseError, IntegrityError
from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils import six
-from django.utils.unittest import skipIf, skipUnless
from .models import Reporter
diff --git a/tests/transactions_regress/tests.py b/tests/transactions_regress/tests.py
index 7db32fa4f3..bd9e78b033 100644
--- a/tests/transactions_regress/tests.py
+++ b/tests/transactions_regress/tests.py
@@ -1,11 +1,12 @@
from __future__ import absolute_import
+from unittest import skipIf, skipUnless
+
from django.db import (connection, connections, transaction, DEFAULT_DB_ALIAS, DatabaseError,
IntegrityError)
from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test.utils import override_settings, IgnoreDeprecationWarningsMixin
-from django.utils.unittest import skipIf, skipUnless
from .models import Mod, M2mA, M2mB, SubMod
diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
index 3962f69288..222ebe053b 100644
--- a/tests/urlpatterns_reverse/tests.py
+++ b/tests/urlpatterns_reverse/tests.py
@@ -3,6 +3,8 @@ Unit tests for reverse URL lookups.
"""
from __future__ import absolute_import, unicode_literals
+import unittest
+
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
@@ -12,7 +14,7 @@ from django.core.urlresolvers import (reverse, resolve, get_callable,
from django.http import HttpRequest, HttpResponseRedirect, HttpResponsePermanentRedirect
from django.shortcuts import redirect
from django.test import TestCase
-from django.utils import unittest, six
+from django.utils import six
from . import urlconf_outer, middleware, views
diff --git a/tests/utils_tests/test_archive.py b/tests/utils_tests/test_archive.py
index 8861b4a577..f00f25e855 100644
--- a/tests/utils_tests/test_archive.py
+++ b/tests/utils_tests/test_archive.py
@@ -1,7 +1,7 @@
import os
import shutil
import tempfile
-from django.utils import unittest
+import unittest
from django.utils.archive import Archive, extract
from django.utils._os import upath
diff --git a/tests/utils_tests/test_baseconv.py b/tests/utils_tests/test_baseconv.py
index d69a3a6412..d49dde1092 100644
--- a/tests/utils_tests/test_baseconv.py
+++ b/tests/utils_tests/test_baseconv.py
@@ -1,4 +1,5 @@
-from django.utils.unittest import TestCase
+from unittest import TestCase
+
from django.utils.baseconv import base2, base16, base36, base56, base62, base64, BaseConverter
from django.utils.six.moves import xrange
diff --git a/tests/utils_tests/test_crypto.py b/tests/utils_tests/test_crypto.py
index 5cf2934ab0..4c1d10bb5f 100644
--- a/tests/utils_tests/test_crypto.py
+++ b/tests/utils_tests/test_crypto.py
@@ -1,11 +1,11 @@
from __future__ import unicode_literals
import binascii
+import hashlib
import math
import timeit
-import hashlib
+import unittest
-from django.utils import unittest
from django.utils.crypto import constant_time_compare, pbkdf2
diff --git a/tests/utils_tests/test_dateparse.py b/tests/utils_tests/test_dateparse.py
index 1a6ca646b8..836c26c573 100644
--- a/tests/utils_tests/test_dateparse.py
+++ b/tests/utils_tests/test_dateparse.py
@@ -1,9 +1,9 @@
from __future__ import unicode_literals
from datetime import date, time, datetime
+import unittest
from django.utils.dateparse import parse_date, parse_time, parse_datetime
-from django.utils import unittest
from django.utils.tzinfo import FixedOffset
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index 7aaba25a7a..72c35adec6 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -1,7 +1,8 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
-from django.utils import unittest
+import unittest
+
from django.utils.encoding import force_bytes, filepath_to_uri
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py
index 3bb50007c6..df377c6e06 100644
--- a/tests/utils_tests/test_functional.py
+++ b/tests/utils_tests/test_functional.py
@@ -1,4 +1,5 @@
-from django.utils import unittest
+import unittest
+
from django.utils.functional import lazy, lazy_property, cached_property
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index b973f1c64f..1f2e19d8d5 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -2,11 +2,11 @@ from __future__ import unicode_literals
from datetime import datetime
import os
+from unittest import TestCase
from django.utils import html
from django.utils._os import upath
from django.utils.encoding import force_text
-from django.utils.unittest import TestCase
class TestUtilsHtml(TestCase):
diff --git a/tests/utils_tests/test_http.py b/tests/utils_tests/test_http.py
index 6d3bc025af..581eb1dcd7 100644
--- a/tests/utils_tests/test_http.py
+++ b/tests/utils_tests/test_http.py
@@ -1,12 +1,12 @@
from datetime import datetime
import sys
+import unittest
from django.http import HttpResponse, utils
from django.test import RequestFactory
from django.utils.datastructures import MultiValueDict
from django.utils import http
from django.utils import six
-from django.utils import unittest
class TestUtilsHttp(unittest.TestCase):
diff --git a/tests/utils_tests/test_ipv6.py b/tests/utils_tests/test_ipv6.py
index 1713de82b8..662e8b4135 100644
--- a/tests/utils_tests/test_ipv6.py
+++ b/tests/utils_tests/test_ipv6.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
-from django.utils import unittest
+import unittest
+
from django.utils.ipv6 import is_valid_ipv6_address, clean_ipv6_address
class TestUtilsIPv6(unittest.TestCase):
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py
index 0a905ef2f1..5a43a927bf 100644
--- a/tests/utils_tests/test_module_loading.py
+++ b/tests/utils_tests/test_module_loading.py
@@ -1,10 +1,10 @@
+import imp
import os
import sys
-import imp
+import unittest
from zipimport import zipimporter
from django.core.exceptions import ImproperlyConfigured
-from django.utils import unittest
from django.utils.importlib import import_module
from django.utils.module_loading import import_by_path, module_has_submodule
from django.utils._os import upath
diff --git a/tests/utils_tests/test_os_utils.py b/tests/utils_tests/test_os_utils.py
index a205d67431..da54e93ac0 100644
--- a/tests/utils_tests/test_os_utils.py
+++ b/tests/utils_tests/test_os_utils.py
@@ -1,6 +1,6 @@
import os
+import unittest
-from django.utils import unittest
from django.utils._os import safe_join
diff --git a/tests/utils_tests/test_regex_helper.py b/tests/utils_tests/test_regex_helper.py
index 41f4a4f85d..055da89ee0 100644
--- a/tests/utils_tests/test_regex_helper.py
+++ b/tests/utils_tests/test_regex_helper.py
@@ -1,7 +1,8 @@
from __future__ import unicode_literals
+import unittest
+
from django.utils import regex_helper
-from django.utils import unittest
class NormalizeTests(unittest.TestCase):
diff --git a/tests/utils_tests/test_simplelazyobject.py b/tests/utils_tests/test_simplelazyobject.py
index 4c01bd3adf..7b681d9290 100644
--- a/tests/utils_tests/test_simplelazyobject.py
+++ b/tests/utils_tests/test_simplelazyobject.py
@@ -3,9 +3,9 @@ from __future__ import unicode_literals
import copy
import pickle
import sys
+from unittest import TestCase
from django.utils import six
-from django.utils.unittest import TestCase
from django.utils.functional import SimpleLazyObject, empty
diff --git a/tests/utils_tests/test_termcolors.py b/tests/utils_tests/test_termcolors.py
index 8cc28009cd..3a74244c09 100644
--- a/tests/utils_tests/test_termcolors.py
+++ b/tests/utils_tests/test_termcolors.py
@@ -1,4 +1,5 @@
-from django.utils import unittest
+import unittest
+
from django.utils.termcolors import (parse_color_setting, PALETTES,
DEFAULT_PALETTE, LIGHT_PALETTE, DARK_PALETTE, NOCOLOR_PALETTE, colorize)
diff --git a/tests/utils_tests/test_timezone.py b/tests/utils_tests/test_timezone.py
index 650198e8ff..2a13c10d7c 100644
--- a/tests/utils_tests/test_timezone.py
+++ b/tests/utils_tests/test_timezone.py
@@ -1,10 +1,11 @@
import copy
import datetime
import pickle
+import unittest
+
from django.test.utils import override_settings
from django.utils import timezone
from django.utils.tzinfo import FixedOffset
-from django.utils import unittest
EAT = FixedOffset(180) # Africa/Nairobi
diff --git a/tests/utils_tests/test_tzinfo.py b/tests/utils_tests/test_tzinfo.py
index cec92652cd..1867743fef 100644
--- a/tests/utils_tests/test_tzinfo.py
+++ b/tests/utils_tests/test_tzinfo.py
@@ -3,8 +3,9 @@ import datetime
import os
import pickle
import time
+import unittest
+
from django.utils.tzinfo import FixedOffset, LocalTimezone
-from django.utils import unittest
class TzinfoTests(unittest.TestCase):
diff --git a/tests/validation/test_error_messages.py b/tests/validation/test_error_messages.py
index 63c033a750..aa01db6007 100644
--- a/tests/validation/test_error_messages.py
+++ b/tests/validation/test_error_messages.py
@@ -1,10 +1,11 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
+from unittest import TestCase
+
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import six
-from django.utils.unittest import TestCase
class ValidationMessagesTest(TestCase):
diff --git a/tests/validation/test_unique.py b/tests/validation/test_unique.py
index 038da16494..a481fcb1c4 100644
--- a/tests/validation/test_unique.py
+++ b/tests/validation/test_unique.py
@@ -1,10 +1,10 @@
from __future__ import absolute_import, unicode_literals
import datetime
+import unittest
from django.core.exceptions import ValidationError
from django.test import TestCase
-from django.utils import unittest
from .models import (CustomPKModel, UniqueTogetherModel, UniqueFieldsModel,
UniqueForDateModel, ModelToValidate, Post, FlexibleDatePost,
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index a1555d8e91..ec3e2dc8c1 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+from datetime import datetime, timedelta
import re
import types
-from datetime import datetime, timedelta
+from unittest import TestCase
from django.core.exceptions import ValidationError
from django.core.validators import *
from django.test.utils import str_prefix
-from django.utils.unittest import TestCase
NOW = datetime.now()
diff --git a/tests/version/tests.py b/tests/version/tests.py
index 64621a5cb6..a5d49fc450 100644
--- a/tests/version/tests.py
+++ b/tests/version/tests.py
@@ -1,8 +1,8 @@
import re
+from unittest import TestCase
from django import get_version
from django.utils import six
-from django.utils.unittest import TestCase
class VersionTests(TestCase):
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index f686eee0e0..bc77fc351a 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -8,6 +8,7 @@ import os
import shutil
import sys
from tempfile import NamedTemporaryFile, mkdtemp, mkstemp
+from unittest import skipIf
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
@@ -22,7 +23,6 @@ from .. import BrokenException, except_args
from ..views import (sensitive_view, non_sensitive_view, paranoid_view,
custom_exception_reporter_filter_view, sensitive_method_view,
sensitive_args_function_caller, sensitive_kwargs_function_caller)
-from django.utils.unittest import skipIf
@override_settings(DEBUG=True, TEMPLATE_DEBUG=True)