B
    `                 @   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   Y/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/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 k	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rt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   s    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    r7   )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   intr7   r   r   r   r   <module>   s"   
	
