Created
February 13, 2017 20:23
-
-
Save aericson/e278098b71154e2b6e523b38d63f8f73 to your computer and use it in GitHub Desktop.
Tests with email sending speed boost.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest import mock | |
class SendsEmailTestCaseMixin(object): | |
# getfqdn can be too slow, mock it for speed. | |
# See: https://code.djangoproject.com/ticket/24380 | |
@classmethod | |
def setUpClass(cls): | |
cls.getfqdn_patcher = mock.patch( | |
'django.core.mail.utils.socket.getfqdn', | |
return_value='vinta.local') | |
cls.getfqdn_patcher.start() | |
super().setUpClass() | |
@classmethod | |
def tearDownClass(cls): | |
cls.getfqdn_patcher.stop() | |
super().tearDownClass() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment