o
    2g                     @   s   d dl Z d dlZd dlZd dl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 eG dd dZded	efd
dZddddededede
e ded	efddZdS )    N)	dataclass)Path)Iterable)test_data_prefixc                   @   s.   e Zd ZU eed< eed< eed< eed< dS )PytestResultinputinput_updatedstdoutstderrN)__name__
__module____qualname__str__annotations__ r   r   N/home/garg/my-data/venv/lib/python3.10/site-packages/mypy/test/meta/_pytest.pyr      s
   
 r   sreturnc                 C   s   t |  S )N)textwrapdedentlstrip)r   r   r   r   dedent_docstring   s   r   checkz&mypy/test/testcheck.py::TypeCheckSuite)data_file_prefixpytest_node_prefix
data_suiter   r   
extra_argsmax_attemptsc                C   sx  t t}|jj}|| dt  d }| rJ t| } z||  | d|j }t	j
dddddg||}t|}	t|d	 d
d
D ][}
td|	  tj|dd|d}|jdkr_ nCd}|j  D ]}t| d|  dt| }qhd}|j  D ]}t| d|  dt| }qtd|j d|
 d qFt| | |j |j dW |  S |  w )z
    Runs a suite of data test cases through pytest until either tests pass
    or until a maximum number of attempts (needed for incremental tests).

    :param data_suite: the actual "suite" i.e. the contents of a .test file
    z-meta-z.testz::z-mpytestz-n0z-s   z>> TF)capture_outputr   cwdr   zNESTED PYTEST STDOUTz:  zNESTED PYTEST STDERRz
Exit code z (z attempts remaining))r   r   r	   r
   )r   r   parentuuiduuid4existsr   
write_textnamesys
executableshlexjoinrangeprint
subprocessrun
returncoder	   decode
splitlineslenr
   r   	read_textunlink)r   r   r   r   r   p_test_datap_rootptest_nodeidcmdiprocprefixliner   r   r   run_pytest_data_suite   s>   


rB   )r-   r1   r+   r   r&   dataclassesr   pathlibr   typingr   mypy.test.configr   r   r   r   intrB   r   r   r   r   <module>   s6    