Skip to content

Commit a76b8b7

Browse files
committed
Revert "Use proper test app path for custom urlconf"
This reverts commit 02191d1.
1 parent e26343d commit a76b8b7

3 files changed

Lines changed: 12 additions & 27 deletions

File tree

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
from __future__ import absolute_import
22

3-
try:
4-
from django.urls import path
5-
except ImportError:
6-
from django.conf.urls import url
7-
8-
def path(path, *args, **kwargs):
9-
return url("^{}$".format(path), *args, **kwargs)
3+
import django
104

5+
if django.VERSION >= (2, 0):
6+
# TODO: once we stop supporting django < 2, use the real name of this
7+
# function (re_path)
8+
from django.urls import re_path as url
9+
else:
10+
from django.conf.urls import url
1111

12-
from . import views
1312

1413
urlpatterns = [
15-
path(
16-
"foo/bar/baz/<int:param>/",
17-
views.postgres_select_custom,
18-
name="postgres_select_custom",
19-
),
14+
url(r"^foo/bar/baz/(?P<param>[\d]+)", lambda x: ""),
2015
]

tests/integrations/django/myapp/views.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,6 @@ def postgres_select(request, *args, **kwargs):
136136
return HttpResponse("ok")
137137

138138

139-
@csrf_exempt
140-
def postgres_select_custom(request, *args, **kwargs):
141-
from django.db import connections
142-
143-
cursor = connections["postgres"].cursor()
144-
cursor.execute("SELECT 1;")
145-
return HttpResponse("ok")
146-
147-
148139
@csrf_exempt
149140
def permission_denied_exc(*args, **kwargs):
150141
raise PermissionDenied("bye")

tests/integrations/django/test_transactions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ def test_legacy_resolver_newstyle_django20_urlconf():
6666
def test_legacy_resolver_custom_urlconf_module_name():
6767
resolver = RavenResolver()
6868
custom_urlconf_module = "tests.integrations.django.myapp.custom_urls"
69-
result = resolver.resolve("/foo/bar/baz/1234/", custom_urlconf_module)
70-
assert result == "/foo/bar/baz/{param}/"
69+
result = resolver.resolve("/foo/bar/baz/1234", custom_urlconf_module)
70+
assert result == "/foo/bar/baz/{param}"
7171

7272

73-
@pytest.mark.only
7473
def test_legacy_resolver_custom_urlconf_callback():
7574
def custom_urlconf_callback():
7675
return "tests.integrations.django.myapp.custom_urls"
7776

7877
resolver = RavenResolver()
79-
result = resolver.resolve("/foo/bar/baz/1234/", custom_urlconf_callback)
80-
assert result == "/foo/bar/baz/{param}/"
78+
result = resolver.resolve("/foo/bar/baz/1234", custom_urlconf_callback)
79+
assert result == "/foo/bar/baz/{param}"

0 commit comments

Comments
 (0)