Refs #27836 -- Fixed cleanup exception in file_storage test.

TemporaryDirectory tries to delete the directory that was already removed.
This commit is contained in:
Vytis Banaitis 2017-03-01 19:52:28 +02:00 committed by Tim Graham
parent c1d652c62f
commit 9cbf48693d
1 changed files with 3 additions and 3 deletions

View File

@ -496,9 +496,9 @@ class FileStorageTests(SimpleTestCase):
self.storage.delete('') self.storage.delete('')
def test_delete_deletes_directories(self): def test_delete_deletes_directories(self):
tmp_dir = tempfile.TemporaryDirectory(dir=self.storage.location) tmp_dir = tempfile.mkdtemp(dir=self.storage.location)
self.storage.delete(tmp_dir.name) self.storage.delete(tmp_dir)
self.assertFalse(os.path.exists(tmp_dir.name)) self.assertFalse(os.path.exists(tmp_dir))
@override_settings( @override_settings(
MEDIA_ROOT='media_root', MEDIA_ROOT='media_root',