bpo-44011: Fix asyncio tests without ssl module (GH-25840)

Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
Christian Heimes 2021-05-03 09:38:56 +02:00 committed by GitHub
parent 99ad742ea9
commit 37ebdf0a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,8 @@ from . import protocols
from . import transports from . import transports
from .log import logger from .log import logger
SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError) if ssl is not None:
SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError)
class SSLProtocolState(enum.Enum): class SSLProtocolState(enum.Enum):

View File

@ -3,14 +3,18 @@ import asyncio.sslproto
import contextlib import contextlib
import gc import gc
import logging import logging
import os
import select import select
import socket import socket
import ssl
import tempfile import tempfile
import threading import threading
import time import time
import weakref import weakref
import unittest
try:
import ssl
except ImportError:
ssl = None
from test import support from test import support
from test.test_asyncio import utils as test_utils from test.test_asyncio import utils as test_utils
@ -54,6 +58,7 @@ class MyBaseProto(asyncio.Protocol):
self.done.set_result(None) self.done.set_result(None)
@unittest.skipIf(ssl is None, 'No ssl module')
class TestSSL(test_utils.TestCase): class TestSSL(test_utils.TestCase):
PAYLOAD_SIZE = 1024 * 100 PAYLOAD_SIZE = 1024 * 100