Skip to content

Commit 7baf299

Browse files
sentrivanacclauss
authored andcommitted
feat(integrations): Support Django 5.1 (getsentry#3207)
Co-authored-by: Christian Clauss <[email protected]>
1 parent fdd42a0 commit 7baf299

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

scripts/runtox.sh

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ done
2525

2626
searchstring="$1"
2727

28-
export TOX_PARALLEL_NO_SPINNER=1
29-
3028
if $excludelatest; then
3129
echo "Excluding latest"
3230
ENV="$($TOXPATH -l | grep -- "$searchstring" | grep -v -- '-latest' | tr $'\n' ',')"

tests/integrations/django/test_transactions.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,35 @@ def test_resolver_path_multiple_groups():
9595
django.VERSION < (2, 0),
9696
reason="Django>=2.0 required for <converter:parameter> patterns",
9797
)
98+
@pytest.mark.skipif(
99+
django.VERSION > (5, 1),
100+
reason="get_converter removed in 5.1",
101+
)
102+
def test_resolver_path_complex_path_legacy():
103+
class CustomPathConverter(PathConverter):
104+
regex = r"[^/]+(/[^/]+){0,2}"
105+
106+
with mock.patch(
107+
"django.urls.resolvers.get_converter",
108+
return_value=CustomPathConverter,
109+
):
110+
url_conf = (path("api/v3/<custom_path:my_path>", lambda x: ""),)
111+
resolver = RavenResolver()
112+
result = resolver.resolve("/api/v3/abc/def/ghi", url_conf)
113+
assert result == "/api/v3/{my_path}"
114+
115+
116+
@pytest.mark.skipif(
117+
django.VERSION < (5, 1),
118+
reason="get_converters is used in 5.1",
119+
)
98120
def test_resolver_path_complex_path():
99121
class CustomPathConverter(PathConverter):
100122
regex = r"[^/]+(/[^/]+){0,2}"
101123

102124
with mock.patch(
103-
"django.urls.resolvers.get_converter", return_value=CustomPathConverter
125+
"django.urls.resolvers.get_converters",
126+
return_value={"custom_path": CustomPathConverter},
104127
):
105128
url_conf = (path("api/v3/<custom_path:my_path>", lambda x: ""),)
106129
resolver = RavenResolver()

tox.ini

+7-6
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ envlist =
105105
# - Django 4.x
106106
{py3.8,py3.11,py3.12}-django-v{4.0,4.1,4.2}
107107
# - Django 5.x
108-
{py3.10,py3.11,py3.12}-django-v{5.0}
108+
{py3.10,py3.11,py3.12}-django-v{5.0,5.1}
109109
{py3.10,py3.11,py3.12}-django-latest
110110

111111
# Falcon
@@ -374,13 +374,13 @@ deps =
374374
# Django
375375
django: psycopg2-binary
376376
django-v{1.11,2.0,2.1,2.2,3.0,3.1,3.2}: djangorestframework>=3.0.0,<4.0.0
377-
django-v{2.0,2.2,3.0,3.2,4.0,4.1,4.2,5.0}: channels[daphne]
377+
django-v{2.0,2.2,3.0,3.2,4.0,4.1,4.2,5.0,5.1}: channels[daphne]
378378
django-v{1.11,2.0,2.2,3.0,3.2}: Werkzeug<2.1.0
379379
django-v{1.11,2.0,2.2,3.0}: pytest-django<4.0
380-
django-v{3.2,4.0,4.1,4.2,5.0}: pytest-django
381-
django-v{4.0,4.1,4.2,5.0}: djangorestframework
382-
django-v{4.0,4.1,4.2,5.0}: pytest-asyncio
383-
django-v{4.0,4.1,4.2,5.0}: Werkzeug
380+
django-v{3.2,4.0,4.1,4.2,5.0,5.1}: pytest-django
381+
django-v{4.0,4.1,4.2,5.0,5.1}: djangorestframework
382+
django-v{4.0,4.1,4.2,5.0,5.1}: pytest-asyncio
383+
django-v{4.0,4.1,4.2,5.0,5.1}: Werkzeug
384384
django-latest: djangorestframework
385385
django-latest: pytest-asyncio
386386
django-latest: pytest-django
@@ -396,6 +396,7 @@ deps =
396396
django-v4.1: Django~=4.1.0
397397
django-v4.2: Django~=4.2.0
398398
django-v5.0: Django~=5.0.0
399+
django-v5.1: Django==5.1b1
399400
django-latest: Django
400401

401402
# Falcon

0 commit comments

Comments
 (0)