mirror of https://github.com/django/django.git
Removed another usage of the bear "except:" (rawr!).
This commit is contained in:
parent
ad50243cd1
commit
5999eb42eb
|
@ -384,15 +384,13 @@ class DirectoryCreationTests(unittest.TestCase):
|
||||||
"""The correct IOError is raised when the upload directory name exists but isn't a directory"""
|
"""The correct IOError is raised when the upload directory name exists but isn't a directory"""
|
||||||
# Create a file with the upload directory name
|
# Create a file with the upload directory name
|
||||||
open(UPLOAD_TO, 'wb').close()
|
open(UPLOAD_TO, 'wb').close()
|
||||||
try:
|
with self.assertRaises(IOError) as exc_info:
|
||||||
self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', b'x'))
|
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
|
||||||
# The test needs to be done on a specific string as IOError
|
# is raised even without the patch (just not early enough)
|
||||||
# is raised even without the patch (just not early enough)
|
self.assertEqual(exc_info.exception.args[0],
|
||||||
self.assertEqual(err.args[0],
|
"%s exists and is not a directory." % UPLOAD_TO)
|
||||||
"%s exists and is not a directory." % UPLOAD_TO)
|
|
||||||
except:
|
|
||||||
self.fail("IOError not raised")
|
|
||||||
|
|
||||||
class MultiParserTests(unittest.TestCase):
|
class MultiParserTests(unittest.TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue