3
d                  @   s   d dl Z d dlZd dlmZ d dlZd dlZd dlZejdZdZ	ddddgZ
ejjejjdddejjde
dd Zejjejjddddd ZdS )    N)PathmypyFmypy-plugin.inisuccess_plugin.pysuccess-plugin.txtfail_plugin.pyfail-plugin.txtmypy-default.inisuccess_no_plugin.pysuccess-no-plugin.txtfail_no_plugin.py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j| ttj}ttjjjj}dtjkrJ|j	dt
| t|}|d|   }	|d|  }
|d|  }||  }|| }tjt
|	| tjt
|
| d}d}d	}|j }|d
| d d   }t
|dt
|dt
|dg}tddj|  |j|}|\}}}djdd |jdD j }tjdd|}trb|d k	rb|j| n|j |j ks|t|||kst||kstd S )Nr   )apiz--pyargsZ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 j |jd dd qS )z.py:r   N)joinsplit).0line r   N/var/www/html/virt/lib64/python3.6/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argvZsetenvstrshutilcopy	read_textprintr   runr   stripresubGENERATE
write_textAssertionError)Zconfig_filenameZpython_filenameZoutput_filenameZtmpdirZmonkeypatchZmypy_apiroot_dirZthinc_root_dirZtmpdir_pathZfull_config_pathZfull_module_pathZfull_output_pathZfull_tmp_config_pathZfull_tmp_module_pathZexpected_outZexpected_errZexpected_returncode	cache_dircommandZactual_resultZ
actual_outZ
actual_errZactual_returncoder   r   r   test_mypy_results   sJ    




r2   c               C   s   t  s
tdS )z>
    Makes sure we don't accidentally leave generation on
    N)r,   r.   r   r   r   r   test_generation_is_disabledT   s    r3   )r   r   r   )r   r   r   )r	   r
   r   )r	   r   r   )r   r*   pathlibr   r$   r!   ZpytestZimportorskipr   r,   ZcasesmarkZskipifr   endswithZparametrizer2   r3   r   r   r   r   <module>   s    
;