a 4dg@sldZddlZddlZddlZejejeZ ddZ e ddfddZ d dd Z e 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. NcCs"t|D]}|dvr dSq dS)N)z __init__.pyz __init__.pycTF)oslistdir)pathnamer3/usr/local/lib/python3.9/tkinter/test/runtktests.py is_packagesrTc #sdt|D]\}}}t|D]}|ddkr ||q t|r|r|t|ttjddd}|rx||vrxqtfdd|}|D]J}z(t d||dt fd VWqt j j y|r҂Yq0qqdS) 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/cs|do|S)NZtest_) startswithendswith)xZpy_extrr)z#get_tests_modules..z.%s.%sz tkinter.test)rwalklistremoverlensepreplacefilter importlib import_moduletestsupportZResourceDenied) Zbasepathguipackagesdirpathdirnames filenamesdirnameZpkg_namerrrrget_tests_moduless,    "   r"ccsXg}|r|d|r |dt||dD]&}|D]}t||dD] }|VqDq4q,dS)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)rrrN)appendr"getattr)textrrattrsmoduleattrrrrr get_tests5s  r)__main__)TTN)__doc__rrZ test.supportrrabspathr!__file__Z this_dir_pathrr"r)__name__rZ run_unittestrrrrs