File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 11
11
from io import StringIO , BytesIO
12
12
from itertools import chain
13
13
from random import choice
14
- from socket import getfqdn
15
14
from threading import Thread
15
+ from unittest .mock import patch
16
16
17
17
import email
18
18
import email .policy
@@ -3342,9 +3342,11 @@ def test_make_msgid_idstring(self):
3342
3342
'.test-idstring@testdomain-string>' )
3343
3343
3344
3344
def test_make_msgid_default_domain (self ):
3345
- self .assertTrue (
3346
- email .utils .make_msgid ().endswith (
3347
- '@' + getfqdn () + '>' ))
3345
+ with patch ('socket.getfqdn' ) as mock_getfqdn :
3346
+ mock_getfqdn .return_value = domain = 'pythontest.example.com'
3347
+ self .assertTrue (
3348
+ email .utils .make_msgid ().endswith (
3349
+ '@' + domain + '>' ))
3348
3350
3349
3351
def test_Generator_linend (self ):
3350
3352
# Issue 14645.
Original file line number Diff line number Diff line change
1
+ Use the same domain when testing ``make_msgid ``. Patch by Batuhan Taskaya.
You can’t perform that action at this time.
0 commit comments