o
    HXîhVe  ã                   @   sè   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	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 d dlmZ d dlmZ d dlmZ d dlmZ ejZG dd	„ d	ejƒZed
krre ¡  dS dS )é    N)Úsupport)Úimport_helper)Ú	os_helper)Úscript_helper)Úsocket_helper)Úwarnings_helperc                   @   sê  e Zd Zedd„ ƒZedd„ ƒZdd„ Zdd„ Zd	d
„ Zdd„ Z	e
 d¡dd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Ze
 eed&ƒd'¡d(d)„ ƒZd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Z d4d5„ Z!d6d7„ Z"d8d9„ Z#d:d;„ Z$d<d=„ Z%d>d?„ Z&d@dA„ Z'dBdC„ Z(dDdE„ Z)dFdG„ Z*dHdI„ Z+dJdK„ Z,dLdM„ Z-G dNdO„ dOƒZ.G dPdQ„ dQƒZ/dRdS„ Z0dTdU„ Z1dVdW„ Z2e
 eedXƒoÏeedYƒdZ¡d[d\„ ƒZ3dld^d_„Z4d`da„ Z5dbdc„ Z6ddde„ Z7dfdg„ Z8dhdi„ Z9djdk„ Z:d]S )mÚTestSupportc                 C   s.   t tjƒ}tjddd| _tjddd| _d S )Nztest.support.warnings_helperz.*used in test_support.*)Zlikeztest.test_supportz!.*You should NOT be seeing this.*)ÚlenÚwarningsÚfiltersr   Zignore_deprecations_fromÚ_warnings_helper_tokenÚ_test_support_token©ÚclsZorig_filter_len© r   ú;/opt/python-3.10.19/usr/lib/python3.10/test/test_support.pyÚ
setUpClass   s   
ÿÿzTestSupport.setUpClassc                 C   s   t tjƒ}t | j| j¡ d S ©N)r	   r
   r   r   Zclear_ignored_deprecationsr   r   r   r   r   r   ÚtearDownClass&   s
   
þzTestSupport.tearDownClassc                 C   sf   	 t jdd}t ¡  t  dt¡ dd„ |D ƒ}W d   ƒ n1 s#w   Y  |  t|ƒd|¡ d S )NT)ÚrecordzYou should NOT be seeing this.c                 S   ó   g | ]}t |jƒ‘qS r   ©ÚstrÚmessage©Ú.0Úwr   r   r   Ú
<listcomp>4   ó    zDTestSupport.test_ignored_deprecations_are_silent.<locals>.<listcomp>r   )r
   Úcatch_warningsr   Z_warn_about_deprecationÚwarnÚDeprecationWarningÚassertEqualr	   )ÚselfZwarning_objsÚmessagesr   r   r   Ú$test_ignored_deprecations_are_silent/   s   ýz0TestSupport.test_ignored_deprecations_are_silentc                 C   s    t  d¡ |  tjt jd¡ d S )NÚftplibÚfoo)r   Úimport_moduleÚassertRaisesÚunittestÚSkipTest©r#   r   r   r   Útest_import_module7   s   
ÿzTestSupport.test_import_modulec                 C   s   t  d¡ d S )Nr&   )r   Zimport_fresh_moduler,   r   r   r   Útest_import_fresh_module<   s   z$TestSupport.test_import_fresh_modulec                 C   s.   |   t | d¡| j¡ |  tjtj| d¡ d S )NÚtest_get_attributer'   )r"   r   Zget_attributer/   r)   r*   r+   r,   r   r   r   r/   ?   s   ÿzTestSupport.test_get_attributezfailing buildbotsc                 C   s   |   t ¡ tj¡ d S r   )r"   r   Zget_original_stdoutÚsysÚstdoutr,   r   r   r   Útest_get_original_stdoutD   s   z$TestSupport.test_get_original_stdoutc                 C   s2   dd l }|  dtj¡ t d¡ |  dtj¡ d S )Nr   Úsched)r3   ÚassertInr0   Úmodulesr   ZunloadÚassertNotIn)r#   r3   r   r   r   Útest_unloadH   s   
zTestSupport.test_unloadc                 C   sX   t tddd}W d   ƒ n1 sw   Y  t t¡ |  tj t¡¡ t t¡ d S )Nr   úutf-8©Úencoding)ÚopenÚTESTFNr   ÚunlinkÚassertFalseÚosÚpathÚexists)r#   Úfr   r   r   Útest_unlinkN   s   ÿ
zTestSupport.test_unlinkc                 C   s`  t jd }tj |d¡}t |¡ t |¡ t  |¡ |  tj |¡¡ t	 
t	dd¡ t  |¡ W d   ƒ n1 s;w   Y  t |¡ t |¡ t |tjtjB ¡ t	 
t	dd¡ t  |¡ W d   ƒ n1 skw   Y  |  tj |¡¡ t |¡ t |¡ t |d¡ t	 
t	dd¡ t  |¡ W d   ƒ n1 s w   Y  |  tj |¡¡ d S )NÚdZsubdirÚverboser   )r   r<   r?   r@   ÚjoinÚmkdirÚrmtreer>   rA   r   Ú	swap_attrÚchmodÚstatÚS_IRUSRÚS_IXUSR)r#   ÚdirpathZ
subdirpathr   r   r   Útest_rmtreeU   s.   



ÿ

ÿ

ÿzTestSupport.test_rmtreec              	   C   sÊ   t d }t|ddd}td|d W d   ƒ n1 sw   Y  tj dtj¡ t 	¡  z(t
t ƒ}|  t tj¡ t t ¡ |  t tj¡ W tjd= t |¡ t d¡ d S tjd= t |¡ t d¡ w )	Nz.pyr   r8   r9   zfoo = 1©Úfiler   Ú__pycache__)r<   r;   Úprintr0   r@   Úinsertr?   ÚcurdirÚ	importlibÚinvalidate_cachesÚ
__import__r4   r5   r   Zforgetr6   r   r=   rH   )r#   Zmod_filenamerB   Úmodr   r   r   Útest_forgetm   s"   ÿ

þ
zTestSupport.test_forgetc                 C   s   t  tjdf¡}| ¡  d S )Nr   )ÚsocketÚcreate_serverr   ÚHOSTÚclose©r#   Úsr   r   r   Ú	test_HOST~   s   zTestSupport.test_HOSTc                 C   s$   t  ¡ }t t j|f¡}| ¡  d S r   )r   Zfind_unused_portr[   r\   r]   r^   )r#   Úportr`   r   r   r   Útest_find_unused_port‚   s   z!TestSupport.test_find_unused_portc                 C   s&   t   ¡ }t |¡ | ¡  | ¡  d S r   )r[   r   Z	bind_portÚlistenr^   r_   r   r   r   Útest_bind_port‡   s   
zTestSupport.test_bind_portc              	   C   s®   	 t  ¡ }tj |¡}zEtj |d¡}|  tj |¡¡ t 	|¡}|  
||¡ |  tj |¡¡ W d   ƒ n1 s;w   Y  |  tj |¡¡ W t |¡ d S t |¡ w )NZtemp)ÚtempfileÚmkdtempr?   r@   ÚrealpathrF   r>   Úisdirr   Útemp_dirr"   Ú
assertTruerH   )r#   Ú
parent_dirr@   Ú	temp_pathr   r   r   Útest_temp_dir   s   þzTestSupport.test_temp_dirc                 C   sR   	 t  ¡ }|  tj |¡¡ W d   ƒ n1 sw   Y  |  tj |¡¡ d S r   )r   rj   rk   r?   r@   ri   r>   )r#   rm   r   r   r   Útest_temp_dir__path_nonež   s
   
ÿz$TestSupport.test_temp_dir__path_nonec              	   C   sn   	 dd„ }t  ¡ }tj |¡}z!|  tj |¡¡ |  t||¡ |  tj |¡¡ W t	 
|¡ d S t	 
|¡ w )Nc                 S   ó(   t  | ¡}tdƒ‚1 sw   Y  d S ©Nzshould not get here)r   rj   Ú	Exception)r@   rm   r   r   r   Úcall_temp_dir¦   ó   ÿzMTestSupport.test_temp_dir__existing_dir__quiet_default.<locals>.call_temp_dir)rf   rg   r?   r@   rh   rk   ri   r)   ÚFileExistsErrorÚshutilrH   )r#   rs   r@   r   r   r   Ú*test_temp_dir__existing_dir__quiet_default¤   s   z6TestSupport.test_temp_dir__existing_dir__quiet_defaultc              	   C   sî   	 t  ¡ }tj |¡}zIt ¡ -}tj|dd}|  	||¡ W d   ƒ n1 s)w   Y  dd„ |j
D ƒ}W d   ƒ n1 s@w   Y  |  tj |¡¡ W t |¡ nt |¡ w |  	t|ƒd|¡ |d }|  | d|›d¡|¡ d S )	NT©Úquietc                 S   r   r   r   r   r   r   r   r   ½   r   zGTestSupport.test_temp_dir__existing_dir__quiet_true.<locals>.<listcomp>é   r   z5tests may fail, unable to create temporary directory ú: )rf   rg   r?   r@   rh   r   Úcheck_warningsr   rj   r"   r
   rk   ri   rv   rH   r	   Ú
startswith)r#   r@   Úrecorderrm   r
   r    r   r   r   Ú'test_temp_dir__existing_dir__quiet_true´   s&   
ÿý
ÿþz3TestSupport.test_temp_dir__existing_dir__quiet_trueÚforkztest requires os.forkc                 C   s   	 t  dt d¡¡ d S )Nú-ca  
            import os
            from test import support
            from test.support import os_helper
            with os_helper.temp_cwd() as temp_path:
                pid = os.fork()
                if pid != 0:
                    # parent process

                    # wait for the child to terminate
                    support.wait_process(pid, exitcode=0)

                    # Make sure that temp_path is still present. When the child
                    # process leaves the 'temp_cwd'-context, the __exit__()-
                    # method of the context must not remove the temporary
                    # directory.
                    if not os.path.isdir(temp_path):
                        raise AssertionError("Child removed temp_path.")
        )r   Zassert_python_okÚtextwrapÚdedentr,   r   r   r   Útest_temp_dir__forked_childÉ   s   z'TestSupport.test_temp_dir__forked_childc              	   C   sŠ   t  ¡ }t ¡ +}t |¡}|  ||¡ |  t  ¡ |¡ W d   ƒ n1 s'w   Y  W d   ƒ n1 s6w   Y  |  t  ¡ |¡ d S r   )r?   Úgetcwdr   rj   Ú
change_cwdr"   )r#   Úoriginal_cwdrm   Únew_cwdr   r   r   Útest_change_cwdä   s   
þ€ÿzTestSupport.test_change_cwdc                 C   sj   	 t  ¡ }dd„ }t ¡ }t j |d¡}|  t||¡ W d   ƒ n1 s&w   Y  |  t  ¡ |¡ d S )Nc                 S   rp   rq   )r   r†   rr   )r@   rˆ   r   r   r   Úcall_change_cwdò   rt   zFTestSupport.test_change_cwd__non_existent_dir.<locals>.call_change_cwdÚdoes_not_exist)	r?   r…   r   rj   r@   rF   r)   ÚFileNotFoundErrorr"   )r#   r‡   rŠ   rl   Znon_existent_dirr   r   r   Ú!test_change_cwd__non_existent_dirî   s   
ÿþz-TestSupport.test_change_cwd__non_existent_dirc              
   C   sú   	 t  ¡ }t ¡ P}t j |d¡}t ¡ 5}tj|dd}|  	||¡ |  	t  ¡ |¡ W d   ƒ n1 s6w   Y  dd„ |j
D ƒ}W d   ƒ n1 sMw   Y  W d   ƒ n1 s\w   Y  |  	t|ƒd|¡ |d }|  | d|›d	¡|¡ d S )
Nr‹   Trx   c                 S   r   r   r   r   r   r   r   r     r   zMTestSupport.test_change_cwd__non_existent_dir__quiet_true.<locals>.<listcomp>rz   r   úBtests may fail, unable to change the current working directory to r{   )r?   r…   r   rj   r@   rF   r   r|   r†   r"   r
   r	   rk   r}   )r#   r‡   rl   Zbad_dirr~   rˆ   r
   r    r   r   r   Ú-test_change_cwd__non_existent_dir__quiet_trueý   s(   

þü€þ
þýz9TestSupport.test_change_cwd__non_existent_dir__quiet_truec              	   C   s¨   	 t d }t ¡ '}tj|dd W d   ƒ n1 sw   Y  dd„ |jD ƒ}W d   ƒ n1 s3w   Y  |  t|ƒd|¡ |d }|  | 	d|›d	¡|¡ d S )
NZ_does_not_existT)r@   ry   c                 S   r   r   r   r   r   r   r   r     r   z>TestSupport.test_change_cwd__chdir_warning.<locals>.<listcomp>rz   r   rŽ   r{   )
r<   r   r|   r   r†   r
   r"   r	   rk   r}   )r#   r@   r~   r$   Úmsgr   r   r   Útest_change_cwd__chdir_warning  s   
ÿý
þýz*TestSupport.test_change_cwd__chdir_warningc                 C   sr   t  ¡ }tjtd |  t j t  ¡ ¡t¡ W d   ƒ n1 s!w   Y  |  t j 	t¡¡ |  t  ¡ |¡ d S ©N)Úname)
r?   r…   r   Útemp_cwdr<   r"   r@   Úbasenamer>   rA   )r#   Úherer   r   r   Útest_temp_cwd#  s   ÿzTestSupport.test_temp_cwdc                 C   sx   	 t  ¡ }tjd d}|  ||¡ |  t j |¡¡ |  t  ¡ |¡ W d   ƒ n1 s-w   Y  |  t  ¡ |¡ d S r’   )	r?   r…   r   r”   ZassertNotEqualrk   r@   ri   r"   )r#   r‡   rˆ   r   r   r   Útest_temp_cwd__name_none+  s   ýz$TestSupport.test_temp_cwd__name_nonec                 C   s   |   t ddddœ¡d¡ d S )Né   é   rz   )r™   rš   rz   z{1: 1, 2: 2, 3: 3})r"   r   Zsortdictr,   r   r   r   Útest_sortdict4  s   zTestSupport.test_sortdictc                 C   sT   t  ¡ }|  t¡}t |d¡ W d   ƒ n1 sw   Y  |  |jjtj	¡ d S )Ns   foo)
r   Zmake_bad_fdr)   ÚOSErrorr?   Úwriter"   Ú	exceptionÚerrnoÚEBADF)r#   ÚfdÚcmr   r   r   Útest_make_bad_fd7  s
   ÿzTestSupport.test_make_bad_fdc                 C   sN   t j| dddd |  t¡ t  | d¡ W d   ƒ d S 1 s w   Y  d S )Nz	def classrz   é   )ÚlinenoÚoffsetzx=1)r   Zcheck_syntax_errorr)   ÚAssertionErrorr,   r   r   r   Útest_check_syntax_error=  s   "ÿz#TestSupport.test_check_syntax_errorc                 C   sB   dd l }t d¡ | d¡ W d   ƒ d S 1 sw   Y  d S )Nr   Zpprint)rV   r   ZCleanImportr(   )r#   rV   r   r   r   Útest_CleanImportB  s   "ÿzTestSupport.test_CleanImportc                 C   sh   t  dd¡ |  dtj¡ |  dtj¡ W d   ƒ n1 sw   Y  |  dtj¡ |  dtj¡ d S )Nr'   Zbar)r   ZDirsOnSysPathr4   r0   r@   r6   r,   r   r   r   Útest_DirsOnSysPathG  s   þzTestSupport.test_DirsOnSysPathc                 C   sD   t  ¡ }tdƒ W d   ƒ n1 sw   Y  |  | ¡ d¡ d S )NÚhelloúhello
)r   Zcaptured_stdoutrS   r"   Úgetvalue)r#   r1   r   r   r   Útest_captured_stdoutN  s   

ÿz TestSupport.test_captured_stdoutc                 C   sJ   t  ¡ }tdtjd W d   ƒ n1 sw   Y  |  | ¡ d¡ d S )Nr«   rP   r¬   )r   Zcaptured_stderrrS   r0   Ústderrr"   r­   )r#   r¯   r   r   r   Útest_captured_stderrS  s   
ÿz TestSupport.test_captured_stderrc                 C   sR   t  ¡ }| d¡ | d¡ tƒ }W d   ƒ n1 sw   Y  |  |d¡ d S )Nr¬   r   r«   )r   Zcaptured_stdinr   ÚseekÚinputr"   )r#   ÚstdinZcapturedr   r   r   Útest_captured_stdinX  s   


üzTestSupport.test_captured_stdinc                 C   s   t  ¡  d S r   )r   Ú
gc_collectr,   r   r   r   Útest_gc_collect`  s   zTestSupport.test_gc_collectc                 C   s   |   t ¡ t¡ d S r   )ZassertIsInstancer   Zpython_is_optimizedÚboolr,   r   r   r   Útest_python_is_optimizedc  s   z$TestSupport.test_python_is_optimizedc                 C   s  G dd„ dƒ}|ƒ }d|_ t |dd¡}|  |j d¡ |  |d¡ W d   ƒ n1 s,w   Y  |  |j d¡ t |dd¡}|  |jd¡ |  |¡ W d   ƒ n1 sVw   Y  |  t|dƒ¡ t |dd¡
 |`W d   ƒ n1 sww   Y  |  t|dƒ¡ d S )Nc                   @   s   e Zd ZdS )z'TestSupport.test_swap_attr.<locals>.ObjN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   ÚObjg  s    r¼   rz   Úxr¤   Úy)r½   r   rI   r"   r¾   ÚassertIsNoner>   Úhasattr)r#   r¼   Úobjr½   r¾   r   r   r   Útest_swap_attrf  s"   þþÿzTestSupport.test_swap_attrc                 C   sú   ddi}t  |dd¡}|  |d d¡ |  |d¡ W d   ƒ n1 s$w   Y  |  |d d¡ t  |dd¡}|  |d d¡ |  |¡ W d   ƒ n1 sPw   Y  |  d|¡ t  |dd¡ |d= W d   ƒ n1 spw   Y  |  d|¡ d S )Nr½   rz   r¤   r¾   )r   Z	swap_itemr"   r¿   r6   )r#   ÚDr½   r¾   r   r   r   Útest_swap_itemw  s   þþÿzTestSupport.test_swap_itemc                   @   ó   e Zd ZdZdZdZdZdS )zTestSupport.RefClassN)r¹   rº   r»   Ú
attribute1Ú
attribute2Z_hidden_attribute1Ú__magic_1__r   r   r   r   ÚRefClass…  ó
    rÉ   c                   @   rÅ   )zTestSupport.OtherClassN)r¹   rº   r»   rÇ   Ú
attribute3rÈ   Ú__magic_2__r   r   r   r   Ú
OtherClass‹  rÊ   rÍ   c                 C   sB   t  | j| j¡}|  dh|¡ t  | j| j¡}|  ddh|¡ d S )NrÆ   rË   rÌ   )r   Údetect_api_mismatchrÉ   rÍ   r"   )r#   Úmissing_itemsr   r   r   Útest_detect_api_mismatch‘  s   ÿÿz$TestSupport.test_detect_api_mismatchc                 C   sP   g d¢}t j| j| j|d}|  tƒ |¡ t j| j| j|d}|  tƒ |¡ d S )N)rÆ   rË   rÌ   Znot_in_either)Úignore)r   rÎ   rÉ   rÍ   r"   Úset)r#   rÑ   rÏ   r   r   r   Ú test_detect_api_mismatch__ignoreš  s   
ÿ
ÿz,TestSupport.test_detect_api_mismatch__ignorec                 C   sX   dh}dh}t j| t||d ddh}h d£}t j| td||d |  tt j| t¡ d S )NÚtempdirÚtemplate)ÚextraÚnot_exportedZTextTestResultZinstallHandler>   Z
load_testsZBaseTestSuiteZTestProgram)zunittest.resultzunittest.casezunittest.suitezunittest.loaderzunittest.mainzunittest.runnerzunittest.signalszunittest.async_case)r   Zcheck__all__rf   r*   r)   r§   )r#   rÖ   r×   r   r   r   Útest_check__all__¥  s    ýù	zTestSupport.test_check__all__ÚwaitpidÚWNOHANGz need os.waitpid() and os.WNOHANGc                 C   sä   t  ¡  t ¡ }|dkrt d¡ t ¡ }t ¡ t j }t j}zHdt _t	 
¡ }	 t ¡ |kr3|  d¡ tj}z|t_t  ¡  W |t_n|t_w t jrKnt d¡ q(d| }|  || ¡ ¡ |  t j¡ W |t _n|t _w t  ¡  d S )Nr   FTÚtimeoutgš™™™™™¹?z2Warning -- reap_children() reaped child process %s)r   Úreap_childrenr?   r€   Ú_exitÚtimeÚ	monotonicZSHORT_TIMEOUTZenvironment_alteredÚioÚStringIOZfailr0   Ú
__stderr__Úsleepr4   r­   rk   )r#   ÚpidÚt0ÚdeadlineZwas_alteredr¯   Ú
old_stderrr   r   r   r   Útest_reap_children»  s6   



ïzTestSupport.test_reap_childrenNc                 C   s†   d|› d|› d}t jg|¢d‘|‘}dd„ tj ¡ D ƒ}tj|tjtjd|d}|d u r/|}|  	|j
 ¡ t|ƒ¡ |  	|jd	¡ d S )
Nzfrom test.support import z; print(repr(z()))r   c                 S   s    i | ]\}}|  d ¡s||“qS )ZPYTHON)r}   )r   ÚkeyÚvaluer   r   r   Ú
<dictcomp>ï  s    ÿz-TestSupport.check_options.<locals>.<dictcomp>T)r1   r¯   Úuniversal_newlinesÚenvr   )r0   Ú
executabler?   ÚenvironÚitemsÚ
subprocessÚrunÚPIPEÚDEVNULLr"   r1   ÚrstripÚreprÚ
returncode)r#   ÚargsÚfuncÚexpectedÚcodeÚcmdrí   Úprocr   r   r   Úcheck_optionsì  s   üzTestSupport.check_optionsc                 C   s²   g dgdgdgdgdgdgdgdgd	gd
gdgddgg d¢ddgddgddgddgddgfD ]}| j |d |  |d¡ W d   ƒ n1 sGw   Y  q.|  g d¢ddg¡ d S )Nz-Bú-sz-Sú-Ez-vz-bz-qú-Iz-bbz-vvvú-Wignoreú-XÚdev)r  r  r  ÚfaulthandlerÚ
importtimeÚshowrefcountÚtracemallocztracemalloc=3©ÚoptsZargs_from_interpreter_flags)r  r   rÿ   ©ZsubTestrþ   ©r#   r
  r   r   r   Ú test_args_from_interpreter_flagsû  s6   èÿ€ÿz,TestSupport.test_args_from_interpreter_flagsc              	   C   sT   g dgdgdgfD ]}| j |d |  |d¡ W d   ƒ n1 s"w   Y  q	d S )Nz-Oz-OOz-OOOOr	  Z!optim_args_from_interpreter_flagsr  r  r   r   r   Ú&test_optim_args_from_interpreter_flags  s   ûÿ€ùz2TestSupport.test_optim_args_from_interpreter_flagsc                 C   sð  G dd„ dƒ}|dƒ}|dƒ}t  t dd ¡ã t  g ¡ |  t  |¡¡ |  t  |¡¡ t  d d ¡ |  t  |¡¡ |  t  |¡¡ t  | ¡ gd ¡ |  t  |¡¡ |  t  |¡¡ t  dgd ¡ |  t  |¡¡ |  t  |¡¡ t  dgd ¡ |  t  |¡¡ |  t  |¡¡ t  dgd ¡ |  t  |¡¡ t  d	gd ¡ |  t  |¡¡ t  d
gd ¡ |  t  |¡¡ |  t  |¡¡ t  | ¡ | ¡ gd ¡ |  t  |¡¡ |  t  |¡¡ t  ddgd ¡ |  t  |¡¡ |  t  |¡¡ W d   ƒ n1 süw   Y  t  t dd ¡å t jg d |  t  |¡¡ |  t  |¡¡ t  d d ¡ |  t  |¡¡ |  t  |¡¡ t  d | ¡ g¡ |  t  |¡¡ |  t  |¡¡ t  d dg¡ |  t  |¡¡ |  t  |¡¡ t  d dg¡ |  t  |¡¡ |  t  |¡¡ t  d dg¡ |  t  |¡¡ t  d d	g¡ |  t  |¡¡ t  d d
g¡ |  t  |¡¡ |  t  |¡¡ t  d | ¡ | ¡ g¡ |  t  |¡¡ |  t  |¡¡ t  d ddg¡ |  t  |¡¡ |  t  |¡¡ W d   ƒ d S 1 sñw   Y  d S )Nc                   @   s   e Zd Zdd„ Zdd„ ZdS )z)TestSupport.test_match_test.<locals>.Testc                 S   s
   || _ d S r   ©Útest_id)r#   r  r   r   r   Ú__init__+  s   
z2TestSupport.test_match_test.<locals>.Test.__init__c                 S   s   | j S r   r  r,   r   r   r   Úid.  s   z,TestSupport.test_match_test.<locals>.Test.idN)r¹   rº   r»   r  r  r   r   r   r   ÚTest*  s    r  z"test.test_os.FileTests.test_accessz'test.test_os.Win32ErrorTests.test_chdirZ_match_test_funcZtest_osztest_*Z	filetestsZ	FileTestsz*test_os.*.test_*Útest_accessZ	DONTMATCH)Úignore_patterns)r   rI   Zset_match_testsrk   Z
match_testr  r>   )r#   r  r  Z
test_chdirr   r   r   Útest_match_test)  s~   
Ô/$ÔzTestSupport.test_match_testc              	   C   sN   t  ¡ }t ttj¡}zt  ¡ }W t |¡ nt |¡ w |  || d¡ d S )Nrz   )r   Zfd_countr?   r;   Ú__file__ÚO_RDONLYr^   r"   )r#   Ústartr¡   Zmorer   r   r   Útest_fd_count’  s   
zTestSupport.test_fd_countc                 C   sF   t  ¡ }tj}z|t_t |¡ W |t_n|t_w |  | ¡ |¡ d S r   )rà   rá   r0   râ   r   Zprint_warningr"   r­   )r#   r   rú   r¯   rç   r   r   r   Úcheck_print_warningž  s   zTestSupport.check_print_warningc                 C   s   |   dd¡ |   dd¡ d S )Nr   zWarning -- msg
za
bzWarning -- a
Warning -- b
)r  r,   r   r   r   Útest_print_warningª  s   ÿÿzTestSupport.test_print_warningr   );r¹   rº   r»   Úclassmethodr   r   r%   r-   r.   r/   r*   Úskipr2   r7   rC   rO   rZ   ra   rc   re   rn   ro   rw   r   Z
skipUnlessrÀ   r?   r„   r‰   r   r   r‘   r—   r˜   r›   r£   r¨   r©   rª   r®   r°   r´   r¶   r¸   rÂ   rÄ   rÉ   rÍ   rÐ   rÓ   rØ   rè   rþ   r  r  r  r  r  r  r   r   r   r   r      st    





		ÿ

/"ir   Ú__main__)rŸ   rV   rà   r?   rv   r[   rK   rñ   r0   rf   r‚   rÞ   r*   r
   Útestr   Ztest.supportr   r   r   r   r   r<   ZTestCaser   r¹   Úmainr   r   r   r   Ú<module>   s<         3ÿ