mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #26022 -- Used context manager version of assertRaises in tests.
This commit is contained in:
parent
575706331b
commit
3d0dcd7f5a
118 changed files with 1086 additions and 760 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue