Skip to content

Commit 5b4feb7

Browse files
authored
bpo-30188: test_nntplib catch also ssl.SSLEOFError (#2843)
Catch also ssl.SSLEOFError in NetworkedNNTPTests setUpClass(). EOFError was already catched.
1 parent 0663495 commit 5b4feb7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/test_nntplib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ def is_connected():
274274
NetworkedNNTPTestsMixin.wrap_methods()
275275

276276

277+
EOF_ERRORS = [EOFError]
278+
if ssl is not None:
279+
EOF_ERRORS.append(ssl.SSLEOFError)
280+
281+
277282
class NetworkedNNTPTests(NetworkedNNTPTestsMixin, unittest.TestCase):
278283
# This server supports STARTTLS (gmane doesn't)
279284
NNTP_HOST = 'news.trigofacile.com'
@@ -289,7 +294,7 @@ def setUpClass(cls):
289294
try:
290295
cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, timeout=TIMEOUT,
291296
usenetrc=False)
292-
except EOFError:
297+
except EOF_ERRORS:
293298
raise unittest.SkipTest(f"{cls} got EOF error on connecting "
294299
f"to {cls.NNTP_HOST!r}")
295300

0 commit comments

Comments
 (0)