o
    g                     @   sp   d Z ddlZddlZddlZejejeZ	dd Z
e	ddfddZddd	Zed
kr6ejje   dS dS )z
Use this module to get and run all tk tests.

tkinter tests should live in a package inside the directory where this file
lives, like test_tkinter.
Extensions also should live in packages following the same rule as above.
    Nc                 C   s"   t | D ]	}|dv r dS qdS )N)z__init__.pyz__init__.pycTF)oslistdir)pathname r   M/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/tkinter/test/runtktests.py
is_package   s
   r   Tc           	   
   #   s    d t | D ]e\}}}t|D ]}|d dkr|| qt|rm|rm|t| tt j d dd}|r=||vr=qt fdd|}|D ]$}zt	
d||dt   f d	V  W qH tjjyl   |rj Y qHw qdS )
zThis will import and yield modules whose names start with test_
    and are inside packages found in the path starting at basepath.

    If packages is specified it should contain package names that
    want their tests collected.
    z.pyr   .N/c                    s   |  do	|  S )NZtest_)
startswithendswith)xZpy_extr   r   <lambda>)   s    z#get_tests_modules.<locals>.<lambda>z.%s.%sztkinter.test)r   walklistremover   lensepreplacefilter	importlibimport_moduletestsupportZResourceDenied)	Zbasepathguipackagesdirpathdirnames	filenamesdirnamepkg_namer   r   r   r   get_tests_modules   s8   
"

r"   c                 c   sZ    g }| r
| d |r| d t||dD ]}|D ]}t||dD ]}|V  q#qqdS )zYield all the tests in the modules found by get_tests_modules.

    If nogui is True, only tests that do not require a GUI will be
    returned.Ztests_noguiZ	tests_gui)r   r   r   N)appendr"   getattr)textr   r   Zattrsmoduleattrr   r   r   r   	get_tests5   s   

r(   __main__)TTN)__doc__r   r   Ztest.supportr   r   abspathr    __file__Zthis_dir_pathr   r"   r(   __name__r   Zrun_unittestr   r   r   r   <module>   s    
 