8000 bpo-30231: Remove skipped test_imaplib tests by vstinner · Pull Request #1419 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-30231: Remove skipped test_imaplib tests #1419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2017
Merged
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
30 changes: 10 additions & 20 deletions Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import calendar

from test.support import (reap_threads, verbose, transient_internet,
run_with_tz, run_with_locale)
run_with_tz, run_with_locale, cpython_only)
import unittest
from unittest import mock
from datetime import datetime, timezone, timedelta
Expand Down Expand Up @@ -503,6 +503,15 @@ def test_ssl_verified(self):
ssl_context=ssl_context)
client.shutdown()

# Mock the private method _connect(), so mark the test as specific
# to CPython stdlib
@cpython_only
def test_certfile_arg_warn(self):
with support.check_warnings(('', DeprecationWarning)):
with mock.patch.object(self.imap_class, 'open'):
with mock.patch.object(self.imap_class, '_connect'):
self.imap_class('localhost', 143, certfile=CERTFILE)

class ThreadedNetworkedTests(unittest.TestCase):
server_class = socketserver.TCPServer
imap_class = imaplib.IMAP4
Expand Down Expand Up @@ -965,25 +974,6 @@ def test_logincapa(self):
_server = self.imap_class(self.host, self.port)
self.check_logincapa(_server)

@unittest.skipIf(True,
"bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn't accept "
"our randomly generated client x509 certificate anymore")
def test_logincapa_with_client_certfile(self):
with transient_internet(self.host):
with support.check_warnings(('', DeprecationWarning)):
_server = self.imap_class(self.host, self.port,
certfile=CERTFILE)
self.check_logincapa(_server)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps drop this line and only check for DeprecationWarning instead of removing the whole test (you probably can make it simpler)? It looks like the following branch is only covered by this test so keeping it might be better:

if keyfile is not None or certfile is not None:
    import warnings
    warnings.warn("keyfile and certfile are deprecated, use a"
                  "custom ssl_context instead", DeprecationWarning, 2)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I wrote a new unit test to check for the deprecation warning.


@unittest.skipIf(True,
"bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn't accept "
"our randomly generated client x509 certificate anymore")
def test_logincapa_with_client_ssl_context(self):
with transient_internet(self.host):
_server = self.imap_class(
self.host, self.port, ssl_context=self.create_ssl_context())
self.check_logincapa(_server)

def test_logout(self):
with transient_internet(self.host):
_server = self.imap_class(self.host, self.port)
Expand Down
0