o
    h                     @   sh   d dl Z 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)_apic                 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   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\(\):ImportWarningaggT)force)addinivalue_line
matplotlibuse_called_from_pytest_init_tests)configkeyvalue r   o/var/www/html/construction_image-detection-poc/venv/lib/python3.10/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)autousec                 c   s   ddl m} |  d }| jd}t }|d urFt|jdks&J d|j\}|j	dd}|
 drFtd	d
 dD rFtd tj  t J |d urdd lm} z|| W n( ty } zd|
 v sq|r~td| d| d n W Y d }~nd }~ww tjddg W d    n1 sw   Y  zd V  W |d ur|d t| n|d ur|d t| w w W d    d S 1 sw   Y  d S )Nr   )_cleanup_cmbackend   z(Marker 'backend' must specify 1 backend.skip_on_importerrorFqt5c                 s   s    | ]	}t j|V  qd S )N)sysmodulesget).0kr   r   r   	<genexpr>6   s    z$mpl_test_settings.<locals>.<genexpr>)PyQt4PySidezQt4 binding already importedcairozFailed to switch to backend z (z).classic_classic_test_patchall)matplotlib.testing.decoratorsr   nodeget_closest_markerr	   get_backendlenargskwargsr   lower
startswithanypytestskiptestingsetupr   'suppress_matplotlib_deprecation_warningmatplotlib.pyplotpyplotswitch_backendImportErrorstyler
   close)requestr   r   backend_markerprev_backendr   pltexcr   r   r   mpl_test_settings$   s`   


	


"r@   c                  C   s8   t d} zddlm} |  W | S  ty   Y | S w )a  
    Fixture to import and configure pandas. Using this fixture, the test is skipped when
    pandas is not installed. Use this fixture instead of importing pandas in test files.

    Examples
    --------
    Request the pandas fixture by passing in ``pd`` as an argument to the test ::

        def test_matshow_pandas(pd):

            df = pd.DataFrame({'x':[1,2,3], 'y':[4,5,6]})
            im = plt.figure().subplots().matshow(df)
            np.testing.assert_array_equal(im.get_array(), df)
    pandasr   ) deregister_matplotlib_converters)r0   importorskippandas.plottingrB   r8   )pd
deregisterr   r   r   rE   S   s   
rE   c                  C   s   t d} | S )a  
    Fixture to import xarray so that the test is skipped when xarray is not installed.
    Use this fixture instead of importing xrray in test files.

    Examples
    --------
    Request the xarray fixture by passing in ``xr`` as an argument to the test ::

        def test_imshow_xarray(xr):

            ds = xr.DataArray(np.random.randn(2, 3))
            im = plt.figure().subplots().imshow(ds)
            np.testing.assert_array_equal(im.get_array(), ds)
    xarray)r0   rC   )xrr   r   r   rH   m   s   
rH   )
r0   r   r	   r   r   r   fixturer@   rE   rH   r   r   r   r   <module>   s    

.
