summaryrefslogtreecommitdiff
path: root/tests/file_storage
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-10-31 19:25:53 -0400
committerTim Graham <timograham@gmail.com>2018-10-31 19:28:11 -0400
commit98ef3829e96ebc73d4d446f92465e671ff520d2b (patch)
tree2e0591e7d56a0dda5b85853e52795ea9f41746a9 /tests/file_storage
parent3d4d0a25b299a97314582156a0d63d939662d310 (diff)
downloaddjango-98ef3829e96ebc73d4d446f92465e671ff520d2b.tar.gz
Fixed #29890 -- Fixed FileSystemStorage crash if concurrent saves try to create the same directory.
Regression in 632c4ffd9cb1da273303bcd8005fff216506c795.
Diffstat (limited to 'tests/file_storage')
-rw-r--r--tests/file_storage/tests.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index f3011749f8..8c50abc9b0 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -415,9 +415,9 @@ class FileStorageTests(SimpleTestCase):
real_makedirs(path)
elif path == os.path.join(self.temp_dir, 'raced'):
real_makedirs(path)
- raise FileNotFoundError()
- elif path == os.path.join(self.temp_dir, 'error'):
raise FileExistsError()
+ elif path == os.path.join(self.temp_dir, 'error'):
+ raise PermissionError()
else:
self.fail('unexpected argument %r' % path)
@@ -432,8 +432,8 @@ class FileStorageTests(SimpleTestCase):
with self.storage.open('raced/test.file') as f:
self.assertEqual(f.read(), b'saved with race')
- # Exceptions aside from FileNotFoundError are raised.
- with self.assertRaises(FileExistsError):
+ # Exceptions aside from FileExistsError are raised.
+ with self.assertRaises(PermissionError):
self.storage.save('error/test.file', ContentFile('not saved'))
finally:
os.makedirs = real_makedirs