Fixed #23923 -- Promoted Django's deprecation warnings to errors in runtests.py

This commit is contained in:
Tim Graham 2014-11-26 16:21:29 -05:00
parent 860eb01d17
commit 3131e9cef5
11 changed files with 46 additions and 21 deletions

View file

@ -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),

View file

@ -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'),

View file

@ -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'),