��Qc@s�dZddlZddlZddlZddlZddlZejjejj e
��Zda
d�Zd�Zeedd�Zeedd�Zedkr�dgej_ejje��ndS( s�
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.
i�Nc
sFtdkr*tatjdkr�dlm}m�m}m }ddl
m}|j|d��}|j
�dkr�daq'd|f�fd ��Y}|�}||�}|j|�dks�|j|�dkr'd
aq'q*ddl}y|j�Wq*|jk
r&} d| aq*XntrBtjt��ndS(
s)Check that Tk is installed and available.tdarwini�(tcdlltc_inttpointert Structure(tfind_librarytApplicationServicesis&cannot run without OS X window managertProcessSerialNumbercs eZd�fd�fgZRS(t
highLongOfPSNtlowLongOfPSN(t__name__t
__module__t_fields_((R(s,/sys/lib/python2.7/lib-tk/test/runtktests.pyR(s s#cannot run without OS X gui processNstk not available: %s(t_tk_unavailabletNonetFalsetsystplatformtctypesRRRRtctypes.utilRtLoadLibrarytCGMainDisplayIDtGetCurrentProcesstSetFrontProcesstTkintertButtontTclErrortunittesttSkipTest(
RRRRtapp_servicesRtpsntpsn_pRtmsg((Rs,/sys/lib/python2.7/lib-tk/test/runtktests.pytcheck_tk_availabilitys," cCs.x'tj|�D]}|dkrtSqWtS(Ns__init__.pys__init__.pycs
__init.pyo(s__init__.pys__init__.pycs
__init.pyo(tostlistdirtTrueR(tpathtname((s,/sys/lib/python2.7/lib-tk/test/runtktests.pyt
is_package<sc #s-d�x tj|�D]\}}}x4t|�D]&}|ddkr2|j|�q2q2Wt|�r|r|t|�ttj�jdd�}|r�||kr�qnt�fd�|�}x[|D]P}y$t j
d|t�� |�VWq�tjj
k
r|r�qq�Xq�WqqWdS(s�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 colleted.
s.pyit.t/cs|jd�o|j��S(Nttest_(t
startswithtendswith(tx(tpy_ext(s,/sys/lib/python2.7/lib-tk/test/runtktests.pyt<lambda>Vss.%sN(R"twalktlisttremoveR'tlentseptreplacetfiltert importlibt
import_modulettestttest_supporttResourceDenied( tbasepathtguitpackagestdirpathtdirnamest filenamestdirnametpkg_nameR&((R.s,/sys/lib/python2.7/lib-tk/test/runtktests.pytget_tests_modulesBs&)
ccs�g}|r|jd�n|r2|jd�nxPtd|d|�D]9}x0|D](}xt||d�D]}|VqnWqUWqHWdS(s�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.ttests_noguit tests_guiR=R>N((tappendRDtgetattr(ttextR=R>tattrstmoduletattrR9((s,/sys/lib/python2.7/lib-tk/test/runtktests.pyt get_testsas
t__main__R=(t__doc__R"RRR7ttest.test_supportR9R%tabspathRBt__file__t
this_dir_pathRR
R!R'R$RDRMR
R:t
use_resourcestrun_unittest(((s,/sys/lib/python2.7/lib-tk/test/runtktests.pyt<module>s )
|