summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@rd.io>2012-09-07 15:34:48 -0400
committerAlex Gaynor <alex.gaynor@rd.io>2012-09-07 15:34:48 -0400
commit5999eb42eb6dad6a74c43eb6e9d96ac368ad97b4 (patch)
treefb53d7a8e19f2a47ed7896ec3c256f1b88ff103b
parentad50243cd143906d573b11397fa0fd080c9cd7f1 (diff)
Removed another usage of the bear "except:" (rawr!).
-rw-r--r--tests/regressiontests/file_uploads/tests.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/regressiontests/file_uploads/tests.py b/tests/regressiontests/file_uploads/tests.py
index f28d658f52..2a1ec7db21 100644
--- a/tests/regressiontests/file_uploads/tests.py
+++ b/tests/regressiontests/file_uploads/tests.py
@@ -384,15 +384,13 @@ class DirectoryCreationTests(unittest.TestCase):
"""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):