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('