Refs #24652 -- Fixed a test failure in file_uploads tests on Windows.

Thanks to Tim Graham for the report.
This commit is contained in:
Simon Charette 2015-05-25 19:09:01 -04:00
parent d73176a842
commit 4ccfc4439a
1 changed files with 2 additions and 2 deletions

View File

@ -533,7 +533,7 @@ class DirectoryCreationTests(SimpleTestCase):
os.chmod(MEDIA_ROOT, 0o500) os.chmod(MEDIA_ROOT, 0o500)
self.addCleanup(os.chmod, MEDIA_ROOT, 0o700) self.addCleanup(os.chmod, MEDIA_ROOT, 0o700)
try: try:
self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', b'x')) self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', b'x'), save=False)
except OSError as err: except OSError as err:
self.assertEqual(err.errno, errno.EACCES) self.assertEqual(err.errno, errno.EACCES)
except Exception: except Exception:
@ -546,7 +546,7 @@ class DirectoryCreationTests(SimpleTestCase):
self.addCleanup(os.remove, UPLOAD_TO) self.addCleanup(os.remove, UPLOAD_TO)
with self.assertRaises(IOError) as exc_info: with self.assertRaises(IOError) as exc_info:
with SimpleUploadedFile('foo.txt', b'x') as file: with SimpleUploadedFile('foo.txt', b'x') as file:
self.obj.testfile.save('foo.txt', file) self.obj.testfile.save('foo.txt', file, save=False)
# 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(exc_info.exception.args[0],