mirror of
https://github.com/python/cpython.git
synced 2025-10-12 18:02:39 +00:00
bpo-35505: Skip test_imap4_host_default_value if localhost listens on IMAP port (GH-11823)
Make test_imap4_host_default_value independent on whether the local IMAP server is running.
This commit is contained in:
parent
16f842da3c
commit
3dc67d0316
2 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,7 @@ import socketserver
|
||||||
import time
|
import time
|
||||||
import calendar
|
import calendar
|
||||||
import threading
|
import threading
|
||||||
|
import socket
|
||||||
|
|
||||||
from test.support import (reap_threads, verbose, transient_internet,
|
from test.support import (reap_threads, verbose, transient_internet,
|
||||||
run_with_tz, run_with_locale, cpython_only)
|
run_with_tz, run_with_locale, cpython_only)
|
||||||
|
@ -71,6 +72,15 @@ class TestImaplib(unittest.TestCase):
|
||||||
imaplib.Time2Internaldate(t)
|
imaplib.Time2Internaldate(t)
|
||||||
|
|
||||||
def test_imap4_host_default_value(self):
|
def test_imap4_host_default_value(self):
|
||||||
|
# Check whether the IMAP4_PORT is truly unavailable.
|
||||||
|
with socket.socket() as s:
|
||||||
|
try:
|
||||||
|
s.connect(('', imaplib.IMAP4_PORT))
|
||||||
|
self.skipTest(
|
||||||
|
"Cannot run the test with local IMAP server running.")
|
||||||
|
except socket.error:
|
||||||
|
pass
|
||||||
|
|
||||||
expected_errnos = [
|
expected_errnos = [
|
||||||
# This is the exception that should be raised.
|
# This is the exception that should be raised.
|
||||||
errno.ECONNREFUSED,
|
errno.ECONNREFUSED,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Make test_imap4_host_default_value independent on whether the
|
||||||
|
local IMAP server is running.
|
Loading…
Add table
Add a link
Reference in a new issue