o
    g                     @   s   d Z ddlZddlZddlZddlZddlm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)support)import_helperZToolsscriptsc                 C   s<   | r
t jt| }nd} t}t j|st|  dd S )Nr   z directory could not be found)ospathjointoolsdir
scriptsdirisdirunittestZSkipTest)Ztooltooldir r   N/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/test/test_tools/__init__.pyskip_if_missing   s   r   c                 g   sN    t jjt| g|R  }t|}|V  W d    d S 1 s w   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w   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   r   )__doc__
contextlibr   Zos.pathr   r   testr   Ztest.supportr   r   normpathr   r   Zbasepathr   r   r	   r   contextmanagerr   r   r   r   r   r   r   <module>   s.    

	
