From 98871af8a76f8e01a53f1528e73617d4eb8ef57d Mon Sep 17 00:00:00 2001 From: Vasyl Dizhak Date: Fri, 20 Jan 2023 10:41:24 +0100 Subject: [PATCH 1/2] #646, fix skip tests for the django.contrib.sessions.serializers.PickleSerializer for django > 4.2 --- tests/test_session.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_session.py b/tests/test_session.py index 1c179eb7..e24da231 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -1,4 +1,8 @@ import base64 + +import django +import pytest + import unittest from datetime import timedelta from typing import Optional, Type @@ -300,7 +304,6 @@ def test_decode_failure_logged_to_security(self): self.assertEqual({}, self.session.decode(bad_encode)) # The failed decode is logged. self.assertIn("corrupted", cm.output[0]) - def test_actual_expiry(self): # this doesn't work with JSONSerializer (serializing timedelta) with override_settings( @@ -365,6 +368,10 @@ def test_session_save_does_not_resurrect_session_logged_out_in_other_context(sel class SessionTests(SessionTestsMixin, unittest.TestCase): backend = CacheSession + @pytest.mark.skipif( + django.VERSION > (4, 2), + reason="PickleSerializer is removed as of https://code.djangoproject.com/ticket/29708" + ) def test_actual_expiry(self): if isinstance( caches[DEFAULT_CACHE_ALIAS].client._serializer, MSGPackSerializer From 26009437fecf15c1c3a2a9b1ea4cc418e61aa6a5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 09:43:25 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_session.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_session.py b/tests/test_session.py index e24da231..8ae6d9b0 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -1,12 +1,10 @@ import base64 - -import django -import pytest - import unittest from datetime import timedelta from typing import Optional, Type +import django +import pytest from django.conf import settings from django.contrib.sessions.backends.base import SessionBase from django.contrib.sessions.backends.cache import SessionStore as CacheSession @@ -304,6 +302,7 @@ def test_decode_failure_logged_to_security(self): self.assertEqual({}, self.session.decode(bad_encode)) # The failed decode is logged. self.assertIn("corrupted", cm.output[0]) + def test_actual_expiry(self): # this doesn't work with JSONSerializer (serializing timedelta) with override_settings( @@ -370,7 +369,7 @@ class SessionTests(SessionTestsMixin, unittest.TestCase): @pytest.mark.skipif( django.VERSION > (4, 2), - reason="PickleSerializer is removed as of https://code.djangoproject.com/ticket/29708" + reason="PickleSerializer is removed as of https://code.djangoproject.com/ticket/29708", ) def test_actual_expiry(self): if isinstance(