a
    
¼3jš  ã                   @   s¤   d Z ddlZddlZddlZddlZddlmZ ej 	ej 
ej 
ej 
ej 
e¡¡¡¡¡Zej ed¡Zej ed¡Zddd„Zejdd	„ ƒZd
d„ Zdd„ ZdS )z=Support functions for testing scripts in the Tools directory.é    N)ÚsupportZToolsÚscriptsc                 C   s<   | rt j t| ¡}nd} t}t j |¡s8t | › d¡‚d S )Nr   z directory could not be found)ÚosÚpathÚjoinÚtoolsdirÚ
scriptsdirÚisdirÚunittestZSkipTest)ZtoolÚtooldir© r   úT/www/server/python_manager/versions/3.9.10/lib/python3.9/test/test_tools/__init__.pyÚskip_if_missing   s    r   c                 g   sJ   t jjt| g|¢R Ž }t |¡}|V  W d   ƒ n1 s<0    Y  d S ©N)r   r   r   r   r   ÚDirsOnSysPath)ÚnameÚsubdirsr   Úcmr   r   r   Úimports_under_tool   s    r   c                 C   s8   t  t¡ t | ¡W  d   ƒ S 1 s*0    Y  d S r   )r   r   r   Ú	importlibÚimport_module)Ztoolnamer   r   r   Úimport_tool    s    r   c                  G   s   t jtj t¡g| ¢R Ž S r   )r   Zload_package_testsr   r   ÚdirnameÚ__file__)Úargsr   r   r   Ú
load_tests$   s    r   )N)Ú__doc__Ú
contextlibr   Zos.pathr   r
   Útestr   r   Únormpathr   r   Zbasepathr   r   r   r   Úcontextmanagerr   r   r   r   r   r   r   Ú<module>   s*   
ÿÿÿÿ
	
