summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2019-02-12 18:30:19 (GMT)
committerVictor Stinner <vstinner@redhat.com>2019-02-12 18:30:19 (GMT)
commit3dc67d0316740e78e7cd014343f34d85908219b7 (patch)
tree8c3022914d7f70ea7ff9fbabbfafadea0b00194d /Lib
parent16f842da3c862d76a1177bd8ef9579703c24fa5a (diff)
downloadcpython-3dc67d0316740e78e7cd014343f34d85908219b7.zip
cpython-3dc67d0316740e78e7cd014343f34d85908219b7.tar.gz
cpython-3dc67d0316740e78e7cd014343f34d85908219b7.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_imaplib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index a0b598d..a060143 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -8,6 +8,7 @@ import socketserver
import time
import calendar
import threading
+import socket
from test.support import (reap_threads, verbose, transient_internet,
run_with_tz, run_with_locale, cpython_only)
@@ -71,6 +72,15 @@ class TestImaplib(unittest.TestCase):
imaplib.Time2Internaldate(t)
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 = [
# This is the exception that should be raised.
errno.ECONNREFUSED,