[Python-checkins] (no subject)
Batuhan Taşkaya
webhook-mailer at python.org
Thu Apr 16 13:29:20 EDT 2020
To: python-checkins at python.org
Subject: bpo-39793: use the same domain on make_msgid tests (#18698)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
https://github.com/python/cpython/commit/5565c30f0b25996a0e73477fc0e1e1aced52=
b926
commit: 5565c30f0b25996a0e73477fc0e1e1aced52b926
branch: master
author: Batuhan Ta=C5=9Fkaya <batuhanosmantaskaya at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-04-16T13:29:12-04:00
summary:
bpo-39793: use the same domain on make_msgid tests (#18698)
* bpo-39793: use same domain on make_msgid tests
* apply suggestions
files:
A Misc/NEWS.d/next/Tests/2020-02-29-12-58-17.bpo-39793.Og2SUN.rst
M Lib/test/test_email/test_email.py
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_ema=
il.py
index 8ec39190ea8da..59eabb0092194 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -11,8 +11,8 @@
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
=20
import email
import email.policy
@@ -3342,9 +3342,11 @@ def test_make_msgid_idstring(self):
'.test-idstring at testdomain-string>')
=20
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 =3D domain =3D 'pythontest.example.com'
+ self.assertTrue(
+ email.utils.make_msgid().endswith(
+ '@' + domain + '>'))
=20
def test_Generator_linend(self):
# Issue 14645.
diff --git a/Misc/NEWS.d/next/Tests/2020-02-29-12-58-17.bpo-39793.Og2SUN.rst =
b/Misc/NEWS.d/next/Tests/2020-02-29-12-58-17.bpo-39793.Og2SUN.rst
new file mode 100644
index 0000000000000..6fa0d15ba2fdc
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-02-29-12-58-17.bpo-39793.Og2SUN.rst
@@ -0,0 +1 @@
+Use the same domain when testing ``make_msgid``. Patch by Batuhan Taskaya.
More information about the Python-checkins
mailing list