From 9cbf48693dcd8df6cb22c183dcc94e7ce62b2921 Mon Sep 17 00:00:00 2001 From: Vytis Banaitis Date: Wed, 1 Mar 2017 19:52:28 +0200 Subject: [PATCH] Refs #27836 -- Fixed cleanup exception in file_storage test. TemporaryDirectory tries to delete the directory that was already removed. --- tests/file_storage/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index b6a6f8c2f1..3413829ced 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -496,9 +496,9 @@ class FileStorageTests(SimpleTestCase): self.storage.delete('') def test_delete_deletes_directories(self): - tmp_dir = tempfile.TemporaryDirectory(dir=self.storage.location) - self.storage.delete(tmp_dir.name) - self.assertFalse(os.path.exists(tmp_dir.name)) + tmp_dir = tempfile.mkdtemp(dir=self.storage.location) + self.storage.delete(tmp_dir) + self.assertFalse(os.path.exists(tmp_dir)) @override_settings( MEDIA_ROOT='media_root',