Skip to content

Commit 3757cd3

Browse files
committed
⬆️(back) upgrade to pytest 8.3.3
We are not using pytest 8 because it was not compatible with pytest-playwright. It is not the case anymore, we can upgrade both. Once upgraded there was a regression in a test about social auth backends used in a middleware. The backend is replaced using the override_settings decorator but the backend is put in cache earlier. We have to reload the module social_core.backends.utils responible to build this cache.
1 parent f6109a6 commit 3757cd3

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

renovate.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@
5959
],
6060
"allowedVersions": "<5"
6161
},
62-
{
63-
"groupName": "allowed pytest versions",
64-
"matchManagers": [
65-
"setup-cfg"
66-
],
67-
"matchPackageNames": [
68-
"pytest"
69-
],
70-
"allowedVersions": "<8.0.0"
71-
},
7262
{
7363
"enabled": false,
7464
"groupName": "ignored python dependencies",

src/backend/marsha/account/tests/test_middleware.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Test SocialAuthExceptionMiddleware."""
22

3+
from importlib import reload
4+
import sys
35
from unittest import mock
46

57
from django.conf import settings
@@ -23,6 +25,12 @@ def setUp(self):
2325
)
2426
self.complete_url += "?RelayState=marsha-local-idp"
2527

28+
# Reload module social_core.backends.utils, it makes a global
29+
# cache with already loaded backend defined in settings.AUTHENTICATION_BACKENDS.
30+
# In this test we want to change it.
31+
if "social_core.backends.utils" in sys.modules:
32+
reload(sys.modules["social_core.backends.utils"])
33+
2634
@override_settings()
2735
def test_exception(self):
2836
"""Without SOCIAL_AUTH_LOGIN_ERROR_URL the exception should bubble."""

src/backend/setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ dev =
106106
pytest-cov==6.0.0
107107
pytest-django==4.9.0
108108
pytest-mock==3.14.0
109-
pytest<8.0.0
109+
pytest==8.3.3
110110
responses==0.25.3
111111
signxml==4.0.3
112112
wheel==0.45.1
113113

114114
e2e =
115115
playwright==1.49.0
116-
pytest-playwright==0.5.2
116+
pytest-playwright==0.6.2
117117
# mcr.microsoft.com/playwright:jammy requires tzdata
118118
tzdata==2024.2
119119

0 commit comments

Comments
 (0)