1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Optimized Model and QuerySet pickling version comparison.

This commit is contained in:
Adam Johnson
2020-04-03 21:13:02 +01:00
committed by Mariusz Felisiak
parent 72a170b4c3
commit a8b2db1cae
4 changed files with 37 additions and 29 deletions

View File

@@ -1,9 +1,9 @@
import datetime
import pickle
import django
from django.db import models
from django.test import TestCase
from django.utils.version import get_version
from .models import Container, Event, Group, Happening, M2MModel, MyEvent
@@ -234,7 +234,10 @@ class PickleabilityTestCase(TestCase):
unpickled with a different Django version than the current
"""
qs = Group.previous_django_version_objects.all()
msg = "Pickled queryset instance's Django version 1.0 does not match the current version %s." % get_version()
msg = (
"Pickled queryset instance's Django version 1.0 does not match "
"the current version %s." % django.__version__
)
with self.assertRaisesMessage(RuntimeWarning, msg):
pickle.loads(pickle.dumps(qs))