HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/.local/lib/python3.10/site-packages/anyio/__pycache__/pytest_plugin.cpython-310.pyc
o

���g8�@s~UddlmZddlZddlmZmZddlmZmZddl	m
Z
mZmZddl
mZmZddlZddlZddlmZddlmZd	d
lmZmZd	dlmZd	dlmZejd
kr`ddlmZda de!d<da"de!d<da#d>dd�Z$ed?dd��Z%d@d#d$�Z&ej'd%d&�dAd*d+��Z(ej'd%d,�dBd0d1��Z)ej'd%d,�dCd4d5��Z*ej+d6e�d7�dDd8d9��Z,ej+dEd:d;��Z-ej+dFd<d=��Z.dS)G�)�annotationsN)�	Generator�Iterator)�	ExitStack�contextmanager)�isasyncgenfunction�iscoroutinefunction�ismethod)�Any�cast)�
SubRequest)�Exit�)�get_all_backends�get_async_backend)�iterate_exceptions)�
TestRunner)��)�ExceptionGroupzTestRunner | None�_current_runnerzExitStack | None�
_runner_stack�backend�object�return�tuple[str, dict[str, Any]]cCsft|t�r	|ifSt|t�r/t|�dkr/t|dt�r/t|dt�r/ttttttff|�Std��)N�rrz@anyio_backend must be either a string or tuple of (string, dict))�
isinstance�str�tuple�len�dictrr
�	TypeError)r�r#�F/home/arjun/.local/lib/python3.10/site-packages/anyio/pytest_plugin.py�extract_backend_and_optionss
r%�backend_namer�backend_options�dict[str, Any]�Iterator[TestRunner]ccs��tdur.t|�}t�atj�d�dur"tj�|�}t�tjj	|�|p%i}t�
|�|��atd7aztVWtd8atsMtdusCJ�t�
�daadSdStd8atsctdus[J�t�
�daaw�Nr)rrrr�sniffio�current_async_library_cvar�get�set�callback�reset�
enter_context�create_test_runner�_runner_leases�close)r&r'�asynclib�tokenr#r#r$�
get_runner$s2����
r7�configr
�NonecCs|�dd�dS)N�markerszManyio: mark the (coroutine function) test to be run asynchronously via anyio.)�addinivalue_line)r8r#r#r$�pytest_configureBs�r<T)�hookwrapper�
fixturedef�request�Generator[Any]c#s��d���fdd	�}|j�t��st��rNd|jvrN||_|j}d|jv�s.|jd
7_d|jv�s<|jd7_z
dVW�|_||_S�|_||_wdVS)
N�argsr
�
anyio_backendr?r�kwargsrc?s��|jrt��rt�j�t|j�ur�j�|j�}n�}t|�\}}�r(||d<�r.||d<t||��&}t|�rB|�	||�EdHn|�
||�VWd�dSWd�dS1s\wYdS)NrBr?)�instancer	�type�__self__�__func__�__get__r%r7r�run_asyncgen_fixture�run_fixture)rBr?rArC�
local_funcr&r'�runner��func�has_backend_arg�has_request_argr#r$�wrapperLs(����"�z%pytest_fixture_setup.<locals>.wrapper�rB�r?)
rAr
rBr
r?rrCr
rr
)rNrr�fixturenames�argnames)r>r?rQ�original_argnamer#rMr$�pytest_fixture_setupJs$�
�rW)�tryfirst�	collector�name�objcCsv|�||�r5t|d�r|jjn|}t|�r7|�d�}t|dd�}|s+tdd�|D��r9tj	�
d�|�dSdSdSdS)N�
hypothesis�anyio�
pytestmarkr#css�|]}|jdkVqdS)r]N)rZ)�.0�markerr#r#r$�	<genexpr>�s�z,pytest_pycollect_makeitem.<locals>.<genexpr>rB)�istestfunction�hasattrr\�
inner_testr�get_closest_marker�getattr�any�pytest�mark�usefixtures)rYrZr[�
inner_funcr`�own_markersr#r#r$�pytest_pycollect_makeitem}s
�rm�
pyfuncitem�bool | Nonecsd���fdd�}|j�d�}|r�t|�\��t|jd�r3|jjj��j|jkr1t��r1||jj_dSt|j�r�|j��fd	d
�|j	j
D�}t����2}z	|�|j|�Wnt
yt}zt|�D]
}t|tttf�rn||�qa�d}~wwWd�dS1s�wYdSdS)
NrCr
rr9cs<t����}|��|�Wd�dS1swYdS�N)r7�run_test)rCrL)r&r'�
original_funcr#r$�run_with_hypothesis�s"�z/pytest_pyfunc_call.<locals>.run_with_hypothesisrBr\csi|]}|�|�qSr#r#)r_�arg)�funcargsr#r$�
<dictcomp>�sz&pytest_pyfunc_call.<locals>.<dictcomp>T)rCr
rr9)rur-r%rcr[r\rd�__qualname__r�_fixtureinforUr7rqrrrr
�KeyboardInterrupt�
SystemExit)rnrsr�testargsrL�excgrp�excr#)r&r'rurrr$�pytest_pyfunc_call�s<


����
�
�
r~�module)�scope�paramscCs|jSrp)�paramrSr#r#r$rB�srBcCst|t�r|S|dS)Nr�rrrRr#r#r$�anyio_backend_name��
r�cCst|t�riS|dSr*r�rRr#r#r$�anyio_backend_options�r�r�)rrrr)r&rr'r(rr))r8r
rr9)r>r
r?r
rr@)rYr
rZr
r[r
rr9)rnr
rro)r?r
rr
)rBr
rr)rBr
rr()/�
__future__r�sys�collections.abcrr�
contextlibrr�inspectrrr	�typingr
rrhr+�_pytest.fixturesr�_pytest.outcomesr
�_core._eventlooprr�_core._exceptionsr�abcr�version_info�exceptiongrouprr�__annotations__rr3r%r7r<�hookimplrWrmr~�fixturerBr�r�r#r#r#r$�<module>sD





2

$