o
    Zh@                  
   @   s(  d dl mZ d dl mZ d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d d	lmZ d d
lmZ d dlZde
ddfddZejdddee dededeef fddZdee deddfddZdee dededdfddZejdddedeeeef  fddZdS )    )	Generator)Optional)Union)saferepr)Config)ExitCode)Parser)
FixtureDef)
SubRequest)ScopeNparserreturnc                 C   s2   |  d}|jddddd |jdddd	d d S )
NZdebugconfigz--setuponlyz--setup-only
store_truez)Only setup fixtures, do not execute tests)actionhelpz--setupshowz--setup-showz,Show setup of fixtures while executing tests)ZgetgroupZ	addoption)r   group r   H/var/www/html/lang_env/lib/python3.10/site-packages/_pytest/setuponly.pypytest_addoption   s   

r   T)wrapper
fixturedefrequestc              
   c   s    z2d V W |j jjr3t|dr+| jr%t| jr| |j}n
| j|j }n|j}|| _t	| |j d S S |j jjrbt|drZ| jrTt| jrM| |j}n
| j|j }n|j}|| _t	| |j d w w )NparamSETUP)
configoption	setupshowhasattrZidscallabler   Zparam_indexcached_param_show_fixture_action)r   r   r   r   r   r   pytest_fixture_setup   s,   




r!   c                 C   sD   | j d ur|j}|jjrt| |jd t| dr | `d S d S d S d S )NZTEARDOWNr   )Zcached_resultr   r   r   r    r   r   )r   r   r   r   r   r   pytest_fixture_post_finalizer5   s   

r"   r   msgc                 C   s   |j d}|r|  | }|  ttt| j	}|
d|  |
dj|d| jd  | jd |dkrTtdd	 | jD }|rT|
d
d| t| drg|
dt| jdd d |  |rs|  d S d S )NZcapturemanagerz  z{step} {scope} {fixture}   r   )stepscopeZfixturer   c                 s   s    | ]	}|d kr|V  qdS )r   Nr   ).0argr   r   r   	<genexpr>U   s    z'_show_fixture_action.<locals>.<genexpr>z (fixtures used: {})z, r   [*   )maxsize])ZpluginmanagerZ	getpluginZsuspend_global_captureZget_terminal_writerlinelistreversedr   indexZ_scopewriteformatljustr&   upperargnamesortedargnamesjoinr   r   r   flushZresume_global_capture)r   r   r#   ZcapmanZtwZscope_indentdepsr   r   r   r    @   s0   
r    )Ztryfirstc                 C   s   | j jrd| j _d S )NT)r   Z	setuponlyr   )r   r   r   r   pytest_cmdline_mainb   s   r<   )typingr   r   r   Z_pytest._io.safereprr   Z_pytest.configr   r   Z_pytest.config.argparsingr   Z_pytest.fixturesr	   r
   Z_pytest.scoper   Zpytestr   Zhookimplobjectr!   r"   strr    intr<   r   r   r   r   <module>   sL    



"$