B
    ܇\
                 @   sx   d dl mZ d dl mZ d dl mZ d dlZd dlZdd Zejddd	d
 Zdd Z	dd Z
ejdddd ZdS )    )absolute_import)division)print_functionNc             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)parsergroup r
   0lib/python3.7/site-packages/_pytest/setuponly.pypytest_addoption
   s    
r   T)Zhookwrapperc             c   sd   d V  |j }|jjr`t|drV| jrNt| jr>| |j| _qV| j|j | _n|j| _t	| d d S )NparamSETUP)
configoption	setupshowhasattrZidscallabler   cached_paramZparam_index_show_fixture_action)
fixturedefrequestr   r
   r
   r   pytest_fixture_setup   s    

r   c             C   s6   t | dr2| jj}|jjr2t| d t | dr2| `d S )NZcached_resultZTEARDOWNr   )r   _fixturemanagerr   r   r   r   r   )r   r   r
   r
   r   pytest_fixture_post_finalizer,   s    


r   c             C   s   | j j}|jd}|r,|  | \}}| }|  |d| j	  |dj
|d| jd  | jd |dkrtdd	 | jD }|r|d

d| t| dr|d
| j |r|  tj| tj| 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>H   s    z'_show_fixture_action.<locals>.<genexpr>z (fixtures used: {})z, r   z[{}])r   r   ZpluginmanagerZ	getpluginZsuspend_global_captureZread_global_captureZget_terminal_writerlinewriteZscopenumformatljustr   upperargnamesortedZargnamesjoinr   r   Zresume_global_capturesysstdoutstderr)r   msgr   ZcapmanouterrZtwZdepsr
   r
   r   r   5   s.    
r   )Ztryfirstc             C   s   | j jrd| j _d S )NT)r   Z	setuponlyr   )r   r
   r
   r   pytest_cmdline_mainU   s    r/   )Z
__future__r   r   r   r)   Zpytestr   Zhookimplr   r   r   r/   r
   r
   r
   r   <module>   s   	 