diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-11 12:20:07 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-11 12:20:07 +0000 |
| commit | 1070c57b83efdfd4fbed09280fcdaafc6d9c1a81 (patch) | |
| tree | 93b5721fe4e0664b993dd0d0b1dee544df304b22 /tests/regressiontests | |
| parent | 5e5be2c44caaae3192a9f8ae1ce0adc0da3d8c4d (diff) | |
Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to DeprecationWarnings, and removed 1.1 deprecated code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/context_processors/tests.py | 11 | ||||
| -rw-r--r-- | tests/regressiontests/csrf_tests/tests.py | 9 | ||||
| -rw-r--r-- | tests/regressiontests/syndication/tests.py | 18 | ||||
| -rw-r--r-- | tests/regressiontests/templates/loaders.py | 5 |
4 files changed, 37 insertions, 6 deletions
diff --git a/tests/regressiontests/context_processors/tests.py b/tests/regressiontests/context_processors/tests.py index 0d19bef7ff..2b5ddbe94c 100644 --- a/tests/regressiontests/context_processors/tests.py +++ b/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 diff --git a/tests/regressiontests/csrf_tests/tests.py b/tests/regressiontests/csrf_tests/tests.py index 9030d397ab..0b7a0bb932 100644 --- a/tests/regressiontests/csrf_tests/tests.py +++ b/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() diff --git a/tests/regressiontests/syndication/tests.py b/tests/regressiontests/syndication/tests.py index 76a6c88bc1..a69a454921 100644 --- a/tests/regressiontests/syndication/tests.py +++ b/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): """ diff --git a/tests/regressiontests/templates/loaders.py b/tests/regressiontests/templates/loaders.py index caa3faa6bc..40beb2997a 100644 --- a/tests/regressiontests/templates/loaders.py +++ b/tests/regressiontests/templates/loaders.py @@ -67,7 +67,8 @@ class DeprecatedEggLoaderTest(unittest.TestCase): }) 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 @@ class DeprecatedEggLoaderTest(unittest.TestCase): 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): |
