Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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)
Expand Down Expand Up @@ -71,6 +72,15 @@ def test_that_Time2Internaldate_returns_a_result(self):
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Make test_imap4_host_default_value independent on whether the
local IMAP server is running.