diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-01-31 07:12:55 -0800 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2019-01-31 12:53:36 -0500 |
commit | 290d8471bba35980f3e228f9c171afc40f2550fa (patch) | |
tree | a05caec39f83a6d83594d5240fe39c3587316e35 /tests/file_uploads | |
parent | ba7a420012799b26ec9e969d0276d2ccee93c1f5 (diff) | |
download | django-290d8471bba35980f3e228f9c171afc40f2550fa.tar.gz |
Fixed #30147 -- Simplified directory creation with os.makedirs(..., exist_ok=True).
Diffstat (limited to 'tests/file_uploads')
-rw-r--r-- | tests/file_uploads/tests.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index 07a9d9b647..2824b6eb42 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -29,8 +29,7 @@ class FileUploadTests(TestCase): @classmethod def setUpClass(cls): super().setUpClass() - if not os.path.isdir(MEDIA_ROOT): - os.makedirs(MEDIA_ROOT) + os.makedirs(MEDIA_ROOT, exist_ok=True) @classmethod def tearDownClass(cls): @@ -528,8 +527,7 @@ class DirectoryCreationTests(SimpleTestCase): @classmethod def setUpClass(cls): super().setUpClass() - if not os.path.isdir(MEDIA_ROOT): - os.makedirs(MEDIA_ROOT) + os.makedirs(MEDIA_ROOT, exist_ok=True) @classmethod def tearDownClass(cls): |