o
    d                     @   s  d dl Z ddlmZ G dd dZz&d dlmZmZmZmZm	Z	 d dl
mZ d dlmZmZmZ d dlZd	ZW n eyT   eZeZeZ	eZeZeZeZeZeZd
ZY nw dd Ze jjdd Ze jd	d	ddd Ze jdefddZe jdefddZe jde	fddZe jdefddZe jdefddZe jdefddZe jdefdd Z e jdefd!d"Z!e jdefd#d$Z"e jdefd%d&Z#e jd'd( Z$dS ))    N   )SELENIUM_GRID_DEFAULTc                   @   s   e Zd Zdd ZdS )MissingDashTestingc                 K   s   t d)NzQdash[testing] was not installed. Please install to use the dash testing fixtures.)	Exception)selfkwargs r   X/var/www/html/visualizacion-main/env/lib/python3.10/site-packages/dash/testing/plugin.py__init__   s   zMissingDashTesting.__init__N)__name__
__module____qualname__r
   r   r   r   r	   r      s    r   )ThreadedRunnerProcessRunnerRRunnerJuliaRunnerMultiProcessRunner)Browser)DashCompositeDashRCompositeDashJuliaCompositeTFc                 C   s   t sd S | dd}|jddddd |jdd	d
d |jddtdd |jdd	dd |jddddd |jdddd |jdd	dd d S )NDashzDash Integration Testsz--webdriver)ChromeFirefoxr   z"Name of the selenium driver to use)choicesdefaulthelpz--remote
store_truez$instruct pytest to use selenium grid)actionr   z--remote-urlstorez>set a different selenium grid remote url if other than default)r   r   r   z
--headlessz%set this flag to run in headless modez--percy-assetsztests/assetsz3configure how Percy will discover your app's assetsz--nopercyfinalizestore_falsez3set this flag to control percy finalize at CI levelz--pausezGpause using pdb after opening the test app, so you can interact with it)
_installedgetgroup	addoptionr   )parserdashr   r   r	   pytest_addoption,   sJ   
r&   c                 C   s:   t sd S ddlm} t| dd }|d u r| j}|| d S )Nr   )newhooksadd_hookspecs)r!   dash.testingr'   getattraddhooks)pluginmanagerr'   methodr   r   r	   pytest_addhooks\   s   r.   )tryfirsthookwrapperc                 c   s    d V }t sd S | }|jdkrE|jrGt| drI| j D ],\}}z|dv r-|| j W q t	yD } z
t
| W Y d }~qd }~ww d S d S d S d S )Ncallfuncargs>   dashrdashjldash_brdash_duo)r!   
get_resultwhenfailedhasattrr2   itemstake_snapshotnamer   print)itemr1   outcomerepr=   fixtureer   r   r	   pytest_runtest_makereportj   s"   rD   returnc                  c   4    t  } | V  W d   dS 1 sw   Y  dS )z*Start a local dash server in a new thread.N)r   starterr   r   r	   dash_thread_server      "rI   c                  c   rF   )z=Start a Dash server with subprocess.Popen and waitress-serve.N)r   rG   r   r   r	   dash_process_server   rJ   rK   c                  c   4    t  } | V  W d    d S 1 sw   Y  d S N)r   rG   r   r   r	   dash_multi_process_server      "rN   c                  c   rL   rM   )r   rG   r   r   r	   dashr_server   rO   rP   c                  c   rL   rM   )r   rG   r   r   r	   dashjl_server   rO   rQ   c                 c   s    t | jd| jd| jd| jd| jj |dj| jd| jd| jdd		}|V  W d    d S 1 sAw   Y  d S 
N	webdriverremote
remote_urlheadlessdownloadpercy_assetsnopercyfinalizepause)	browserrT   rU   rV   optionsdownload_pathpercy_assets_rootpercy_finalizerZ   )r   config	getoptionhookpytest_setup_optionsmkdirstrpath)requesttmpdirr[   r   r   r	   r5      s   









"r5   c                 c       t || jd| jd| jd| jd| jj |dj| jd| jd| jdd	
}|V  W d    d S 1 sBw   Y  d S rR   r   r`   ra   rb   rc   rd   re   )rf   rI   rg   dcr   r   r	   r6          








"r6   c                 c   rh   rR   ri   )rf   rN   rg   rj   r   r   r	   dash_duo_mp   rk   rl   c                 c   rh   rR   )r   r`   ra   rb   rc   rd   re   )rf   rP   rg   rj   r   r   r	   r3      rk   r3   c                 c   rh   rR   )r   r`   ra   rb   rc   rd   re   )rf   rQ   rg   rj   r   r   r	   r4      rk   r4   c                  C   s   ddl m}  |  S )Nr   DiskcacheLongCallbackManager)dash.long_callbackrn   rm   r   r   r	   diskcache_manager   s   rp   )%pytestconstsr   r    dash.testing.application_runnersr   r   r   r   r   dash.testing.browserr   dash.testing.compositer   r   r   dash_testing_stubr!   ImportErrorr&   markr/   r.   hookimplrD   rB   rI   rK   rN   rP   rQ   r5   r6   rl   r3   r4   rp   r   r   r   r	   <module>   s`   0

