HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/aiohttp/__pycache__/pytest_plugin.cpython-310.pyc
o

;j�2�
@sdddlZddlZddlZddlZddlmZmZmZddlm	Z	m
Z
mZddlZddl
mZmZmZmZmZmZmZmZddlmZmZmZddlmZzddlZWney]dZYnwGdd	�d	e
�ZGd
d�de
�Z Gdd
�d
e
�Z!dd�Z"dd�Z#ej$dd��Z%ej$dd��Z&ej'dd��Z(ej'd7dd��Z)dd�Z*dd�Z+dd �Z,ej$d!egej-fde.de.d"eej-fd#d$��Z/ej$d"eej-fd%d&��Z0ej$d'ege1fd"ege1ffd(d)��Zej$d"ege1ffd*d'��Z2ej$d$ej-d"ee fd+d,��Z3ej$d-d.��Z4ej$d$ej-d"ee!fd/d0��Z5ej$d1d2��Z6ej$d$ej-d"eefd3d4��Z7ej$d5d6��Z8dS)8�N)�	Awaitable�Callable�Iterator)�Any�Protocol�overload�)�BaseTestServer�
RawTestServer�
TestClient�
TestServer�loop_context�setup_test_loop�teardown_test_loop�unused_port)�Application�BaseRequest�Request)�_RequestHandlerc@s|eZdZedd�dedeeefdBdedee	effdd��Z
edd�dedeeefdBdedeedffd	d��Z
dS)
�
AiohttpClientN��
server_kwargs�_AiohttpClient__paramr�kwargs�returnc���dS�N���selfrrrrr�I/opt/saltstack/salt/lib/python3.10/site-packages/aiohttp/pytest_plugin.py�__call__��zAiohttpClient.__call__c�rrrrrrr r!&r")
�__name__�
__module__�__qualname__rr�dict�strrrrr!r	rrrrr rs.����
�����
�rc
@�4eZdZdd�dededBdedeefdd�ZdS)	�
AiohttpServerN��port�appr+rrcK�dSrr)rr,r+rrrr r!1�zAiohttpServer.__call__)	r#r$r%r�intrrrr!rrrr r)0������r)c
@r()	�AiohttpRawServerNr*�handlerr+rrcKr-rr)rr2r+rrrr r!7r.zAiohttpRawServer.__call__)	r#r$r%rr/rrr
r!rrrr r16r0r1cCs:|jddddd�|jdddd	d�|jd
dddd�dS)N�--aiohttp-fast�
store_trueFz*run tests faster by disabling extra checks)�action�default�helpz--aiohttp-loop�store�pyloopz3run tests with specific loop: pyloop, uvloop or all�--aiohttp-enable-loop-debugzenable event loop debug mode)Z	addoption)�parserrrr �pytest_addoption<s$��
�r<csd|j�t���rd�n
t���rd�ndSd�d|jvr%|jd7_d����fdd�}||_dS)zjSet up pytest fixture.

    Allow fixtures to be coroutines. Run coroutine fixtures in an event loop.
    TFN�request�r=csz|d}�r	|d=d|jvrtd��|�d���r3�|i|�����fdd�}|�|�������S���|i|���S)Nr=�loopz^Asynchronous fixtures must depend on the 'loop' fixture or be used in tests depending from it.cs&z������WStyYdSwr)�run_until_complete�	__anext__�StopAsyncIterationr��_loop�genrr �	finalizer|s
�z8pytest_fixture_setup.<locals>.wrapper.<locals>.finalizer)�fixturenames�	ExceptionZgetfixturevalueZaddfinalizerr@rA)�argsrr=rF��funcZis_async_genZ
strip_requestrCr �wrappergs
�

z%pytest_fixture_setup.<locals>.wrapper)rK�inspectZisasyncgenfunction�iscoroutinefunction�argnames)Z
fixturedefrLrrJr �pytest_fixture_setupQs



 rPcC�|j�d�S)z--fast config optionr3��config�	getoptionr>rrr �fast��rUcCrQ)z!--enable-loop-debug config optionr:rRr>rrr �
loop_debug�rVrWc	csx�tjdd��+}dVdd�|D�}|r*td�t|�t|�dkr"dnd	d
�|����Wd�dS1s5wYdS)z�Context manager which checks for RuntimeWarnings.

    This exists specifically to
    avoid "coroutine 'X' was never awaited" warnings being missed.

    If RuntimeWarnings occur in the context a RuntimeError is raised.
    T)�recordNcSs0g|]}|jtkr|j�d|j�d|j���qS)�:)�category�RuntimeWarning�filename�lineno�message)�.0�wrrr �
<listcomp>�s

�z,_runtime_warning_context.<locals>.<listcomp>z{} Runtime Warning{},
{}r��s�
)�warnings�catch_warnings�RuntimeError�format�len�join)�	_warnings�rwrrr �_runtime_warning_context�s�	� ���"�rmFccs,�|r|VdSt�}|Vt||d�dS)z�Passthrough loop context.

    Sets up and tears down a loop unless one is passed in via the loop
    argument when it's passed straight through.
    �rUN)rr)r?rUrrr �_passthrough_loop_context�s�
rocCs,|�|�rt�|�rt|�||��SdSdS)z%Fix pytest collecting for coroutines.N)ZfuncnamefilterrMrN�listZ
_genfunctions)Z	collector�name�objrrr �pytest_pycollect_makeitem�s�rsc	s��j�d�}t��j�rut�dt��j�	d�p*�j�	d�p*�j�	d�p*�j�	dd�}t
��=t||d��}�fd	d
��jj
D�}|��jdi|���Wd�n1sVwYWd�dSWd�dS1snwYdSdS)
zBRun coroutines in an event loop instead of a normal function call.r3zKaiohttp.pytest_plugin will be removed in v4. Please install pytest-aiohttp.�
proactor_loopZ
selector_loopZuvloop_loopr?Nrncsi|]}|�j|�qSr)�funcargs)r_�arg��
pyfuncitemrr �
<dictcomp>�s
��z&pytest_pyfunc_call.<locals>.<dictcomp>Tr)rSrTrMrN�functionre�warn�DeprecationWarningru�getrmroZ_fixtureinforOr@rr)rxrUZ
existing_looprDZtestargsrrwr �pytest_pyfunc_call�s8�
�
��
��
��
���r~cCs�d|jvrdS|jjj}dtji}tdurtj|d<|dkr d}i}|�d�D]&}|�d�}|�	d�}||vrG|rFt
d	|t|���f��q'||||<q'|j
dt|���t|���d
�dS)N�loop_factoryr9�uvloop�allzpyloop,uvloop?�,�?z ?z&Unknown loop '%s', available loops: %s)Zids)rGrS�optionZaiohttp_loop�asyncioZnew_event_loopr��split�endswith�strip�
ValueErrorrp�keysZparametrize�values)ZmetafuncZloopsZavail_factoriesZ	factoriesrq�requiredrrr �pytest_generate_tests�s0




��
�r�rrccsR�t||d��}|r|�d�t�|�|VWd�dS1s"wYdS)z%Return an instance of the event loop.rnTN)r
Z	set_debugr��set_event_loop)rrUrWrDrrr r?�s�

"�r?ccsF�tj}t|��}t�|�|VWd�dS1swYdSr)r�ZProactorEventLoopr
r�)�factoryrDrrr rt
s�

"�rt�aiohttp_unused_portcC�tjdtdd�|S)Nz3Deprecated, use aiohttp_unused_port fixture instead���
stacklevel�rer{r|)r�rrr r��rcCstS)z1Return a port that is unused on the current host.)�_unused_portrrrr r� sc#sZ�g�ddd�dtdtdtdBdtdtf
��fd	d
�}|Vd
�fdd�}��|��dS)z^Factory to create a TestServer instance, given an app.

    aiohttp_server(app, **kwargs)
    z	127.0.0.1N��hostr+r,r�r+rrc�s8�t|||d�}|jdd�i|��IdH��|�|S)Nr�r?r)r�start_server�append)r,r�r+r�server�r?�serversrr �go.s
�
zaiohttp_server.<locals>.goc��$��r�����IdH�sdSdSr��pop�closer�r�rr �finalize<���z aiohttp_server.<locals>.finalize�rN)rr'r/rrr@�r?r�r�rr�r �aiohttp_server&s$�������r�cCr�)Nz.Deprecated, use aiohttp_server fixture insteadr�r�r�)r�rrr �test_serverCr�r�c	#sT�g�dd�dtdtdBdtdtf��fdd�}|Vd�fd	d
�}��|��dS)zpFactory to create a RawTestServer instance, given a web handler.

    aiohttp_raw_server(handler, **kwargs)
    Nr*r2r+rrc�s6�t||d�}|jdd�i|��IdH��|�|S)Nr*r?r)r
r�r�)r2r+rr�r�rr r�Us
�
zaiohttp_raw_server.<locals>.goc�r�rr�rr�rr r�_r�z$aiohttp_raw_server.<locals>.finalizer�)rr/rr
r@r�rr�r �aiohttp_raw_serverMs������r�cCr�)Nz2Deprecated, use aiohttp_raw_server fixture insteadr�r�r�)r�rrr �raw_test_serverfs�r�c
#s��g�tdd�dtdtttfdBdtdtttffdd��}tdd�dtdtttfdBdtdttdffd	d��}dd�dttBd
tdtttfdBdtdtttff
��fdd�}|Vd�fdd
�}��	|��dS)z�Factory to create a TestClient instance.

    aiohttp_client(app, **kwargs)
    aiohttp_client(server, **kwargs)
    aiohttp_client(raw_server, **kwargs)
    Nr�__paramrrrc�rrr�r�rrrrr r�|��zaiohttp_client.<locals>.goc�rrrr�rrr r��r�rIc�s��t|t�rt|ttf�s|�g|�Ri|��}i}n|r!Jd��t|t�r?|p)i}t|fd�i|��}t|fd�i|��}nt|t�rOt|fd�i|��}ntdt|���|��IdH��	|�|S)Nzargs should be emptyr?zUnknown argument type: %r)
�
isinstancerrr	rrr��typer�r�)r�rrIrr��client��clientsr?rr r��s"��


c�r�rr�r)r�rr r��r�z aiohttp_client.<locals>.finalizer�)
rrr&r'rrrr	rr@r�rr�r �aiohttp_clientrsN�����
�����
�
�����
�r�cCr�)Nz.Deprecated, use aiohttp_client fixture insteadr�r�r�)r�rrr �test_client�r�r�)F)9r��
contextlibrMre�collections.abcrrr�typingrrrZpytestZ
test_utilsr	r
rrr
rrrr�ZwebrrrZweb_protocolrr��ImportErrorrr)r1r<rPZfixturerUrW�contextmanagerrmrorsr~r�ZAbstractEventLoop�boolr?rtr/r�r�r�r�r�r�r�rrrr �<module>sv(
�9


 ����
$	
	
=