summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-10-11 12:20:07 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-10-11 12:20:07 +0000
commit1070c57b83efdfd4fbed09280fcdaafc6d9c1a81 (patch)
tree93b5721fe4e0664b993dd0d0b1dee544df304b22 /tests
parent5e5be2c44caaae3192a9f8ae1ce0adc0da3d8c4d (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')
-rw-r--r--tests/modeltests/custom_pk/fields.py4
-rw-r--r--tests/modeltests/field_subclassing/fields.py2
-rw-r--r--tests/modeltests/serializers/models.py3
-rw-r--r--tests/regressiontests/context_processors/tests.py11
-rw-r--r--tests/regressiontests/csrf_tests/tests.py9
-rw-r--r--tests/regressiontests/syndication/tests.py18
-rw-r--r--tests/regressiontests/templates/loaders.py5
-rwxr-xr-xtests/runtests.py2
8 files changed, 44 insertions, 10 deletions
diff --git a/tests/modeltests/custom_pk/fields.py b/tests/modeltests/custom_pk/fields.py
index 2eeb80e6ac..40551a363c 100644
--- a/tests/modeltests/custom_pk/fields.py
+++ b/tests/modeltests/custom_pk/fields.py
@@ -40,14 +40,14 @@ class MyAutoField(models.CharField):
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):
diff --git a/tests/modeltests/field_subclassing/fields.py b/tests/modeltests/field_subclassing/fields.py
index 1f9bdf5e0a..f667310c58 100644
--- a/tests/modeltests/field_subclassing/fields.py
+++ b/tests/modeltests/field_subclassing/fields.py
@@ -3,6 +3,8 @@ from django.db import models
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):
"""
diff --git a/tests/modeltests/serializers/models.py b/tests/modeltests/serializers/models.py
index c12e73fd6e..7f0019fbcd 100644
--- a/tests/modeltests/serializers/models.py
+++ b/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):
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):
diff --git a/tests/runtests.py b/tests/runtests.py
index 516ec012cd..64adc80041 100755
--- a/tests/runtests.py
+++ b/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)