HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_support.cpython-37.opt-2.pyc
B

��g�]�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZejZGdd�de
j�Zdd�Zedkr�e�dS)	�N)�support)�
script_helperc@s�eZdZdd�Zdd�Zdd�Ze�d�dd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze�eed �d!�d"d#��Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$d>d?�Z%d@dA�Z&dBdC�Z'dDdE�Z(dFdG�Z)GdHdI�dI�Z*GdJdK�dK�Z+dLdM�Z,dNdO�Z-dPdQ�Z.e�eedR��o�eedS�dT�dUdV��Z/dbdXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4dWS)c�TestSupportcCs t�d�|�tjtjd�dS)N�ftplib�foo)r�
import_module�assertRaises�unittest�SkipTest)�self�r�-/usr/local/lib/python3.7/test/test_support.py�test_import_modules
zTestSupport.test_import_modulecCst�d�dS)Nr)rZimport_fresh_module)rrrr
�test_import_fresh_modulesz$TestSupport.test_import_fresh_modulecCs.|�t�|d�|j�|�tjtj|d�dS)N�test_get_attributer)�assertEqualrZ
get_attributerrr	r
)rrrr
rszTestSupport.test_get_attributezfailing buildbotscCs|�t��tj�dS)N)rrZget_original_stdout�sys�stdout)rrrr
�test_get_original_stdout#sz$TestSupport.test_get_original_stdoutcCs2ddl}|�dtj�t�d�|�dtj�dS)Nr�sched)r�assertInr�modulesrZunload�assertNotIn)rrrrr
�test_unload's
zTestSupport.test_unloadc	Cs@ttd��}WdQRXt�t�|�tj�t��t�t�dS)N�w)�open�TESTFNr�unlink�assertFalse�os�path�exists)r�frrr
�test_unlink-s


zTestSupport.test_unlinkc	Cs$tjd}tj�|d�}t�|�t�|�t�|�|�tj�|��t�	tdd��t�|�WdQRXt�|�t�|�t�
|tjtj
B�t�	tdd��t�|�WdQRX|�tj�|��t�|�t�|�t�
|d�t�	tdd��t�|�WdQRX|�tj�|��dS)N�dZsubdir�verboser)rrrr �join�mkdir�rmtreerr!�	swap_attr�chmod�stat�S_IRUSR�S_IXUSR)r�dirpathZ
subdirpathrrr
�test_rmtree4s(







zTestSupport.test_rmtreec	Cs�td}t|d��}td|d�WdQRXtj�dtj�t�	�z2t
t�}|�ttj�t
�t�|�ttj�Wdtjd=t
�|�t
�d�XdS)Nz.pyrzfoo = 1)�filer�__pycache__)rr�printrr �insertr�curdir�	importlib�invalidate_caches�
__import__rrrZforgetrrr()rZmod_filenamer"�modrrr
�test_forgetLs

zTestSupport.test_forgetcCs$t��}|�tjdf�|��dS)Nr)�socket�bindr�HOST�close)r�srrr
�	test_HOST]szTestSupport.test_HOSTcCs,t��}t��}|�tj|f�|��dS)N)rZfind_unused_portr:r;r<r=)rZportr>rrr
�test_find_unused_portbsz!TestSupport.test_find_unused_portcCs&t��}t�|�|��|��dS)N)r:rZ	bind_portZlistenr=)rr>rrr
�test_bind_porths
zTestSupport.test_bind_portc	Cs�t��}tj�|�}zjtj�|d�}|�tj�|��t�	|��$}|�
||�|�tj�|��WdQRX|�tj�|��Wdt�|�XdS)NZtemp)
�tempfile�mkdtemprr �realpathr&r�isdirr�temp_dirr�
assertTruer()r�
parent_dirr �	temp_pathrrr
�
test_temp_dirpszTestSupport.test_temp_dirc	Cs<t���}|�tj�|��WdQRX|�tj�|��dS)N)rrFrGrr rEr)rrIrrr
�test_temp_dir__path_nones
z$TestSupport.test_temp_dir__path_nonec	Csddd�}t��}tj�|�}z6|�tj�|��|�t||�|�tj�|��Wdt	�
|�XdS)Nc	Ss"t�|��}td��WdQRXdS)Nzshould not get here)rrF�	Exception)r rIrrr
�
call_temp_dir�szMTestSupport.test_temp_dir__existing_dir__quiet_default.<locals>.call_temp_dir)rBrCrr rDrGrEr�FileExistsError�shutilr()rrMr rrr
�*test_temp_dir__existing_dir__quiet_default�sz6TestSupport.test_temp_dir__existing_dir__quiet_defaultc
Cs�t��}tj�|�}z`t���<}tj|dd��}|�||�WdQRXdd�|j	D�}WdQRX|�
tj�|��Wdt�
|�X|�t|�d|�|d}|�
|�d|�d��|�dS)	NT)�quietcSsg|]}t|j��qSr)�str�message)�.0rrrr
�
<listcomp>�szGTestSupport.test_temp_dir__existing_dir__quiet_true.<locals>.<listcomp>�rz5tests may fail, unable to create temporary directory z: )rBrCrr rDr�check_warningsrFr�warningsrGrErOr(�len�
startswith)rr �recorderrIrX�warnrrr
�'test_temp_dir__existing_dir__quiet_true�s
z3TestSupport.test_temp_dir__existing_dir__quiet_true�forkztest requires os.forkcCst�dt�d��dS)Nz-ca�
            import os
            from test import support
            with support.temp_cwd() as temp_path:
                pid = os.fork()
                if pid != 0:
                    # parent process (child has pid == 0)

                    # wait for the child to terminate
                    (pid, status) = os.waitpid(pid, 0)
                    if status != 0:
                        raise AssertionError(f"Child process failed with exit "
                                             f"status indication 0x{status:x}.")

                    # 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.")
        )rZassert_python_ok�textwrap�dedent)rrrr
�test_temp_dir__forked_child�s
z'TestSupport.test_temp_dir__forked_childc
Csbt��}t���8}t�|��"}|�||�|�t��|�WdQRXWdQRX|�t��|�dS)N)r�getcwdrrF�
change_cwdr)r�original_cwdrI�new_cwdrrr
�test_change_cwd�s
$zTestSupport.test_change_cwdc	CsTt��}dd�}t���"}tj�|d�}|�t||�WdQRX|�t��|�dS)Nc	Ss"t�|��}td��WdQRXdS)Nzshould not get here)rrcrL)r rerrr
�call_change_cwd�szFTestSupport.test_change_cwd__non_existent_dir.<locals>.call_change_cwd�does_not_exist)	rrbrrFr r&r�FileNotFoundErrorr)rrdrgrHZnon_existent_dirrrr
�!test_change_cwd__non_existent_dir�s
z-TestSupport.test_change_cwd__non_existent_dircCs�t��}t���n}tj�|d�}t���L}tj|dd��"}|�||�|�t��|�WdQRXdd�|j	D�}WdQRXWdQRX|�t
|�d|�|d}|�|�d|�d	��|�dS)
NrhT)rQcSsg|]}t|j��qSr)rRrS)rTrrrr
rU�szMTestSupport.test_change_cwd__non_existent_dir__quiet_true.<locals>.<listcomp>rVrzBtests may fail, unable to change the current working directory to z: )
rrbrrFr r&rWrcrrXrYrGrZ)rrdrHZbad_dirr[rerXr\rrr
�-test_change_cwd__non_existent_dir__quiet_true�s

$z9TestSupport.test_change_cwd__non_existent_dir__quiet_truec
Cs~td}t���0}tj|dd��WdQRXdd�|jD�}WdQRX|�t|�d|�|d}|�|�d|�d	��|�dS)
NZ_does_not_existT)r rQcSsg|]}t|j��qSr)rRrS)rTrrrr
rU�sz>TestSupport.test_change_cwd__chdir_warning.<locals>.<listcomp>rVrzBtests may fail, unable to change the current working directory to z: )	rrrWrcrXrrYrGrZ)rr r[�messages�msgrrr
�test_change_cwd__chdir_warning�s

z*TestSupport.test_change_cwd__chdir_warningc	Cs^t��}tjtd��|�tj�t���t�WdQRX|�tj�	t��|�t��|�dS)N)�name)
rrbr�temp_cwdrrr �basenamerr!)r�hererrr
�
test_temp_cwds
"zTestSupport.test_temp_cwdc	Csbt��}tjdd��4}|�||�|�tj�|��|�t��|�WdQRX|�t��|�dS)N)ro)	rrbrrpZassertNotEqualrGr rEr)rrdrerrr
�test_temp_cwd__name_nonesz$TestSupport.test_temp_cwd__name_nonecCs|�t�dddd��d�dS)N��rV)rurvrVz{1: 1, 2: 2, 3: 3})rrZsortdict)rrrr
�
test_sortdictszTestSupport.test_sortdictc	Cs@t��}|�t��}t�|d�WdQRX|�|jjtj	�dS)Nsfoo)
rZmake_bad_fdr�OSErrorr�writerZ	exception�errnoZEBADF)r�fd�cmrrr
�test_make_bad_fdszTestSupport.test_make_bad_fdc	Cs8tj|dddd�|�t��t�|d�WdQRXdS)Nz	def classrV�	)�lineno�offsetzx=1)rZcheck_syntax_errorr�AssertionError)rrrr
�test_check_syntax_error sz#TestSupport.test_check_syntax_errorc	Cs,ddl}t�d��|�d�WdQRXdS)NrZasyncore)r5rZCleanImportr)rr5rrr
�test_CleanImport%szTestSupport.test_CleanImportc	CsTt�dd��"|�dtj�|�dtj�WdQRX|�dtj�|�dtj�dS)NrZbar)rZ
DirsOnSysPathrrr r)rrrr
�test_DirsOnSysPath*s
zTestSupport.test_DirsOnSysPathc	Cs0t���}td�WdQRX|�|��d�dS)N�hellozhello
)rZcaptured_stdoutr2r�getvalue)rrrrr
�test_captured_stdout1s
z TestSupport.test_captured_stdoutc	Cs6t���}tdtjd�WdQRX|�|��d�dS)Nr�)r0zhello
)rZcaptured_stderrr2r�stderrrr�)rr�rrr
�test_captured_stderr6s
z TestSupport.test_captured_stderrc	Cs>t��� }|�d�|�d�t�}WdQRX|�|d�dS)Nzhello
rr�)rZcaptured_stdinry�seek�inputr)r�stdinZcapturedrrr
�test_captured_stdin;s



zTestSupport.test_captured_stdincCst��dS)N)rZ
gc_collect)rrrr
�test_gc_collectCszTestSupport.test_gc_collectcCs|�t��t�dS)N)ZassertIsInstancerZpython_is_optimized�bool)rrrr
�test_python_is_optimizedFsz$TestSupport.test_python_is_optimizedc	Cs�Gdd�d�}|�}d|_t�|dd�� }|�|jd�|�|d�WdQRX|�|jd�t�|dd��}|�|jd�|�|�WdQRX|�t|d��t�|dd��
|`WdQRX|�t|d��dS)Nc@seZdZdS)z'TestSupport.test_swap_attr.<locals>.ObjN)�__name__�
__module__�__qualname__rrrr
�ObjJsr�rV�x��y)r�rr)rr��assertIsNoner�hasattr)rr��objr�r�rrr
�test_swap_attrIszTestSupport.test_swap_attrc	Cs�ddi}t�|dd��"}|�|dd�|�|d�WdQRX|�|dd�t�|dd�� }|�|dd�|�|�WdQRX|�d|�t�|dd��|d=WdQRX|�d|�dS)Nr�rVr�r�)rZ	swap_itemrr�r)r�Dr�r�rrr
�test_swap_itemZszTestSupport.test_swap_itemc@seZdZdZdZdZdZdS)zTestSupport.RefClassN)r�r�r��
attribute1�
attribute2Z_hidden_attribute1�__magic_1__rrrr
�RefClasshsr�c@seZdZdZdZdZdZdS)zTestSupport.OtherClassN)r�r�r�r��
attribute3r��__magic_2__rrrr
�
OtherClassnsr�cCsBt�|j|j�}|�dh|�t�|j|j�}|�ddh|�dS)Nr�r�r�)r�detect_api_mismatchr�r�r)r�
missing_itemsrrr
�test_detect_api_mismatchtsz$TestSupport.test_detect_api_mismatchcCsTddddg}tj|j|j|d�}|�t�|�tj|j|j|d�}|�t�|�dS)Nr�r�r�Z
not_in_either)�ignore)rr�r�r�r�set)rr�r�rrr
� test_detect_api_mismatch__ignore}sz,TestSupport.test_detect_api_mismatch__ignorecCsZdh}dh}tj|t||d�ddh}dddh}tj|td	||d�|�ttj|t�dS)
NZtempdir�template)�extra�	blacklistZTextTestResultZinstallHandlerZ
load_testsZTestProgramZ
BaseTestSuite)zunittest.resultz
unittest.casezunittest.suitezunittest.loaderz
unittest.mainzunittest.runnerzunittest.signals)rZcheck__all__rBr	rr�)rr�r�rrr
�test_check__all__�s
zTestSupport.test_check__all__�waitpid�WNOHANGz need os.waitpid() and os.WNOHANGc	Cs�t��t��}|dkr"t�d�t��}t��d}tj}z�dt_t�	�}xJt��|krd|�
d�t�|��t��WdQRXtjr�Pt�
d�qNWd|}|�||���|�tj�Wd|t_Xt��dS)NrgN@FZtimeoutg�������?z2Warning -- reap_children() reaped child process %s)rZ
reap_childrenrr^�_exit�timeZ	monotonicZenvironment_altered�io�StringIOZfail�
contextlib�redirect_stderrZsleeprr�rG)r�pidZt0ZdeadlineZwas_alteredr�rmrrr
�test_reap_children�s.

zTestSupport.test_reap_childrenNcCs�d|�d|�d�}tjf|d|f�}dd�tj��D�}tj|tjtjd|d�}|dkr\|}|�	|j
��t|��|�	|j
d	�dS)
Nzfrom test.support import z
; print(repr(z()))z-ccSs i|]\}}|�d�s||�qS)ZPYTHON)rZ)rT�key�valuerrr
�
<dictcomp>�sz-TestSupport.check_options.<locals>.<dictcomp>T)rr�Zuniversal_newlines�envr)r�
executabler�environ�items�
subprocess�run�PIPEZDEVNULLrr�rstrip�repr�
returncode)r�args�funcZexpected�code�cmdr��procrrr
�
check_options�szTestSupport.check_optionscCs�x�gdgdgdgdgdgdgdgdgd	gd
gdgdd
gddd
gddgddgddgddgddgddgfD](}|j|d��|�|d�WdQRXqfW|�dddgddg�dS)Nz-Bz-sz-Sz-Ez-vz-bz-qz-Iz-bbz-vvvz-Wignorez-XZdevZfaulthandlerZ
importtimeZshowalloccountZshowrefcount�tracemallocz
tracemalloc=3)�optsZargs_from_interpreter_flags)�subTestr�)rr�rrr
� test_args_from_interpreter_flags�s2z,TestSupport.test_args_from_interpreter_flagsc
CsDx>gdgdgdgfD](}|j|d��|�|d�WdQRXqWdS)Nz-Oz-OOz-OOOO)r�Z!optim_args_from_interpreter_flags)r�r�)rr�rrr
�&test_optim_args_from_interpreter_flags�sz2TestSupport.test_optim_args_from_interpreter_flagsc	Cs�Gdd�d�}|d�}|d�}t�tdd����t�g�|�t�|��|�t�|��t�dd�|�t�|��|�t�|��t�|��gd�|�t�|��|�t�|��t�dgd�|�t�|��|�t�|��t�dgd�|�t�|��|�t�|��t�dgd�|�t�|��t�d	gd�|�t�|��t�d
gd�|�t�|��|�t�|��t�|��|��gd�|�t�|��|�t�|��t�ddgd�|�t�|��|�t�|��WdQRXt�tdd����tjgd
�|�t�|��|�t�|��t�dd�|�t�|��|�t�|��t�d|��g�|�t�|��|�t�|��t�ddg�|�t�|��|�t�|��t�ddg�|�t�|��|�t�|��t�ddg�|�t�|��t�dd	g�|�t�|��t�dd
g�|�t�|��|�t�|��t�d|��|��g�|�t�|��|�t�|��t�dddg�|�t�|��|�t�|��WdQRXdS)Nc@seZdZdd�Zdd�ZdS)z)TestSupport.test_match_test.<locals>.TestcSs
||_dS)N)�test_id)rr�rrr
�__init__sz2TestSupport.test_match_test.<locals>.Test.__init__cSs|jS)N)r�)rrrr
�idsz,TestSupport.test_match_test.<locals>.Test.idN)r�r�r�r�r�rrrr
�Test
sr�z"test.test_os.FileTests.test_accessz'test.test_os.Win32ErrorTests.test_chdirZ_match_test_funcZtest_osztest_*Z	filetestsZ	FileTestsz*test_os.*.test_*�test_accessZ	DONTMATCH)Zignore_patterns)rr)Zset_match_testsrGZ
match_testr�r)rr�r�Z
test_chdirrrr
�test_match_test	sz
zTestSupport.test_match_testc	CsDt��}t�ttj�}zt��}Wdt�|�X|�||d�dS)NrV)rZfd_countrr�__file__�O_RDONLYr=r)r�startr{Zmorerrr
�
test_fd_countrszTestSupport.test_fd_count)N)5r�r�r�rrrr	�skiprrr#r/r9r?r@rArJrKrPr]Z
skipUnlessr�rrarfrjrkrnrsrtrwr}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
rs\
		,
#ircCstg}tj|�dS)N)rrZrun_unittest)Ztestsrrr
�	test_main�sr��__main__)r�rzr5r�rrOr:r+r�rrBr_r�r	ZtestrZtest.supportrrZTestCaserr�r�rrrr
�<module>s2