a
    s=ic9                     @   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   l/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/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 urt|jdksLJ d|j\}|j	dd}|
 drtd	d
 dD rtd ddg}| jd}|d urt|jdksJ dtjddddd |j\}tj  t  |d urbdd lm} z|| W nP ty` }	 z6d|
 v s6|rJtd||	 n W Y d }	~	n
d }	~	0 0 tj| W d    n1 s0    Y  zd V  W t| nt| 0 W d    n1 s0    Y  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       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kwargsr   lower
startswithanypytestskipr   Zwarn_deprecated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&   sT    





,r3   r   none)r!   c                 c   sf   | j dj\}|d u r"| d}| j}tj|j||fd d V  W d    n1 sX0    Y  d S )Nbaseline_images)
parameters)r"   r#   r&   Zgetfixturevaluefunctionr   Z_setattr_cm__wrapped__)r1   	extensionr5   funcr   r   r   mpl_image_comparison_parameters\   s    
r;   c                  C   s8   t d} zddlm} |  W n ty2   Y n0 | 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fixturer3   
deprecatedr;   r>   r?   r   r   r   r   <module>   s   

5
