From 3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 Mon Sep 17 00:00:00 2001 From: Hasan Date: Sun, 17 Jan 2016 14:56:39 +0330 Subject: Refs #26022 -- Used context manager version of assertRaises in tests. --- tests/sitemaps_tests/test_http.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/sitemaps_tests') diff --git a/tests/sitemaps_tests/test_http.py b/tests/sitemaps_tests/test_http.py index 5b3cbb5843..aac4d69a20 100644 --- a/tests/sitemaps_tests/test_http.py +++ b/tests/sitemaps_tests/test_http.py @@ -176,7 +176,8 @@ class HTTPSitemapTests(SitemapTestsBase): Sitemap.get_urls and no Site objects exist """ Site.objects.all().delete() - self.assertRaises(ImproperlyConfigured, Sitemap().get_urls) + with self.assertRaises(ImproperlyConfigured): + Sitemap().get_urls() @modify_settings(INSTALLED_APPS={'remove': 'django.contrib.sites'}) def test_sitemap_get_urls_no_site_2(self): @@ -185,7 +186,8 @@ class HTTPSitemapTests(SitemapTestsBase): Sitemap.get_urls if Site objects exists, but the sites framework is not actually installed. """ - self.assertRaises(ImproperlyConfigured, Sitemap().get_urls) + with self.assertRaises(ImproperlyConfigured): + Sitemap().get_urls() def test_sitemap_item(self): """ -- cgit v1.3