From: Christian Heimes Date: Mon, 3 May 2021 07:38:56 +0000 (+0200) Subject: bpo-44011: Fix asyncio tests without ssl module (GH-25840) X-Git-Tag: v3.10.0b1~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37ebdf0a866457ce825d0ff6e498a10938895760;p=thirdparty%2FPython%2Fcpython.git bpo-44011: Fix asyncio tests without ssl module (GH-25840) Signed-off-by: Christian Heimes --- diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index e71875ba9f00..79734ab63d2e 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -12,7 +12,8 @@ from . import protocols from . import transports from .log import logger -SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError) +if ssl is not None: + SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError) class SSLProtocolState(enum.Enum): diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index 38235c63e01e..4dcd3a0292a9 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -3,14 +3,18 @@ import asyncio.sslproto import contextlib import gc import logging -import os import select import socket -import ssl import tempfile import threading import time import weakref +import unittest + +try: + import ssl +except ImportError: + ssl = None from test import support from test.test_asyncio import utils as test_utils @@ -54,6 +58,7 @@ class MyBaseProto(asyncio.Protocol): self.done.set_result(None) +@unittest.skipIf(ssl is None, 'No ssl module') class TestSSL(test_utils.TestCase): PAYLOAD_SIZE = 1024 * 100