Skip to content

Commit

Permalink
Removed another usage of the bear "except:" (rawr!).
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Gaynor committed Sep 7, 2012
1 parent ad50243 commit 5999eb4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/regressiontests/file_uploads/tests.py
Expand Up @@ -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):

Expand Down

0 comments on commit 5999eb4

Please sign in to comment.