o
    i                      @   s   d dl Z d dlZd dlZd dlZd dlmZ d dlZedZdZ	g dZ
ejjejdddejd	e
d
d Zejjejddddd ZdS )    N)PathmypyF))mypy-plugin.inizsuccess_plugin.pyzsuccess-plugin.txt)r   zfail_plugin.pyzfail-plugin.txt)mypy-default.inizsuccess_no_plugin.pyzsuccess-no-plugin.txt)r   zfail_no_plugin.pyzfail-no-plugin.txtz.pyzNon-compiled mypy is too slow)reasonz/config_filename,python_filename,output_filenamec                 C   s  ddl m} t| ttj}ttjjjj}dtjvr%|	dt
| t|}|d|   }	|d|  }
|d|  }||  }|| }tt
|	| tt
|
| d}d}d	}| }|d
| d d   }t
|dt
|dt
|dg}tdd|  ||}|\}}}ddd |dD  }tdd|}tr|d ur|| n| | ksJ |||ksJ ||ksJ d S )Nr   )apiz--pyargsMYPYPATHzconfigs/zmodules/zoutputs/    z.mypy_cache/test-z--config-filez--cache-dirz--show-error-codesz
Executing: mypy  
c                 S   s(   g | ]}|rd  |d dd qS )z.py:r
   N)joinsplit).0line r   N/home/ubuntu/.local/lib/python3.10/site-packages/thinc/tests/mypy/test_mypy.py
<listcomp>G   s   ( z%test_mypy_results.<locals>.<listcomp>z\n\s*\nz\n)r   r   oschdirr   __file__parentsysargvsetenvstrshutilcopy	read_textprintr   runr   stripresubGENERATE
write_text)config_filenamepython_filenameoutput_filenametmpdirmonkeypatchmypy_apiroot_dirthinc_root_dirtmpdir_pathfull_config_pathfull_module_pathfull_output_pathfull_tmp_config_pathfull_tmp_module_pathexpected_outexpected_errexpected_returncode	cache_dircommandactual_result
actual_out
actual_erractual_returncoder   r   r   test_mypy_results   sT   




r>   c                   C   s   t rJ dS )z>
    Makes sure we don't accidentally leave generation on
    N)r%   r   r   r   r   test_generation_is_disabledT   s   r?   )r   r#   r   r   pathlibr   pytestimportorskipr   r%   casesmarkskipifr   endswithparametrizer>   r?   r   r   r   r   <module>   s$    
: