diff options
| author | Hasan <hasan.r67@gmail.com> | 2016-01-17 14:56:39 +0330 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-29 12:32:18 -0500 |
| commit | 3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (patch) | |
| tree | 0d1074cc65a72096e44a4165611fddfc5b7ef7fb /tests/sitemaps_tests | |
| parent | 575706331bec4bf58ce36a9540c4c61fca49025b (diff) | |
Refs #26022 -- Used context manager version of assertRaises in tests.
Diffstat (limited to 'tests/sitemaps_tests')
| -rw-r--r-- | tests/sitemaps_tests/test_http.py | 6 |
1 files changed, 4 insertions, 2 deletions
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): """ |
