Message195455
| Author |
serhiy.storchaka |
| Recipients |
ezio.melotti, michael.foord, pitrou, serhiy.storchaka, terry.reedy, vajrasky |
| Date |
2013年08月17日.09:40:25 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1376732425.55.0.119801155464.issue18702@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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')) |
|