관리-도구
편집 파일: test_utils.cpython-37.pyc
B �k�a�R � @ sP d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl mZmZ ddl mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZmZ dd l m!Z! ddl"Z"dd l#m$Z$m%Z% ddl&m'Z'm(Z( dd l m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z< ddl=m>Z> e�r|ddl?m@Z@ ndZ@e/�r�ddlmAZB nddlCmBZB ejDdk�o�ejEdkZFejGfeHejIejd�dd�ZJeHeKejIejd�dd�ZLeKd�d d!�ZMG d"d#� d#e�ZNG d$d%� d%eN�ZOG d&d'� d'eN�ZPG d(d)� d)�ZQG d*d+� d+eB�ZReeeed,�d-d.�ZSeg ejTf ZUejVejWd/feUeXeejT d0�d1d2��ZYejWfeUejTd3�d4d5�ZZdGejTeXdd6�d7d8�Z[ej\d�d9d:�Z]dHee@ ej^d;�d<d=�Z_dIe0e2dd�d/de0e0e0e0dd>d?d@�eHeHeee2eXeeeeeee@ eKee8dA�dBdC�Z`e0e0feeedD�dEdF�ZadS )JzUtilities shared by tests.� N)�ABC�abstractmethod)� TracebackType) � TYPE_CHECKING�Any�Callable�Iterator�List�Optional�Type�Union�cast)�mock)�Signal)�CIMultiDict�CIMultiDictProxy)�URL)�_RequestContextManager�_WSRequestContextManager� )� ClientSession�hdrs)�AbstractCookieJar)�ClientResponse)�ClientWebSocketResponse)�PY_38�sentinel)�HttpVersion�RawRequestMessage)�Application� AppRunner� BaseRunner�Request�Server�ServerRunner�SockSite�UrlMappingMatchInfo)�_RequestHandler)� SSLContext)�IsolatedAsyncioTestCase)�TestCase�posix�cygwin)�host�family�returnc C s t | d|�S )Nr )�get_port_socket)r- r. � r1 �E/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/test_utils.py�get_unused_port_socketA s r3 )r- �portr. r/ c C s6 t � |t j�}tr$|�t jt jd� |�| |f� |S )Nr )�socket�SOCK_STREAM� REUSE_ADDRESS� setsockopt� SOL_SOCKET�SO_REUSEADDR�bind)r- r4 r. �sr1 r1 r2 r0 G s r0 )r/ c C s8 t � t jt j��} | �d� tt| �� d �S Q R X dS )z1Return a port that is unused on the current host.)z 127.0.0.1r r N)r5 �AF_INETr6 r; r �int�getsockname)r<