Skip to content

Commit 37ebdf0

Browse files
authored
bpo-44011: Fix asyncio tests without ssl module (GH-25840)
Signed-off-by: Christian Heimes <[email protected]>
1 parent 99ad742 commit 37ebdf0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Lib/asyncio/sslproto.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from . import transports
1313
from .log import logger
1414

15-
SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError)
15+
if ssl is not None:
16+
SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError)
1617

1718

1819
class SSLProtocolState(enum.Enum):

Lib/test/test_asyncio/test_ssl.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
import contextlib
44
import gc
55
import logging
6-
import os
76
import select
87
import socket
9-
import ssl
108
import tempfile
119
import threading
1210
import time
1311
import weakref
12+
import unittest
13+
14+
try:
15+
import ssl
16+
except ImportError:
17+
ssl = None
1418

1519
from test import support
1620
from test.test_asyncio import utils as test_utils
@@ -54,6 +58,7 @@ def connection_lost(self, exc):
5458
self.done.set_result(None)
5559

5660

61+
@unittest.skipIf(ssl is None, 'No ssl module')
5762
class TestSSL(test_utils.TestCase):
5863

5964
PAYLOAD_SIZE = 1024 * 100

0 commit comments

Comments
 (0)