U
    d»{j9  ã                   @   sˆ   d dl Z d dlZd dlZd dlmZmZ dd„ Zdd„ Ze jdd�d	d
„ ƒZe jej	ddd�dd„ ƒƒZ
e jdd„ ƒZe jdd„ ƒZdS )é    N)Ú_apiÚcbookc                 C   s:   dD ]\}}|   ||¡ qtjddd� dt_t ¡  d S )N)	)Úmarkersz*flaky: (Provided by pytest-rerunfailures.))r   z&timeout: (Provided by pytest-timeout.))r   z6backend: Set alternate Matplotlib backend temporarily.)r   z?style: Set alternate Matplotlib style temporarily (deprecated).)r   z3baseline_images: Compare output against references.)r   z.pytz: Tests that require pytz to be installed.)ÚfilterwarningsÚerror)r   z?ignore:.*The py23 module has been deprecated:DeprecationWarning)r   z]ignore:DynamicImporter.find_spec\(\) not found; falling back to find_module\(\):ImportWarningZaggT)Úforce)Zaddinivalue_lineÚ
matplotlibÚuseÚ_called_from_pytestZ_init_tests)ÚconfigÚkeyÚvalue© r   úZ/var/www/html/bwave/python/venv/lib/python3.8/site-packages/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   sœ  ddl m} |ƒ ��~ d }| j d¡}t ¡ }|d k	rŒt|jƒdksLtdƒ‚|j\}|j	 
dd¡}| ¡  d¡rŒtd	d
„ dD ƒƒrŒt d¡ ddg}| j d¡}|d k	rØt|jƒdks¾tdƒ‚tjddddd� |j\}tj ¡  t ¡ �† |d k	�r`dd lm} z| |¡ W nN tk
�r^ }	 z.d| ¡ k�s8|�rLt d ||	¡¡ n‚ W 5 d }	~	X Y nX tj |¡ W 5 Q R X z
d V  W 5 t |¡ X W 5 Q R X d S )Nr   )Ú_cleanup_cmÚbackendé   z(Marker 'backend' must specify 1 backend.Úskip_on_importerrorFZqt5c                 s   s   | ]}t j |¡V  qd S )N)ÚsysÚmodulesÚget)Ú.0Úkr   r   r   Ú	<genexpr>8   s     z$mpl_test_settings.<locals>.<genexpr>)ZPyQt4ZPySidezQt4 binding already importedZclassicZ_classic_test_patchÚstylez$Marker 'style' must specify 1 style.ú3.5zpytest markerz@mpl.style.context(...))ÚnameÚobj_typeÚalternativeZcairoz$Failed to switch to backend {} ({}).)Zmatplotlib.testing.decoratorsr   ÚnodeÚget_closest_markerr   Úget_backendÚlenÚargsÚAssertionErrorÚkwargsr   ÚlowerÚ
startswithÚanyÚpytestÚskipr   Zwarn_deprecatedZtestingÚsetupZ'suppress_matplotlib_deprecation_warningZmatplotlib.pyplotZpyplotZswitch_backendÚImportErrorÚformatr   r	   )
Úrequestr   r   Zbackend_markerZprev_backendr   r   Zstyle_markerZpltÚexcr   r   r   Úmpl_test_settings&   sX    
ÿ ÿ
ÿ
ÿ


 ÿ
r2   r   Únone)r    c              	   c   sR   | j  d¡j\}|d kr"|  d¡}| j}tj|j||fd�� d V  W 5 Q R X d S )NÚbaseline_images)Ú
parameters)r!   r"   r%   ZgetfixturevalueÚfunctionr   Z_setattr_cmÚ__wrapped__)r0   Ú	extensionr4   Úfuncr   r   r   Úmpl_image_comparison_parameters\   s    
ÿr:   c                  C   s:   t  d¡} z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+   ÚimportorskipZpandas.plottingr;   r.   )ÚpdZ
deregisterr   r   r   r=   s   s    

r=   c                  C   s   t  d¡} | S )zFixture to import xarray.Zxarray)r+   r<   )Úxrr   r   r   r>   €   s    
r>   )r+   r   r   r   r   r   r   Zfixturer2   Ú
deprecatedr:   r=   r>   r   r   r   r   Ú<module>   s   

5
