Skip to content

bpo-35505: Skip test_imap4_host_default_value if localhost listens on IMAP port#11823

Merged
vstinner merged 4 commits into
python:masterfrom
mcepl:35505_skip_on_listening_imap_port
Feb 12, 2019
Merged

bpo-35505: Skip test_imap4_host_default_value if localhost listens on IMAP port#11823
vstinner merged 4 commits into
python:masterfrom
mcepl:35505_skip_on_listening_imap_port

Conversation

@mcepl
Copy link
Copy Markdown
Contributor

@mcepl mcepl commented Feb 12, 2019

test_imaplib.TestImaplib.test_imap4_host_default_value fails when run on
the computer with the local IMAP server running. This may happen for
developers, who consequently don't need to be bothered about this test
failing.

https://bugs.python.org/issue35505

… IMAP port.

test_imaplib.TestImaplib.test_imap4_host_default_value fails when run on
the computer with the local IMAP server running. This may happen for
developers, who consequently don't need to be bothered about this test
failing.
@mcepl mcepl requested a review from a team as a code owner February 12, 2019 00:35
@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting review labels Feb 12, 2019
Copy link
Copy Markdown
Contributor

@eamanu eamanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I don't think that is necessary a news for a new test.

@vstinner
Copy link
Copy Markdown
Member

Would it be possible to use a different port instead? Using test.support.find_unused_port() for example.

Comment thread Misc/NEWS.d/next/Library/2019-02-12-01-33-08.bpo-35505.N9ba_K.rst Outdated
@vstinner
Copy link
Copy Markdown
Member

I tested manually.

Terminal 1:

echo -n|sudo nc -l 143 -v

Terminal 2:

./python -m test -u all test_imaplib -m test_imap4_host_default_value -v

Without this change, Terminal 1 shows an incoming connection ("Ncat: Connection from ::1:35778.") and the test fails with imaplib.IMAP4.abort: socket error: EOF.

With the change: no incoming connection and the test pass as expected.

Comment thread Lib/test/test_imaplib.py Outdated
Comment thread Lib/test/test_imaplib.py Outdated
Comment thread Lib/test/test_imaplib.py Outdated
Comment thread Misc/NEWS.d/next/Library/2019-02-12-01-33-08.bpo-35505.N9ba_K.rst
Also, move NEWS item to right directory.
Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread Lib/test/test_imaplib.py Outdated
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @mcepl for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link
Copy Markdown

GH-11829 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 12, 2019
… IMAP port (pythonGH-11823)

Make test_imap4_host_default_value independent on whether the
local IMAP server is running.
(cherry picked from commit 3dc67d0)

Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
@vstinner
Copy link
Copy Markdown
Member

@mcepl: The patch doesn't apply cleanup on the 2.7 branch. Can you try to write at patch for 2.7?

@mcepl mcepl deleted the 35505_skip_on_listening_imap_port branch February 12, 2019 18:51
@mcepl
Copy link
Copy Markdown
Contributor Author

mcepl commented Feb 12, 2019

@vstinner There is nothing to port to … 2.7 just doesn't have this test case at all.

miss-islington added a commit that referenced this pull request Feb 12, 2019
… IMAP port (GH-11823)

Make test_imap4_host_default_value independent on whether the
local IMAP server is running.
(cherry picked from commit 3dc67d0)

Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
@vstinner
Copy link
Copy Markdown
Member

@vstinner There is nothing to port to … 2.7 just doesn't have this test case at all.

Aha :-D Good. I close the issue in that case ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants