bpo-39259: nntplib.NNTP/NNTP_SSL now reject timeout = 0 (GH-17936)

nntplib.NNTP and nntplib.NNTP_SSL now raise a ValueError
if the given timeout for their constructor is zero to
prevent the creation of a non-blocking socket.
This commit is contained in:
Dong-hee Na 2020-01-12 02:39:15 +09:00 committed by Victor Stinner
parent 136735c1a2
commit 1b335ae281
5 changed files with 24 additions and 0 deletions

View file

@ -258,6 +258,10 @@ class NetworkedNNTPTestsMixin:
# value
setattr(cls, name, wrap_meth(meth))
def test_timeout(self):
with self.assertRaises(ValueError):
self.NNTP_CLASS(self.NNTP_HOST, timeout=0, usenetrc=False)
def test_with_statement(self):
def is_connected():
if not hasattr(server, 'file'):