|
@@ -548,16 +548,13 @@ class DirectoryCreationTests(SimpleTestCase):
|
|
|
self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', b'x'), save=False)
|
|
|
|
|
|
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()
|
|
|
self.addCleanup(os.remove, UPLOAD_TO)
|
|
|
- with self.assertRaises(IOError) as exc_info:
|
|
|
+ msg = '%s exists and is not a directory.' % UPLOAD_TO
|
|
|
+ with self.assertRaisesMessage(FileExistsError, msg):
|
|
|
with SimpleUploadedFile('foo.txt', b'x') as file:
|
|
|
self.obj.testfile.save('foo.txt', file, save=False)
|
|
|
- # 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(SimpleTestCase):
|