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/staticfiles_tests/cases.py | |
| parent | 575706331bec4bf58ce36a9540c4c61fca49025b (diff) | |
Refs #26022 -- Used context manager version of assertRaises in tests.
Diffstat (limited to 'tests/staticfiles_tests/cases.py')
| -rw-r--r-- | tests/staticfiles_tests/cases.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/staticfiles_tests/cases.py b/tests/staticfiles_tests/cases.py index aedb257351..941c45274a 100644 --- a/tests/staticfiles_tests/cases.py +++ b/tests/staticfiles_tests/cases.py @@ -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) |
