summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email
diff options
context:
space:
mode:
authorBatuhan Taşkaya <batuhanosmantaskaya@gmail.com>2020-04-16 17:29:12 (GMT)
committerGitHub <noreply@github.com>2020-04-16 17:29:12 (GMT)
commit5565c30f0b25996a0e73477fc0e1e1aced52b926 (patch)
tree270a6dce58a50351f99345884540c0a5fdfb37fc /Lib/test/test_email
parent70f027dd22d6522b777d10c250f951e5e416b93a (diff)
downloadcpython-5565c30f0b25996a0e73477fc0e1e1aced52b926.zip
cpython-5565c30f0b25996a0e73477fc0e1e1aced52b926.tar.gz
cpython-5565c30f0b25996a0e73477fc0e1e1aced52b926.tar.bz2
bpo-39793: use the same domain on make_msgid tests (#18698)
* bpo-39793: use same domain on make_msgid tests * apply suggestions
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r--Lib/test/test_email/test_email.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 8ec3919..59eabb0 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -11,8 +11,8 @@ import textwrap
from io import StringIO, BytesIO
from itertools import chain
from random import choice
-from socket import getfqdn
from threading import Thread
+from unittest.mock import patch
import email
import email.policy
@@ -3342,9 +3342,11 @@ multipart/report
'.test-idstring@testdomain-string>')
def test_make_msgid_default_domain(self):
- self.assertTrue(
- email.utils.make_msgid().endswith(
- '@' + getfqdn() + '>'))
+ with patch('socket.getfqdn') as mock_getfqdn:
+ mock_getfqdn.return_value = domain = 'pythontest.example.com'
+ self.assertTrue(
+ email.utils.make_msgid().endswith(
+ '@' + domain + '>'))
def test_Generator_linend(self):
# Issue 14645.