U
    `»{jê  ã                   @  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Zdddœdd„Zejdd�ddddœdd„ƒZddddœdd„Zdddddœdd„Zejdd�dd d!œd"d#„ƒZd
S )$é    )Úannotations)Ú	Generator)Úsaferepr)ÚConfig)ÚExitCode)ÚParser)Ú
FixtureDef)Ú
SubRequest)ÚScopeNr   ÚNone)Ú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   úP/var/www/html/bwave/python/venv/lib/python3.8/site-packages/_pytest/setuponly.pyÚpytest_addoption   s    
üür   T)ÚwrapperzFixtureDef[object]r	   zGenerator[None, object, object])Ú
fixturedefÚrequestr   c              
   c  sl   z
d V W ¢S |j jjrft|dƒrX| jrLt| jƒr>|  |j¡}qR| j|j }n|j}|| _t	| |j dƒ X d S )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  s8   | j d k	r4|j}|jjr4t| |jdƒ t| dƒr4| `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   Ústr)r   r   Úmsgr   c                 C  sæ   |j  d¡}|r| ¡  | ¡ }| ¡  tttƒƒ | j	¡}| 
d| ¡ | 
dj| d¡| jd  ¡ | jd�¡ |dkr¨tdd	„ | jD ƒƒ}|r¨| 
d
 d |¡¡¡ t| dƒrÎ| 
dt| jdd�› d�¡ | ¡  |râ| ¡  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    @   s.    ýÿ
r    )Ztryfirstzint | ExitCode | None)r   r   c                 C  s   | j jrd| j _d S )NT)r   Z	setuponlyr   )r   r   r   r   Úpytest_cmdline_mainb   s    r=   )Ú
__future__r   Útypingr   Z_pytest._io.safereprr   Z_pytest.configr   r   Z_pytest.config.argparsingr   Z_pytest.fixturesr   r	   Z_pytest.scoper
   Zpytestr   Zhookimplr!   r"   r    r=   r   r   r   r   Ú<module>   s    
"
