Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed another usage of the bear "except:" (rawr!).

  • Loading branch information...
commit 5999eb42eb6dad6a74c43eb6e9d96ac368ad97b4 1 parent ad50243
Alex Gaynor authored
Showing with 6 additions and 8 deletions.
  1. +6 −8 tests/regressiontests/file_uploads/tests.py
View
14 tests/regressiontests/file_uploads/tests.py
@@ -384,15 +384,13 @@ def test_not_a_directory(self):
"""The correct IOError is raised when the upload directory name exists but isn't a directory"""
# Create a file with the upload directory name
open(UPLOAD_TO, 'wb').close()
- try:
+ with self.assertRaises(IOError) as exc_info:
self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', b'x'))
- except IOError as err:
- # The test needs to be done on a specific string as IOError
- # is raised even without the patch (just not early enough)
- self.assertEqual(err.args[0],
- "%s exists and is not a directory." % UPLOAD_TO)
- except:
- self.fail("IOError not raised")
+ # The test needs to be done on a specific string as IOError
+ # is raised even without the patch (just not early enough)
+ self.assertEqual(exc_info.exception.args[0],
+ "%s exists and is not a directory." % UPLOAD_TO)
+
class MultiParserTests(unittest.TestCase):
Please sign in to comment.
Something went wrong with that request. Please try again.