Refs #26022 -- Used context manager version of assertRaisesMessage in tests.

This commit is contained in:
Hasan 2016-01-04 12:20:08 +03:30 committed by Tim Graham
parent 3d0dcd7f5a
commit 253adc2b8a
21 changed files with 584 additions and 566 deletions

View file

@ -252,13 +252,13 @@ class NoURLPatternsTests(SimpleTestCase):
"""
resolver = RegexURLResolver(r'^$', settings.ROOT_URLCONF)
self.assertRaisesMessage(
with self.assertRaisesMessage(
ImproperlyConfigured,
"The included URLconf 'urlpatterns_reverse.no_urls' does not "
"appear to have any patterns in it. If you see valid patterns in "
"the file then the issue is probably caused by a circular import.",
getattr, resolver, 'url_patterns'
)
"the file then the issue is probably caused by a circular import."
):
getattr(resolver, 'url_patterns')
@override_settings(ROOT_URLCONF='urlpatterns_reverse.urls')