Serhiy Storchaka added the comment:

I'm not sure I understand you Rietveld comment right Terry.

We can get rid of _have_ssl (this is implementation detail and shouldn't be 
required) and just try import ssl.

try:
    import ssl
except ImportError:
    ssl = None

If ssl is not None but nntplib.NNTP_SSL doesn't exist the 
NetworkedNNTP_SSLTests tests will failed:

======================================================================
ERROR: setUpClass (test.test_nntplib.NetworkedNNTP_SSLTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/test_nntplib.py", line 298, in 
setUpClass
    cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, timeout=TIMEOUT, usenetrc=False)
TypeError: 'NoneType' object is not callable

----------------------------------------------------------------------

This doesn't different from a case when some exception is raised in NNTP_SSL 
constructor.

We can add a separate test in MiscTests:

    @unittest.skipUnless(ssl, 'requires SSL support')
    def test_ssl_support(self):
        self.assertTrue(hasattr(nntplib, 'NNTP_SSL'))

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18702>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to