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

This commit is contained in:
Hasan 2016-01-17 14:56:39 +03:30 committed by Tim Graham
parent 575706331b
commit 3d0dcd7f5a
118 changed files with 1086 additions and 760 deletions

View file

@ -29,7 +29,8 @@ class BaseStaticFilesTestCase(object):
)
def assertFileNotFound(self, filepath):
self.assertRaises(IOError, self._get_file, filepath)
with self.assertRaises(IOError):
self._get_file(filepath)
def render_template(self, template, **kwargs):
if isinstance(template, six.string_types):
@ -46,7 +47,8 @@ class BaseStaticFilesTestCase(object):
self.assertEqual(self.render_template(template, **kwargs), result)
def assertStaticRaises(self, exc, path, result, asvar=False, **kwargs):
self.assertRaises(exc, self.assertStaticRenders, path, result, **kwargs)
with self.assertRaises(exc):
self.assertStaticRenders(path, result, **kwargs)
@override_settings(**TEST_SETTINGS)