3
$ßL]ï  ã               @   s`   d dl Z d dlZd dlmZ dd„ Zdd„ Ze jdd�d	d
„ ƒZe jdd„ ƒZe jdd„ ƒZdS )é    N)Úcbookc             C   s    t jddd� dt _t jƒ  d S )NZaggT)Úforce)Ú
matplotlibÚuseÚ_called_from_pytestZ_init_tests)Úconfig© r   úC/tmp/pip-install-edjban26/matplotlib/matplotlib/testing/conftest.pyÚpytest_configure   s    r
   c             C   s
   dt _d S )NF)r   r   )r   r   r   r	   Úpytest_unconfigure   s    r   T)Zautousec       	   '   c   sJ  ddl m} |ƒ ��, d }| jjdƒ}|d k	rTt|jƒdksDtdƒ‚|j\}tjƒ }d}| jjdƒ}|d k	rŠt|jƒdks‚tdƒ‚|j\}tj	j
ƒ  |d k	rúdd lj}y|j|ƒ W nD tk
rø } z(d	|jƒ krætjd
j||ƒƒ n‚ W Y d d }~X nX tjƒ � tjj|ƒ W d Q R X z
d V  W d |d k	�r:|j|ƒ X W d Q R X d S )Nr   )Ú_cleanup_cmÚbackendé   z(Marker 'backend' must specify 1 backend.Z_classic_testÚstylez$Marker 'style' must specify 1 style.Zcairoz$Failed to switch to backend {} ({}).)Zmatplotlib.testing.decoratorsr   ÚnodeÚget_closest_markerÚlenÚargsÚAssertionErrorr   Úget_backendZtestingÚsetupZmatplotlib.pyplotZpyplotZswitch_backendÚImportErrorÚlowerÚpytestÚskipÚformatr   Z(_suppress_matplotlib_deprecation_warningr   r   )	Úrequestr   r   Zbackend_markerZprev_backendr   Zstyle_markerZpltÚexcr   r   r	   Úmpl_test_settings   s>    





r   c          	   c   sR   | j jdƒj\}|d kr"| jdƒ}| j}tj|j||fd�� d V  W d Q R X d S )NÚbaseline_images)Ú
parameters)r   r   r   ZgetfixturevalueÚfunctionr   Z_setattr_cmÚ__wrapped__)r   Ú	extensionr   Úfuncr   r   r	   Úmpl_image_comparison_parameters>   s    

r%   c              C   s:   t jdƒ} yddlm} |ƒ  W n tk
r4   Y nX | S )z'Fixture to import and configure pandas.Zpandasr   )Ú deregister_matplotlib_converters)r   ZimportorskipZpandas.plottingr&   r   )ÚpdZ
deregisterr   r   r	   r'   T   s    

r'   )	r   r   r   r
   r   Zfixturer   r%   r'   r   r   r   r	   Ú<module>   s   -