File: //usr/local/lib/python3.7/tkinter/test/__pycache__/runtktests.cpython-37.opt-1.pyc
B
��g� � @ sl d Z ddlZddlZddlZej�ej�e��Z dd� Z
e ddfdd�Zddd �Ze
d
krhejje� � dS )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$ xt �| �D ]}|dkrdS qW dS )N)z__init__.pyz__init__.pycTF)�os�listdir)�path�name� r �3/usr/local/lib/python3.7/tkinter/test/runtktests.py�
is_package s r Tc
# s� d� x�t �| �D ]�\}}}x&t|�D ]}|d dkr$|�|� q$W t|�r|r|t| �tt j� d� �dd�}|r~||kr~qt� fdd�|�}xT|D ]L}y(t �
d||dt� � � f d �V W q� tjj
k
r� |r܂ Y q�X q�W qW dS )
z�This 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 )NZtest_)�
startswith�endswith)�x)�py_extr r �<lambda>) � z#get_tests_modules.<locals>.<lambda>z.%s.%sztkinter.test)r �walk�list�remover �len�sep�replace�filter� importlib�
import_module�test�supportZResourceDenied) Zbasepath�gui�packages�dirpathZdirnames� filenames�dirnameZpkg_namer r )r r �get_tests_modules s( "
r! c c sd g }| r|� d� |r |� d� x>t||d�D ].}x(|D ] }xt||d�D ]
}|V qJW q8W q.W dS )z�Yield 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.Ztests_noguiZ tests_gui)r r r N)�appendr! �getattr)�textr r Zattrs�module�attrr r r r � get_tests5 s
r'