summaryrefslogtreecommitdiff
path: root/tests/files
diff options
context:
space:
mode:
authorHasan <hasan.r67@gmail.com>2016-01-17 14:56:39 +0330
committerTim Graham <timograham@gmail.com>2016-01-29 12:32:18 -0500
commit3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (patch)
tree0d1074cc65a72096e44a4165611fddfc5b7ef7fb /tests/files
parent575706331bec4bf58ce36a9540c4c61fca49025b (diff)
downloaddjango-3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5.tar.gz
Refs #26022 -- Used context manager version of assertRaises in tests.
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/tests.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 2ce4d0139d..6eb7f30d61 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -287,7 +287,8 @@ class FileMoveSafeTests(unittest.TestCase):
handle_b, self.file_b = tempfile.mkstemp()
# file_move_safe should raise an IOError exception if destination file exists and allow_overwrite is False
- self.assertRaises(IOError, lambda: file_move_safe(self.file_a, self.file_b, allow_overwrite=False))
+ with self.assertRaises(IOError):
+ file_move_safe(self.file_a, self.file_b, allow_overwrite=False)
# should allow it and continue on if allow_overwrite is True
self.assertIsNone(file_move_safe(self.file_a, self.file_b, allow_overwrite=True))