Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to Deprecati…

…onWarnings, and removed 1.1 deprecated code.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1070c57b83efdfd4fbed09280fcdaafc6d9c1a81 1 parent 5e5be2c
@freakboy3742 freakboy3742 authored
Showing with 97 additions and 145 deletions.
  1. +0 −75 django/contrib/admin/sites.py
  2. +2 −2 django/contrib/auth/__init__.py
  3. +2 −2 django/contrib/auth/models.py
  4. +6 −0 django/contrib/auth/tests/auth_backends.py
  5. +1 −1  django/contrib/csrf/middleware.py
  6. +3 −3 django/contrib/gis/tests/__init__.py
  7. +6 −0 django/contrib/messages/tests/base.py
  8. +1 −1  django/contrib/syndication/feeds.py
  9. +1 −1  django/contrib/syndication/views.py
  10. +1 −1  django/core/cache/backends/memcached.py
  11. +1 −1  django/core/context_processors.py
  12. +1 −1  django/core/mail/__init__.py
  13. +1 −1  django/core/management/commands/test.py
  14. +3 −3 django/db/__init__.py
  15. +4 −4 django/db/backends/creation.py
  16. +1 −1  django/db/backends/postgresql/base.py
  17. +4 −4 django/db/models/fields/subclassing.py
  18. +1 −1  django/db/utils.py
  19. +1 −1  django/forms/fields.py
  20. +1 −1  django/middleware/csrf.py
  21. +0 −19 django/middleware/http.py
  22. +1 −1  django/template/loader.py
  23. +1 −1  django/template/loaders/app_directories.py
  24. +1 −1  django/template/loaders/eggs.py
  25. +1 −1  django/template/loaders/filesystem.py
  26. +1 −1  django/test/simple.py
  27. +2 −2 django/utils/translation/trans_null.py
  28. +5 −5 django/utils/translation/trans_real.py
  29. +2 −2 tests/modeltests/custom_pk/fields.py
  30. +2 −0  tests/modeltests/field_subclassing/fields.py
  31. +2 −1  tests/modeltests/serializers/models.py
  32. +11 −0 tests/regressiontests/context_processors/tests.py
  33. +9 −0 tests/regressiontests/csrf_tests/tests.py
  34. +13 −5 tests/regressiontests/syndication/tests.py
  35. +4 −1 tests/regressiontests/templates/loaders.py
  36. +1 −1  tests/runtests.py
View
75 django/contrib/admin/sites.py
@@ -456,81 +456,6 @@ def app_index(self, request, app_label, extra_context=None):
context_instance=context_instance
)
- def root(self, request, url):
- """
- DEPRECATED. This function is the old way of handling URL resolution, and
- is deprecated in favor of real URL resolution -- see ``get_urls()``.
-
- This function still exists for backwards-compatibility; it will be
- removed in Django 1.3.
- """
- import warnings
- warnings.warn(
- "AdminSite.root() is deprecated; use include(admin.site.urls) instead.",
- DeprecationWarning
- )
-
- #
- # Again, remember that the following only exists for
- # backwards-compatibility. Any new URLs, changes to existing URLs, or
- # whatever need to be done up in get_urls(), above!
- #
-
- if request.method == 'GET' and not request.path.endswith('/'):
- return http.HttpResponseRedirect(request.path + '/')
-
- if settings.DEBUG:
- self.check_dependencies()
-
- # Figure out the admin base URL path and stash it for later use
- self.root_path = re.sub(re.escape(url) + '$', '', request.path)
-
- url = url.rstrip('/') # Trim trailing slash, if it exists.
-
- # The 'logout' view doesn't require that the person is logged in.
- if url == 'logout':
- return self.logout(request)
-
- # Check permission to continue or display login form.
- if not self.has_permission(request):
- return self.login(request)
-
- if url == '':
- return self.index(request)
- elif url == 'password_change':
- return self.password_change(request)
- elif url == 'password_change/done':
- return self.password_change_done(request)
- elif url == 'jsi18n':
- return self.i18n_javascript(request)
- # URLs starting with 'r/' are for the "View on site" links.
- elif url.startswith('r/'):
- from django.contrib.contenttypes.views import shortcut
- return shortcut(request, *url.split('/')[1:])
- else:
- if '/' in url:
- return self.model_page(request, *url.split('/', 2))
- else:
- return self.app_index(request, url)
-
- raise http.Http404('The requested admin page does not exist.')
-
- def model_page(self, request, app_label, model_name, rest_of_url=None):
- """
- DEPRECATED. This is the old way of handling a model view on the admin
- site; the new views should use get_urls(), above.
- """
- from django.db import models
- model = models.get_model(app_label, model_name)
- if model is None:
- raise http.Http404("App %r, model %r, not found." % (app_label, model_name))
- try:
- admin_obj = self._registry[model]
- except KeyError:
- raise http.Http404("This model exists but has not been registered with the admin site.")
- return admin_obj(request, rest_of_url)
- model_page = never_cache(model_page)
-
# This global object represents the default admin site, for the common case.
# You can instantiate AdminSite in your own code to create a custom admin site.
site = AdminSite()
View
4 django/contrib/auth/__init__.py
@@ -22,12 +22,12 @@ def load_backend(path):
raise ImproperlyConfigured('Module "%s" does not define a "%s" authentication backend' % (module, attr))
if not hasattr(cls, "supports_object_permissions"):
warn("Authentication backends without a `supports_object_permissions` attribute are deprecated. Please define it in %s." % cls,
- PendingDeprecationWarning)
+ DeprecationWarning)
cls.supports_object_permissions = False
if not hasattr(cls, 'supports_anonymous_user'):
warn("Authentication backends without a `supports_anonymous_user` attribute are deprecated. Please define it in %s." % cls,
- PendingDeprecationWarning)
+ DeprecationWarning)
cls.supports_anonymous_user = False
return cls()
View
4 django/contrib/auth/models.py
@@ -107,7 +107,7 @@ def create_user(self, username, email, password=None):
Creates and saves a User with the given username, e-mail and password.
"""
now = datetime.datetime.now()
-
+
# Normalize the address by lowercasing the domain part of the email
# address.
try:
@@ -380,7 +380,7 @@ def _get_message_set(self):
import warnings
warnings.warn('The user messaging API is deprecated. Please update'
' your code to use the new messages framework.',
- category=PendingDeprecationWarning)
+ category=DeprecationWarning)
return self._message_set
message_set = property(_get_message_set)
View
6 django/contrib/auth/tests/auth_backends.py
@@ -1,3 +1,5 @@
+import warnings
+
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
@@ -152,9 +154,13 @@ def setUp(self):
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
self.user2 = User.objects.create_user('test2', 'test2@example.com', 'test')
self.user3 = User.objects.create_user('test3', 'test3@example.com', 'test')
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.auth')
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
+ warnings.resetwarnings()
+ warnings.simplefilter('ignore', PendingDeprecationWarning)
def test_has_perm(self):
self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
View
2  django/contrib/csrf/middleware.py
@@ -3,5 +3,5 @@
import warnings
warnings.warn("This import for CSRF functionality is deprecated. Please use django.middleware.csrf for the middleware and django.views.decorators.csrf for decorators.",
- PendingDeprecationWarning
+ DeprecationWarning
)
View
6 django/contrib/gis/tests/__init__.py
@@ -13,7 +13,7 @@ def run_gis_tests(test_labels, verbosity=1, interactive=True, failfast=False, ex
import warnings
warnings.warn(
'The run_gis_tests() test runner has been deprecated in favor of GeoDjangoTestSuiteRunner.',
- PendingDeprecationWarning
+ DeprecationWarning
)
test_runner = GeoDjangoTestSuiteRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
return test_runner.run_tests(test_labels, extra_tests=extra_tests)
@@ -22,7 +22,7 @@ class GeoDjangoTestSuiteRunner(DjangoTestSuiteRunner):
def setup_test_environment(self, **kwargs):
super(GeoDjangoTestSuiteRunner, self).setup_test_environment(**kwargs)
-
+
from django.db import connection
from django.contrib.gis.geos import GEOS_PREPARE
from django.contrib.gis.gdal import HAS_GDAL
@@ -49,7 +49,7 @@ def setup_test_environment(self, **kwargs):
self.geo_apps.append('layermap')
- # Constructing the new INSTALLED_APPS, and including applications
+ # Constructing the new INSTALLED_APPS, and including applications
# within the GeoDjango test namespace (`self.geo_apps`).
new_installed = ['django.contrib.sites',
'django.contrib.sitemaps',
View
6 django/contrib/messages/tests/base.py
@@ -1,3 +1,5 @@
+import warnings
+
from django import http
from django.test import TestCase
from django.conf import settings
@@ -49,6 +51,8 @@ def setUp(self):
self._message_storage = settings.MESSAGE_STORAGE
settings.MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
self.storage_class.__name__)
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.auth.models')
def tearDown(self):
for setting in self.restore_settings:
@@ -59,6 +63,8 @@ def tearDown(self):
self._template_context_processors
settings.INSTALLED_APPS = self._installed_apps
settings.MESSAGE_STORAGE = self._message_storage
+ warnings.resetwarnings()
+ warnings.simplefilter('ignore', PendingDeprecationWarning)
def restore_setting(self, setting):
if setting in self._remembered_settings:
View
2  django/contrib/syndication/feeds.py
@@ -10,7 +10,7 @@ class Feed(views.Feed):
def __init__(self, slug, request):
warnings.warn('The syndication feeds.Feed class is deprecated. Please '
'use the new class based view API.',
- category=PendingDeprecationWarning)
+ category=DeprecationWarning)
self.slug = slug
self.request = request
View
2  django/contrib/syndication/views.py
@@ -191,7 +191,7 @@ def feed(request, url, feed_dict=None):
import warnings
warnings.warn('The syndication feed() view is deprecated. Please use the '
'new class based view API.',
- category=PendingDeprecationWarning)
+ category=DeprecationWarning)
if not feed_dict:
raise Http404("No feeds are registered.")
View
2  django/core/cache/backends/memcached.py
@@ -10,7 +10,7 @@
import warnings
warnings.warn(
"Support for the 'cmemcache' library has been deprecated. Please use python-memcached instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
except ImportError:
try:
View
2  django/core/context_processors.py
@@ -24,7 +24,7 @@ def auth(request):
"The context processor at `django.core.context_processors.auth` is " \
"deprecated; use the path `django.contrib.auth.context_processors.auth` " \
"instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
from django.contrib.auth.context_processors import auth as auth_context_processor
return auth_context_processor(request)
View
2  django/core/mail/__init__.py
@@ -106,6 +106,6 @@ def __init__(self, *args, **kwds):
import warnings
warnings.warn(
'mail.SMTPConnection is deprecated; use mail.get_connection() instead.',
- PendingDeprecationWarning
+ DeprecationWarning
)
super(SMTPConnection, self).__init__(*args, **kwds)
View
2  django/core/management/commands/test.py
@@ -29,7 +29,7 @@ def handle(self, *test_labels, **options):
import warnings
warnings.warn(
'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.',
- PendingDeprecationWarning
+ DeprecationWarning
)
failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive)
else:
View
6 django/db/__init__.py
@@ -15,7 +15,7 @@
import warnings
warnings.warn(
"settings.DATABASE_* is deprecated; use settings.DATABASES instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
settings.DATABASES[DEFAULT_DB_ALIAS] = {
@@ -44,7 +44,7 @@
"django.contrib.gis is now implemented as a full database backend. "
"Modify ENGINE in the %s database configuration to select "
"a backend from 'django.contrib.gis.db.backends'" % alias,
- PendingDeprecationWarning
+ DeprecationWarning
)
if database['ENGINE'] == 'postgresql_psycopg2':
full_engine = 'django.contrib.gis.db.backends.postgis'
@@ -56,7 +56,7 @@
warnings.warn(
"Short names for ENGINE in database configurations are deprecated. "
"Prepend %s.ENGINE with 'django.db.backends.'" % alias,
- PendingDeprecationWarning
+ DeprecationWarning
)
full_engine = "django.db.backends.%s" % database['ENGINE']
database['ENGINE'] = full_engine
View
8 django/db/backends/creation.py
@@ -140,7 +140,7 @@ def sql_for_many_to_many(self, model, style):
import warnings
warnings.warn(
'Database creation API for m2m tables has been deprecated. M2M models are now automatically generated',
- PendingDeprecationWarning
+ DeprecationWarning
)
output = []
@@ -154,7 +154,7 @@ def sql_for_many_to_many_field(self, model, f, style):
import warnings
warnings.warn(
'Database creation API for m2m tables has been deprecated. M2M models are now automatically generated',
- PendingDeprecationWarning
+ DeprecationWarning
)
from django.db import models
@@ -217,7 +217,7 @@ def sql_for_inline_many_to_many_references(self, model, field, style):
import warnings
warnings.warn(
'Database creation API for m2m tables has been deprecated. M2M models are now automatically generated',
- PendingDeprecationWarning
+ DeprecationWarning
)
from django.db import models
@@ -322,7 +322,7 @@ def sql_destroy_many_to_many(self, model, f, style):
import warnings
warnings.warn(
'Database creation API for m2m tables has been deprecated. M2M models are now automatically generated',
- PendingDeprecationWarning
+ DeprecationWarning
)
qn = self.connection.ops.quote_name
View
2  django/db/backends/postgresql/base.py
@@ -105,7 +105,7 @@ def __init__(self, *args, **kwargs):
import warnings
warnings.warn(
'The "postgresql" backend has been deprecated. Use "postgresql_psycopg2" instead.',
- PendingDeprecationWarning
+ DeprecationWarning
)
self.features = DatabaseFeatures()
View
8 django/db/models/fields/subclassing.py
@@ -15,14 +15,14 @@ def call_with_connection(func):
if not updated:
warn("A Field class whose %s method hasn't been updated to take a "
"`connection` argument." % func.__name__,
- PendingDeprecationWarning, stacklevel=2)
+ DeprecationWarning, stacklevel=2)
def inner(*args, **kwargs):
if 'connection' not in kwargs:
from django.db import connection
kwargs['connection'] = connection
warn("%s has been called without providing a connection argument. " %
- func.__name__, PendingDeprecationWarning,
+ func.__name__, DeprecationWarning,
stacklevel=1)
if updated:
return func(*args, **kwargs)
@@ -40,14 +40,14 @@ def call_with_connection_and_prepared(func):
if not updated:
warn("A Field class whose %s method hasn't been updated to take "
"`connection` and `prepared` arguments." % func.__name__,
- PendingDeprecationWarning, stacklevel=2)
+ DeprecationWarning, stacklevel=2)
def inner(*args, **kwargs):
if 'connection' not in kwargs:
from django.db import connection
kwargs['connection'] = connection
warn("%s has been called without providing a connection argument. " %
- func.__name__, PendingDeprecationWarning,
+ func.__name__, DeprecationWarning,
stacklevel=1)
if updated:
return func(*args, **kwargs)
View
2  django/db/utils.py
@@ -23,7 +23,7 @@ def load_backend(backend_name):
import warnings
warnings.warn(
"Short names for DATABASE_ENGINE are deprecated; prepend with 'django.db.backends.'",
- PendingDeprecationWarning
+ DeprecationWarning
)
return module
except ImportError, e:
View
2  django/forms/fields.py
@@ -50,7 +50,7 @@ def en_format(name):
from django.conf.locale.en import formats
warnings.warn(
"`django.forms.fields.DEFAULT_%s` is deprecated; use `django.utils.formats.get_format('%s')` instead." % (name, name),
- PendingDeprecationWarning
+ DeprecationWarning
)
return getattr(formats, name)
View
2  django/middleware/csrf.py
@@ -274,7 +274,7 @@ def __init__(self):
import warnings
warnings.warn(
"CsrfResponseMiddleware and CsrfMiddleware are deprecated; use CsrfViewMiddleware and the template tag instead (see CSRF documentation).",
- PendingDeprecationWarning
+ DeprecationWarning
)
def process_response(self, request, response):
View
19 django/middleware/http.py
@@ -30,22 +30,3 @@ def process_response(self, request, response):
response.status_code = 304
return response
-
-class SetRemoteAddrFromForwardedFor(object):
- """
- This middleware has been removed; see the Django 1.1 release notes for
- details.
-
- It previously set REMOTE_ADDR based on HTTP_X_FORWARDED_FOR. However, after
- investiagtion, it turns out this is impossible to do in a general manner:
- different proxies treat the X-Forwarded-For header differently. Thus, a
- built-in middleware can lead to application-level security problems, and so
- this was removed in Django 1.1
-
- """
- def __init__(self):
- import warnings
- warnings.warn("SetRemoteAddrFromForwardedFor has been removed. "
- "See the Django 1.1 release notes for details.",
- category=DeprecationWarning)
- raise MiddlewareNotUsed()
View
2  django/template/loader.py
@@ -142,7 +142,7 @@ def find_template_source(name, dirs=None):
import warnings
warnings.warn(
"`django.template.loaders.find_template_source` is deprecated; use `django.template.loaders.find_template` instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
template, origin = find_template(name, dirs)
if hasattr(template, 'render'):
View
2  django/template/loaders/app_directories.py
@@ -68,7 +68,7 @@ def load_template_source(template_name, template_dirs=None):
import warnings
warnings.warn(
"'django.template.loaders.app_directories.load_template_source' is deprecated; use 'django.template.loaders.app_directories.Loader' instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
return _loader.load_template_source(template_name, template_dirs)
load_template_source.is_usable = True
View
2  django/template/loaders/eggs.py
@@ -33,7 +33,7 @@ def load_template_source(template_name, template_dirs=None):
import warnings
warnings.warn(
"'django.template.loaders.eggs.load_template_source' is deprecated; use 'django.template.loaders.eggs.Loader' instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
return _loader.load_template_source(template_name, template_dirs)
load_template_source.is_usable = resource_string is not None
View
2  django/template/loaders/filesystem.py
@@ -55,7 +55,7 @@ def load_template_source(template_name, template_dirs=None):
import warnings
warnings.warn(
"'django.template.loaders.filesystem.load_template_source' is deprecated; use 'django.template.loaders.filesystem.Loader' instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
return _loader.load_template_source(template_name, template_dirs)
load_template_source.is_usable = True
View
2  django/test/simple.py
@@ -320,7 +320,7 @@ def run_tests(test_labels, verbosity=1, interactive=True, failfast=False, extra_
import warnings
warnings.warn(
'The run_tests() test runner has been deprecated in favor of DjangoTestSuiteRunner.',
- PendingDeprecationWarning
+ DeprecationWarning
)
test_runner = DjangoTestSuiteRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
return test_runner.run_tests(test_labels, extra_tests=extra_tests)
View
4 django/utils/translation/trans_null.py
@@ -59,7 +59,7 @@ def get_date_formats():
warnings.warn(
'`django.utils.translation.get_date_formats` is deprecated. '
'Please update your code to use the new i18n aware formatting.',
- PendingDeprecationWarning
+ DeprecationWarning
)
return settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT
@@ -67,6 +67,6 @@ def get_partial_date_formats():
warnings.warn(
'`django.utils.translation.get_partial_date_formats` is deprecated. '
'Please update your code to use the new i18n aware formatting.',
- PendingDeprecationWarning
+ DeprecationWarning
)
return settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT
View
10 django/utils/translation/trans_real.py
@@ -192,7 +192,7 @@ def activate(language):
warnings.warn(
"The use of the language code 'no' is deprecated. "
"Please use the 'nb' translation instead.",
- PendingDeprecationWarning
+ DeprecationWarning
)
_active[currentThread()] = translation(language)
@@ -228,12 +228,12 @@ def get_language():
def get_language_bidi():
"""
Returns selected language's BiDi layout.
-
+
* False = left-to-right layout
* True = right-to-left layout
"""
from django.conf import settings
-
+
base_lang = get_language().split('-')[0]
return base_lang in settings.LANGUAGES_BIDI
@@ -517,7 +517,7 @@ def get_date_formats():
warnings.warn(
"'django.utils.translation.get_date_formats' is deprecated. "
"Please update your code to use the new i18n aware formatting.",
- PendingDeprecationWarning
+ DeprecationWarning
)
from django.conf import settings
date_format = ugettext('DATE_FORMAT')
@@ -540,7 +540,7 @@ def get_partial_date_formats():
warnings.warn(
"'django.utils.translation.get_partial_date_formats' is deprecated. "
"Please update your code to use the new i18n aware formatting.",
- PendingDeprecationWarning
+ DeprecationWarning
)
from django.conf import settings
year_month_format = ugettext('YEAR_MONTH_FORMAT')
View
4 tests/modeltests/custom_pk/fields.py
@@ -40,14 +40,14 @@ def to_python(self, value):
value = MyWrapper(value)
return value
- def get_db_prep_save(self, value):
+ def get_db_prep_save(self, value, connection):
if not value:
return
if isinstance(value, MyWrapper):
return unicode(value)
return value
- def get_db_prep_value(self, value):
+ def get_db_prep_value(self, value, connection, prepared=False):
if not value:
return
if isinstance(value, MyWrapper):
View
2  tests/modeltests/field_subclassing/fields.py
@@ -3,6 +3,8 @@
from django.utils import simplejson as json
from django.utils.encoding import force_unicode
+import warnings
+warnings.filterwarnings("ignore", category=DeprecationWarning, module='django.db.models.fields.subclassing')
class Small(object):
"""
View
3  tests/modeltests/serializers/models.py
@@ -9,6 +9,7 @@
from decimal import Decimal
from django.db import models
+
class Category(models.Model):
name = models.CharField(max_length=20)
@@ -96,7 +97,7 @@ class TeamField(models.CharField):
def __init__(self):
super(TeamField, self).__init__(max_length=100)
- def get_db_prep_save(self, value):
+ def get_db_prep_save(self, value, connection):
return unicode(value.title)
def to_python(self, value):
View
11 tests/regressiontests/context_processors/tests.py
@@ -1,6 +1,7 @@
"""
Tests for Django's bundled context processors.
"""
+import warnings
from django.conf import settings
from django.contrib.auth import authenticate
@@ -46,6 +47,16 @@ class AuthContextProcessorTests(TestCase):
urls = 'regressiontests.context_processors.urls'
fixtures = ['context-processors-users.xml']
+ def setUp(self):
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.auth.models')
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.core.context_processors')
+
+ def tearDown(self):
+ warnings.resetwarnings()
+ warnings.simplefilter('ignore', PendingDeprecationWarning)
+
def test_session_not_accessed(self):
"""
Tests that the session is not accessed simply by including
View
9 tests/regressiontests/csrf_tests/tests.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+import warnings
from django.test import TestCase
from django.http import HttpRequest, HttpResponse
@@ -69,6 +70,14 @@ class CsrfMiddlewareTest(TestCase):
_session_id = "1"
_secret_key_for_session_test= "test"
+ def setUp(self):
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.middleware.csrf')
+
+ def tearDown(self):
+ warnings.resetwarnings()
+ warnings.simplefilter('ignore', PendingDeprecationWarning)
+
def _get_GET_no_csrf_cookie_request(self):
return TestingHttpRequest()
View
18 tests/regressiontests/syndication/tests.py
@@ -1,16 +1,15 @@
import datetime
+import warnings
+from xml.dom import minidom
+
from django.contrib.syndication import feeds, views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import tzinfo
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
+
from models import Entry
-from xml.dom import minidom
-try:
- set
-except NameError:
- from sets import Set as set
class FeedTestCase(TestCase):
fixtures = ['feeddata.json']
@@ -315,6 +314,15 @@ class DeprecatedSyndicationFeedTest(FeedTestCase):
"""
Tests for the deprecated API (feed() view and the feed_dict etc).
"""
+ def setUp(self):
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.syndication.feeds')
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.syndication.views')
+
+ def tearDown(self):
+ warnings.resetwarnings()
+ warnings.simplefilter('ignore', PendingDeprecationWarning)
def test_empty_feed_dict(self):
"""
View
5 tests/regressiontests/templates/loaders.py
@@ -67,7 +67,8 @@ def setUp(self):
})
self._old_installed_apps = settings.INSTALLED_APPS
settings.INSTALLED_APPS = []
- warnings.simplefilter("ignore", PendingDeprecationWarning)
+ warnings.filterwarnings("ignore", category=DeprecationWarning,
+ module='django.template.loaders.eggs')
def tearDown(self):
settings.INSTALLED_APPS = self._old_installed_apps
@@ -79,6 +80,8 @@ def test_existing(self):
contents, template_name = lts_egg("y.html")
self.assertEqual(contents, "y")
self.assertEqual(template_name, "egg:egg_1:templates/y.html")
+ warnings.resetwarnings()
+ warnings.simplefilter("ignore", PendingDeprecationWarning)
class EggLoaderTest(unittest.TestCase):
View
2  tests/runtests.py
@@ -174,7 +174,7 @@ def django_tests(verbosity, interactive, failfast, test_labels):
import warnings
warnings.warn(
'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.',
- PendingDeprecationWarning
+ DeprecationWarning
)
failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive,
extra_tests=extra_tests)
Please sign in to comment.
Something went wrong with that request. Please try again.