o
    #if                  
   @   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 )
N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)getgroup	addoption)r   group r   J/var/www/html/corbot_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hasattridscallabler   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 )NTEARDOWNr$   )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 )Ncapturemanagerz  z{step} {scope} {fixture}   r   )stepscope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])pluginmanager	getpluginsuspend_global_captureget_terminal_writerlinelistreversedr   index_scopewriteformatljustr.   upperargnamesortedargnamesjoinr    r   r$   flushresume_global_capture)r   r   r*   capmantwscope_indentdepsr   r   r   r%   @   s0   
r%   )tryfirstc                 C   s   | j jrd| j _d S )NT)r   	setuponlyr   )r   r   r   r   pytest_cmdline_mainb   s   rP   )typingr   r   r   _pytest._io.safereprr   _pytest.configr   r   _pytest.config.argparsingr   _pytest.fixturesr	   r
   _pytest.scoper   pytestr   hookimplobjectr&   r)   strr%   intrP   r   r   r   r   <module>   sL    



"$