summaryrefslogtreecommitdiff
path: root/tests/urlpatterns_reverse
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-11-26 16:21:29 -0500
committerTim Graham <timograham@gmail.com>2014-11-29 10:27:04 -0500
commit3131e9cef5f0a96f4fe667b0b1626c238153d1f1 (patch)
tree201cc94c137466c1fe55885ef8dc7a02853705e6 /tests/urlpatterns_reverse
parent860eb01d175f88ce9f77bc823f9711eb078db796 (diff)
downloaddjango-3131e9cef5f0a96f4fe667b0b1626c238153d1f1.tar.gz
Fixed #23923 -- Promoted Django's deprecation warnings to errors in runtests.py
Diffstat (limited to 'tests/urlpatterns_reverse')
-rw-r--r--tests/urlpatterns_reverse/erroneous_urls.py7
-rw-r--r--tests/urlpatterns_reverse/included_namespace_urls.py5
-rw-r--r--tests/urlpatterns_reverse/urls.py5
3 files changed, 10 insertions, 7 deletions
diff --git a/tests/urlpatterns_reverse/erroneous_urls.py b/tests/urlpatterns_reverse/erroneous_urls.py
index b4d6132966..b08376dc91 100644
--- a/tests/urlpatterns_reverse/erroneous_urls.py
+++ b/tests/urlpatterns_reverse/erroneous_urls.py
@@ -1,14 +1,15 @@
import warnings
from django.conf.urls import url
+from django.utils.deprecation import RemovedInDjango20Warning
from . import views
# Test deprecated behavior of passing strings as view to url().
# Some of these can be removed in Django 2.0 as they aren't convertable to
-# callabls.
-with warnings.catch_warnings(record=True):
- warnings.filterwarnings('ignore', module='django.conf.urls')
+# callables.
+with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=RemovedInDjango20Warning)
urlpatterns = [
# View has erroneous import
url(r'erroneous_inner/$', views.erroneous_view),
diff --git a/tests/urlpatterns_reverse/included_namespace_urls.py b/tests/urlpatterns_reverse/included_namespace_urls.py
index 29947f47cd..2472e7c07d 100644
--- a/tests/urlpatterns_reverse/included_namespace_urls.py
+++ b/tests/urlpatterns_reverse/included_namespace_urls.py
@@ -1,6 +1,7 @@
import warnings
from django.conf.urls import patterns, url, include
+from django.utils.deprecation import RemovedInDjango20Warning
from .namespace_urls import URLObject
from .views import view_class_instance
@@ -9,8 +10,8 @@ from .views import view_class_instance
testobj3 = URLObject('testapp', 'test-ns3')
# test deprecated patterns() function. convert to list of urls() in Django 2.0
-with warnings.catch_warnings(record=True) as w:
- warnings.filterwarnings('ignore', module='django.conf.urls')
+with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=RemovedInDjango20Warning)
urlpatterns = patterns('urlpatterns_reverse.views',
url(r'^normal/$', 'empty_view', name='inc-normal-view'),
diff --git a/tests/urlpatterns_reverse/urls.py b/tests/urlpatterns_reverse/urls.py
index 4ba596d81c..825ded40a2 100644
--- a/tests/urlpatterns_reverse/urls.py
+++ b/tests/urlpatterns_reverse/urls.py
@@ -1,6 +1,7 @@
import warnings
from django.conf.urls import patterns, url, include
+from django.utils.deprecation import RemovedInDjango20Warning
from .views import (
absolute_kwargs_view, defaults_view, empty_view, empty_view_partial,
@@ -14,8 +15,8 @@ other_patterns = [
]
# test deprecated patterns() function. convert to list of urls() in Django 2.0
-with warnings.catch_warnings(record=True):
- warnings.filterwarnings('ignore', module='django.conf.urls')
+with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=RemovedInDjango20Warning)
urlpatterns = patterns('',
url(r'^places/([0-9]+)/$', empty_view, name='places'),