mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #25745 -- Promoted RuntimeWarnings to errors in the test suite.
This commit is contained in:
parent
d95b22bd56
commit
1c5f4e86bc
6 changed files with 19 additions and 34 deletions
|
@ -3,12 +3,10 @@ from __future__ import unicode_literals
|
|||
import datetime
|
||||
import pickle
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from django.db import models
|
||||
from django.test import TestCase
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.version import get_version
|
||||
|
||||
from .models import Container, Event, Group, Happening, M2MModel
|
||||
|
@ -142,11 +140,9 @@ class PickleabilityTestCase(TestCase):
|
|||
unpickled without a Django version
|
||||
"""
|
||||
qs = Group.missing_django_version_objects.all()
|
||||
with warnings.catch_warnings(record=True) as recorded:
|
||||
msg = "Pickled queryset instance's Django version is not specified."
|
||||
with self.assertRaisesMessage(RuntimeWarning, msg):
|
||||
pickle.loads(pickle.dumps(qs))
|
||||
msg = force_text(recorded.pop().message)
|
||||
self.assertEqual(msg,
|
||||
"Pickled queryset instance's Django version is not specified.")
|
||||
|
||||
def test_unsupported_unpickle(self):
|
||||
"""
|
||||
|
@ -154,11 +150,6 @@ class PickleabilityTestCase(TestCase):
|
|||
unpickled with a different Django version than the current
|
||||
"""
|
||||
qs = Group.previous_django_version_objects.all()
|
||||
with warnings.catch_warnings(record=True) as recorded:
|
||||
msg = "Pickled queryset instance's Django version 1.0 does not match the current version %s." % get_version()
|
||||
with self.assertRaisesMessage(RuntimeWarning, msg):
|
||||
pickle.loads(pickle.dumps(qs))
|
||||
msg = force_text(recorded.pop().message)
|
||||
self.assertEqual(
|
||||
msg,
|
||||
"Pickled queryset instance's Django version 1.0 does not "
|
||||
"match the current version %s." % get_version()
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue