a
    /§»a  ã                   @   s   d dl mZ d dl mZ d dl mZ d dl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 eddœdd„Zejdd�ee eed dœdd„ƒZee ddœdd„Zee eddœdd„Zejdd�eeeee	f  dœdd„ƒZdS )é    )Ú	Generator)ÚOptional)ÚUnionN)Úsaferepr)ÚConfig)ÚExitCode)ÚParser)Ú
FixtureDef)Ú
SubRequest)Ú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   úK/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/_pytest/setuponly.pyÚpytest_addoption   s    
üür   T)Zhookwrapper)NNN)Ú
fixturedefÚrequestr   c                 c   s`   d V  |j jjr\t|dƒrR| jrFt| jƒr8|  |j¡}qL| j|j }n|j}|| _t	| dƒ d S )NÚparamÚSETUP)
ÚconfigÚoptionÚ	setupshowÚhasattrÚidsÚcallabler   Zparam_indexÚcached_paramÚ_show_fixture_action)r   r   r   r   r   r   Úpytest_fixture_setup   s    


r    )r   r   c                 C   s6   | j d ur2| jj}|jjr2t| dƒ t| dƒr2| `d S )NZTEARDOWNr   )Zcached_resultÚ_fixturemanagerr   r   r   r   r   r   )r   r   r   r   r   Úpytest_fixture_post_finalizer2   s    


r"   )r   Úmsgr   c                 C   sÚ   | j j}|j d¡}|r | ¡  | ¡ }| ¡  | d| j ¡ | 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�¡¡ | ¡  |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>M   ó    z'_show_fixture_action.<locals>.<genexpr>z (fixtures used: {})z, r   z[{}]é*   )Úmaxsize)r!   r   ZpluginmanagerZ	getpluginZsuspend_global_captureZget_terminal_writerÚlineÚwriteZscopenumÚformatÚljustr&   ÚupperÚargnameÚsortedÚargnamesÚjoinr   r   r   ÚflushZresume_global_capture)r   r#   r   ZcapmanZtwÚdepsr   r   r   r   ;   s.    ýÿ
r   )Ztryfirst)r   r   c                 C   s   | j jrd| j _d S )NT)r   Z	setuponlyr   )r   r   r   r   Úpytest_cmdline_mainZ   s    r8   )Útypingr   r   r   ZpytestZ_pytest._io.safereprr   Z_pytest.configr   r   Z_pytest.config.argparsingr   Z_pytest.fixturesr	   r
   r   ZhookimplÚobjectr    r"   Ústrr   Úintr8   r   r   r   r   Ú<module>   s$   
þ	
