diff --git a/INSTALL b/INSTALL index 5ae2b26900..92be6da650 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ Thanks for downloading Django. -To install it, make sure you have Python 2.6 or greater installed. Then run +To install it, make sure you have Python 2.7 or greater installed. Then run this command from the command prompt: python setup.py install @@ -12,7 +12,6 @@ site-packages directory, which is located wherever your Python installation lives. Some places you might check are: /usr/lib/python2.7/site-packages (Unix, Python 2.7) - /usr/lib/python2.6/site-packages (Unix, Python 2.6) C:\\PYTHON\site-packages (Windows) For more detailed instructions, see docs/intro/install.txt. diff --git a/django/bin/daily_cleanup.py b/django/bin/daily_cleanup.py deleted file mode 100755 index 5a2ce210f4..0000000000 --- a/django/bin/daily_cleanup.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python - -""" -Daily cleanup job. - -Can be run as a cronjob to clean out old data from the database (only expired -sessions at the moment). -""" - -import warnings - -from django.core import management - -if __name__ == "__main__": - warnings.warn( - "The `daily_cleanup` script has been deprecated " - "in favor of `django-admin.py clearsessions`.", - DeprecationWarning) - management.call_command('clearsessions') diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 61584391cd..c4b9634d83 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -59,14 +59,10 @@ class LazySettings(LazyObject): Setup logging from LOGGING_CONFIG and LOGGING settings. """ if not sys.warnoptions: - try: - # Route warnings through python logging - logging.captureWarnings(True) - # Allow DeprecationWarnings through the warnings filters - warnings.simplefilter("default", DeprecationWarning) - except AttributeError: - # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway - pass + # Route warnings through python logging + logging.captureWarnings(True) + # Allow DeprecationWarnings through the warnings filters + warnings.simplefilter("default", DeprecationWarning) if self.LOGGING_CONFIG: from django.utils.log import DEFAULT_LOGGING @@ -132,19 +128,17 @@ class Settings(BaseSettings): % (self.SETTINGS_MODULE, e) ) - # Settings that should be converted into tuples if they're mistakenly entered - # as strings. tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS") for setting in dir(mod): if setting == setting.upper(): setting_value = getattr(mod, setting) + if setting in tuple_settings and \ isinstance(setting_value, six.string_types): - warnings.warn("The %s setting must be a tuple. Please fix your " - "settings, as auto-correction is now deprecated." % setting, - DeprecationWarning, stacklevel=2) - setting_value = (setting_value,) # In case the user forgot the comma. + raise ImproperlyConfigured("The %s setting must be a tuple. " + "Please fix your settings." % setting) + setattr(self, setting, setting_value) if not self.SECRET_KEY: diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 310b5c163f..7882b21b9b 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -562,7 +562,7 @@ MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' ########### # The callable to use to configure logging -LOGGING_CONFIG = 'django.utils.log.dictConfig' +LOGGING_CONFIG = 'logging.config.dictConfig' # Custom logging configuration. LOGGING = {} diff --git a/django/conf/urls/shortcut.py b/django/conf/urls/shortcut.py index c00d176ad6..08ecd90aa3 100644 --- a/django/conf/urls/shortcut.py +++ b/django/conf/urls/shortcut.py @@ -3,7 +3,7 @@ import warnings from django.conf.urls import patterns warnings.warn("django.conf.urls.shortcut will be removed in Django 1.8.", - PendingDeprecationWarning) + DeprecationWarning) urlpatterns = patterns('django.views', (r'^(?P\d+)/(?P.*)/$', 'defaults.shortcut'), diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index fd516cb512..9c92f7ae9c 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -76,7 +76,7 @@ csrf_protect_m = method_decorator(csrf_protect) class RenameBaseModelAdminMethods(forms.MediaDefiningClass, RenameMethodsBase): renamed_methods = ( - ('queryset', 'get_queryset', PendingDeprecationWarning), + ('queryset', 'get_queryset', DeprecationWarning), ) 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/admin/util.py b/django/contrib/admin/util.py index a53cd367b4..dd9047c428 100644 --- a/django/contrib/admin/util.py +++ b/django/contrib/admin/util.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import datetime import decimal +from django.contrib.auth import get_permission_codename from django.db import models from django.db.models.constants import LOOKUP_SEP from django.db.models.deletion import Collector @@ -119,7 +120,7 @@ def get_deleted_objects(objs, opts, user, admin_site, using): opts.model_name), None, (quote(obj._get_pk_val()),)) p = '%s.%s' % (opts.app_label, - opts.get_delete_permission()) + get_permission_codename('delete', opts)) if not user.has_perm(p): perms_needed.add(opts.verbose_name) # Display a link to the admin page. diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 56462dece8..f766031bf8 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -52,7 +52,7 @@ def _is_changelist_popup(request): warnings.warn( "The `%s` GET parameter has been renamed to `%s`." % (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR), - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return True return False @@ -60,7 +60,7 @@ def _is_changelist_popup(request): class RenameChangeListMethods(RenameMethodsBase): renamed_methods = ( - ('get_query_set', 'get_queryset', PendingDeprecationWarning), + ('get_query_set', 'get_queryset', DeprecationWarning), ) @@ -115,14 +115,14 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): def root_query_set(self): warnings.warn("`ChangeList.root_query_set` is deprecated, " "use `root_queryset` instead.", - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return self.root_queryset @property def query_set(self): warnings.warn("`ChangeList.query_set` is deprecated, " "use `queryset` instead.", - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return self.queryset def get_filters_params(self, params=None): 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/forms.py b/django/contrib/auth/forms.py index 43f5303b63..2d7a7c14d4 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -1,7 +1,5 @@ from __future__ import unicode_literals -import warnings - from django import forms from django.forms.util import flatatt from django.template import loader @@ -200,10 +198,6 @@ class AuthenticationForm(forms.Form): ) return self.cleaned_data - def check_for_test_cookie(self): - warnings.warn("check_for_test_cookie is deprecated; ensure your login " - "view is CSRF-protected.", DeprecationWarning) - def get_user_id(self): if self.user_cache: return self.user_cache.id diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 5fec99a783..cf3d37e5c3 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -1,8 +1,6 @@ from __future__ import unicode_literals import re -import warnings -from django.core.exceptions import ImproperlyConfigured from django.core.mail import send_mail from django.core import validators from django.db import models @@ -14,7 +12,6 @@ from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from django.contrib import auth -# UNUSABLE_PASSWORD is still imported here for backwards compatibility from django.contrib.auth.hashers import ( check_password, make_password, is_password_usable) from django.contrib.auth.signals import user_logged_in @@ -32,10 +29,6 @@ def update_last_login(sender, user, **kwargs): user_logged_in.connect(update_last_login) -class SiteProfileNotAvailable(Exception): - pass - - class PermissionManager(models.Manager): def get_by_natural_key(self, codename, app_label, model): return self.get( @@ -413,38 +406,6 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): """ send_mail(subject, message, from_email, [self.email]) - def get_profile(self): - """ - Returns site-specific profile for this user. Raises - SiteProfileNotAvailable if this site does not allow profiles. - """ - warnings.warn("The use of AUTH_PROFILE_MODULE to define user profiles has been deprecated.", - DeprecationWarning, stacklevel=2) - if not hasattr(self, '_profile_cache'): - from django.conf import settings - if not getattr(settings, 'AUTH_PROFILE_MODULE', False): - raise SiteProfileNotAvailable( - 'You need to set AUTH_PROFILE_MODULE in your project ' - 'settings') - try: - app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.') - except ValueError: - raise SiteProfileNotAvailable( - 'app_label and model_name should be separated by a dot in ' - 'the AUTH_PROFILE_MODULE setting') - try: - model = models.get_model(app_label, model_name) - if model is None: - raise SiteProfileNotAvailable( - 'Unable to load the profile model, check ' - 'AUTH_PROFILE_MODULE in your project settings') - self._profile_cache = model._default_manager.using( - self._state.db).get(user__id__exact=self.id) - self._profile_cache.user = self - except (ImportError, ImproperlyConfigured): - raise SiteProfileNotAvailable - return self._profile_cache - class User(AbstractUser): """ 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_models.py b/django/contrib/auth/tests/test_models.py index b0a4559b42..fa20775a8d 100644 --- a/django/contrib/auth/tests/test_models.py +++ b/django/contrib/auth/tests/test_models.py @@ -1,46 +1,9 @@ -import warnings - -from django.conf import settings from django.contrib.auth import get_user_model -from django.contrib.auth.models import (Group, User, SiteProfileNotAvailable, - UserManager) +from django.contrib.auth.models import Group, User, UserManager from django.contrib.auth.tests.utils import skipIfCustomUser from django.db.models.signals import post_save from django.test import TestCase from django.test.utils import override_settings -from django.utils import six - - -@skipIfCustomUser -@override_settings(USE_TZ=False, AUTH_PROFILE_MODULE='') -class ProfileTestCase(TestCase): - - def test_site_profile_not_available(self): - user = User.objects.create(username='testclient') - - # calling get_profile without AUTH_PROFILE_MODULE set - del settings.AUTH_PROFILE_MODULE - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - with six.assertRaisesRegex(self, SiteProfileNotAvailable, - "You need to set AUTH_PROFILE_MODULE in your project"): - user.get_profile() - - # Bad syntax in AUTH_PROFILE_MODULE: - settings.AUTH_PROFILE_MODULE = 'foobar' - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - with six.assertRaisesRegex(self, SiteProfileNotAvailable, - "app_label and model_name should be separated by a dot"): - user.get_profile() - - # module that doesn't exist - settings.AUTH_PROFILE_MODULE = 'foo.bar' - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - with six.assertRaisesRegex(self, SiteProfileNotAvailable, - "Unable to load the profile model"): - user.get_profile() @skipIfCustomUser 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/test_views.py b/django/contrib/auth/tests/test_views.py index ba06a6af4d..b939dff058 100644 --- a/django/contrib/auth/tests/test_views.py +++ b/django/contrib/auth/tests/test_views.py @@ -13,7 +13,7 @@ from django.core import mail from django.core.urlresolvers import reverse, NoReverseMatch from django.http import QueryDict, HttpRequest from django.utils.encoding import force_text -from django.utils.http import int_to_base36, urlsafe_base64_decode, urlquote +from django.utils.http import urlquote from django.utils._os import upath from django.test import TestCase from django.test.utils import override_settings, patch_logger @@ -193,16 +193,6 @@ class PasswordResetTest(AuthViewsTestCase): # redirect to a 'complete' page: self.assertContains(response, "Please enter your new password") - def test_confirm_valid_base36(self): - # Remove in Django 1.7 - url, path = self._test_confirm_start() - path_parts = path.strip("/").split("/") - # construct an old style (base36) URL by converting the base64 ID - path_parts[1] = int_to_base36(int(urlsafe_base64_decode(path_parts[1]))) - response = self.client.get("/%s/%s-%s/" % tuple(path_parts)) - # redirect to a 'complete' page: - self.assertContains(response, "Please enter your new password") - def test_confirm_invalid(self): url, path = self._test_confirm_start() # Let's munge the token in the path, but keep the same length, @@ -217,21 +207,11 @@ class PasswordResetTest(AuthViewsTestCase): response = self.client.get('/reset/123456/1-1/') self.assertContains(response, "The password reset link was invalid") - def test_confirm_invalid_user_base36(self): - # Remove in Django 1.7 - response = self.client.get('/reset/123456-1-1/') - self.assertContains(response, "The password reset link was invalid") - def test_confirm_overflow_user(self): # Ensure that we get a 200 response for a base36 user id that overflows int response = self.client.get('/reset/zzzzzzzzzzzzz/1-1/') self.assertContains(response, "The password reset link was invalid") - def test_confirm_overflow_user_base36(self): - # Remove in Django 1.7 - response = self.client.get('/reset/zzzzzzzzzzzzz-1-1/') - self.assertContains(response, "The password reset link was invalid") - def test_confirm_invalid_post(self): # Same as test_confirm_invalid, but trying # to do a POST instead. 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/auth/urls.py b/django/contrib/auth/urls.py index 801d133437..85b8b2869d 100644 --- a/django/contrib/auth/urls.py +++ b/django/contrib/auth/urls.py @@ -12,9 +12,6 @@ urlpatterns = patterns('', url(r'^password_change/done/$', 'django.contrib.auth.views.password_change_done', name='password_change_done'), url(r'^password_reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'), url(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'), - # Support old style base36 password reset links; remove in Django 1.7 - url(r'^reset/(?P[0-9A-Za-z]{1,13})-(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', - 'django.contrib.auth.views.password_reset_confirm_uidb36'), url(r'^reset/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'), diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index e9affb33cd..b731a2b3d1 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -228,15 +228,6 @@ def password_reset_confirm(request, uidb64=None, token=None, return TemplateResponse(request, template_name, context, current_app=current_app) -def password_reset_confirm_uidb36(request, uidb36=None, **kwargs): - # Support old password reset URLs that used base36 encoded user IDs. - # Remove in Django 1.7 - try: - uidb64 = force_text(urlsafe_base64_encode(force_bytes(base36_to_int(uidb36)))) - except ValueError: - uidb64 = '1' # dummy invalid ID (incorrect padding for base64) - return password_reset_confirm(request, uidb64=uidb64, **kwargs) - def password_reset_complete(request, template_name='registration/password_reset_complete.html', current_app=None, extra_context=None): diff --git a/django/contrib/comments/__init__.py b/django/contrib/comments/__init__.py index 007b77ad7b..0b3fcebc51 100644 --- a/django/contrib/comments/__init__.py +++ b/django/contrib/comments/__init__.py @@ -6,7 +6,7 @@ from django.contrib.comments.models import Comment from django.contrib.comments.forms import CommentForm from django.utils.importlib import import_module -warnings.warn("django.contrib.comments is deprecated and will be removed before Django 1.8.", PendingDeprecationWarning) +warnings.warn("django.contrib.comments is deprecated and will be removed before Django 1.8.", DeprecationWarning) DEFAULT_COMMENTS_APP = 'django.contrib.comments' diff --git a/django/contrib/comments/templatetags/comments.py b/django/contrib/comments/templatetags/comments.py index d8eed76ad6..2b2cea5f20 100644 --- a/django/contrib/comments/templatetags/comments.py +++ b/django/contrib/comments/templatetags/comments.py @@ -12,7 +12,7 @@ register = template.Library() class RenameBaseCommentNodeMethods(RenameMethodsBase): renamed_methods = ( - ('get_query_set', 'get_queryset', PendingDeprecationWarning), + ('get_query_set', 'get_queryset', DeprecationWarning), ) diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py index 26db4ab171..04d4894b8a 100644 --- a/django/contrib/contenttypes/generic.py +++ b/django/contrib/contenttypes/generic.py @@ -25,7 +25,7 @@ from django.utils.encoding import smart_text class RenameGenericForeignKeyMethods(RenameMethodsBase): renamed_methods = ( - ('get_prefetch_query_set', 'get_prefetch_queryset', PendingDeprecationWarning), + ('get_prefetch_query_set', 'get_prefetch_queryset', DeprecationWarning), ) @@ -434,8 +434,8 @@ def generic_inlineformset_factory(model, form=ModelForm, """ Returns a ``GenericInlineFormSet`` for the given kwargs. - You must provide ``ct_field`` and ``object_id`` if they different from the - defaults ``content_type`` and ``object_id`` respectively. + You must provide ``ct_field`` and ``fk_field`` if they are different from + the defaults ``content_type`` and ``object_id`` respectively. """ opts = model._meta # if there is no field called `ct_field` let the exception propagate 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/forms/fields.py b/django/contrib/gis/forms/fields.py index 59e725926c..2fb8b545e0 100644 --- a/django/contrib/gis/forms/fields.py +++ b/django/contrib/gis/forms/fields.py @@ -1,7 +1,5 @@ from __future__ import unicode_literals -import warnings - from django import forms from django.utils import six from django.utils.translation import ugettext_lazy as _ @@ -34,10 +32,6 @@ class GeometryField(forms.Field): # defaults (e.g., allow None). self.srid = kwargs.pop('srid', None) self.geom_type = kwargs.pop('geom_type', self.geom_type) - if 'null' in kwargs: - kwargs.pop('null', True) - warnings.warn("Passing 'null' keyword argument to GeometryField is deprecated.", - DeprecationWarning, stacklevel=2) super(GeometryField, self).__init__(**kwargs) self.widget.attrs['geom_type'] = self.geom_type 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..487f879674 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -1,6 +1,8 @@ from __future__ import absolute_import import re +import unittest +from unittest import skipUnless from django.db import connection from django.contrib.gis import gdal @@ -9,8 +11,7 @@ from django.contrib.gis.tests.utils import ( no_mysql, no_oracle, no_spatialite, mysql, oracle, postgis, spatialite) from django.test import TestCase -from django.utils import six, unittest -from django.utils.unittest import skipUnless +from django.utils import six 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('