diff options
author | Chillar Anand <anand21nanda@gmail.com> | 2017-01-27 00:24:16 +0530 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-01-26 13:54:16 -0500 |
commit | 6478e07a62ce968f33e71a345e561bce36923f8e (patch) | |
tree | ef8a1c8cdfbd03fe51d22a346871eab156ddc275 /tests/mail | |
parent | fee42fd99ee470528858c2ccb3621135c30ec262 (diff) | |
download | django-6478e07a62ce968f33e71a345e561bce36923f8e.tar.gz |
Refs #23919 -- Replaced tempfile.mkdtemp() with TemporaryDirectory() context manager.
Diffstat (limited to 'tests/mail')
-rw-r--r-- | tests/mail/tests.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py index a902e5435c..242bb57915 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -493,14 +493,11 @@ class MailTests(HeadersCheckMixin, SimpleTestCase): mail.get_connection('django.core.mail.backends.console.EmailBackend'), console.EmailBackend ) - tmp_dir = tempfile.mkdtemp() - try: + with tempfile.TemporaryDirectory() as tmp_dir: self.assertIsInstance( mail.get_connection('django.core.mail.backends.filebased.EmailBackend', file_path=tmp_dir), filebased.EmailBackend ) - finally: - shutil.rmtree(tmp_dir) self.assertIsInstance(mail.get_connection(), locmem.EmailBackend) @override_settings( |