Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_zipapp.cpython-310.pyc
o

�9j�?�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZGdd�dej
�ZGdd�dej
�Zed	krJe��dSdS)
z#Test harness for the zipapp module.�N)�
requires_zlib)�patchc@s
eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
e�dd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Ze�ej d2kd3�d4d5��Z!e�ej d2kd3�d6d7��Z"d8S)9�
ZipAppTestz!Test zipapp module functionality.cC�&t��}|�|j�t�|j�|_dS�N��tempfile�TemporaryDirectory�
addCleanup�cleanup�pathlib�Path�name�tmpdir��selfr�r�'/usr/lib/python3.10/test/test_zipapp.py�setUp�zZipAppTest.setUpcCsN|jd}|��|d��|jd}t�t|�t|��|�|���dS�N�source�__main__.py�
source.pyz�r�mkdir�touch�zipapp�create_archive�str�
assertTrue�is_file�rr�targetrrr�test_create_archives

zZipAppTest.test_create_archivecCsF|jd}|��|d��|jd}t�||�|�|���dSr)rrrrrr r!r"rrr� test_create_archive_with_pathlib!s

z+ZipAppTest.test_create_archive_with_pathlibcCs�|jd}|��|d��|d��|d��|dd��t��}t�t|�|�|�d�t	�
|d��}|�d|���|�d	|���Wd�dS1sVwYdS)
Nrr�foo�barz__init__.pyr�rzfoo/zbar/)
rrr�io�BytesIOrrr�seek�zipfile�ZipFile�assertIn�namelist�rrr#�zrrr� test_create_archive_with_subdirs*s

"�z+ZipAppTest.test_create_archive_with_subdirscCs�dd�}|jd}|��|d��|d��|d��|jd}tj|||d�t�|d	��!}|�d|���|�d|���|�	d|���Wd�dS1sVwYdS)
NcSs
|jdkS)Nz.pyc)�suffix��pathrrr�skip_pyc_files<s
zBZipAppTest.test_create_archive_with_filter.<locals>.skip_pyc_filesrr�test.pyztest.pycr��filterr()
rrrrrr,r-r.r/�assertNotIn)rr6rr#r1rrr�test_create_archive_with_filter9s

"�z*ZipAppTest.test_create_archive_with_filtercCs�dd�}|jd}|��|d��|d��|d��|dd��|jd}tj|||d	�t�|d
��#}|�t|�	��d�|�
d|�	��|�
d|�	��Wd�dS1s`wYdS)NcSs|jddkS)Nr�dummy)�partsr4rrr�skip_dummy_dirOszIZipAppTest.test_create_archive_filter_exclude_dir.<locals>.skip_dummy_dirrrr7r<ztest2.pyrr8r(�)rrrrrr,r-�assertEqual�lenr/r.)rr>rr#r1rrr�&test_create_archive_filter_exclude_dirKs

"�z1ZipAppTest.test_create_archive_filter_exclude_dircCsH|jd}|��|d��t�t|��|jd}|�|���dSrr)rr�expected_targetrrr�"test_create_archive_default_target_s

z-ZipAppTest.test_create_archive_default_targetcCs�|jd}|��|d��|d��|jd}tj||dd�t�|d��}dD]
}|�|�|�j	tj
�q+Wd�dS1sDwYdS)	Nrrr7rT)�
compressedr()rr7)rrrrrr,r-r@�getinfo�
compress_type�ZIP_DEFLATED)rrr#r1rrrr�$test_create_archive_with_compressionhs

��"�z/ZipAppTest.test_create_archive_with_compressioncCsn|jd}|��|d��|jd}|�tj��t�t|�t|��Wd�dS1s0wYdS)Nr�foo.pyr�rrr�assertRaisesr�ZipAppErrorrrr"rrr�test_no_mainws

"�zZipAppTest.test_no_maincCsr|jd}|��|d��|jd}|�tj��tjt|�t|�dd�Wd�dS1s2wYdS)Nrrr�
pkg.mod:fn��mainrKr"rrr�test_main_and_main_py�s

"�z ZipAppTest.test_main_and_main_pycCs�|jd}|��|d��|jd}tjt|�t|�dd�t�t|�d��}|�d|�	��|�d|�
d��Wd�dS1sEwYdS)	NrrJrrOrPr(rspkg.mod.fn())rrrrrrr,r-r.r/�readr0rrr�test_main_written�s

"�zZipAppTest.test_main_writtencCs�|jd}|��|d��|d��|jd}tjt|�t|�dd�t�t|�d��}|�d|�	��
d	��Wd�dS1sEwYdS)
NrrJzbar.pyrrOrPr(�r)rrrrrrr,r-r@r/�countr0rrr�test_main_only_written_once�s

"�z&ZipAppTest.test_main_only_written_oncec
Cs�|jd}|��|jd}gd�}|D]:}|j|d��*|�tj��tjt|�t|�|d�Wd�n1s:wYWd�n1sIwYqdS)Nrr)
�r&zfoo:z:barz12:barza.b.c.:dz.a:bza:b.za:.bza:silly namerP)rr�subTestrLrrMrr)rrr#�problemsrQrrr�test_main_validation�s

�����zZipAppTest.test_main_validationcCs~|jd}|��|d��|jd}t�t|�t|��|�d��}|�|�d�d�Wd�dS1s8wYdS)Nrrr�rbr?�#!)	rrrrrr�open�assertNotEqualrS�rrr#�frrr�test_default_no_shebang�s

"�z"ZipAppTest.test_default_no_shebangcCs�|jd}|��|d��|jd}tjt|�t|�dd�|�d��}|�|�d�d�|�d	|�	��Wd�dS1sBwYdS)
Nrrr�python��interpreterr\r?r]spython
)
rrrrrrr^r@rS�readliner`rrr�test_custom_interpreter�s

"�z"ZipAppTest.test_custom_interpretercCsR|jd}|��|d��t��}tjt|�|dd�|�|�	��
d��dS)Nrrrcrds	#!python
)rrrr)r*rrrr �getvalue�
startswithr"rrr�test_pack_to_fileobj�s
zZipAppTest.test_pack_to_fileobjcCsZ|jd}|��|d��|jd}tjt|�t|�dd�|�t�t|��d�dS�Nrrrrcrd�rrrrrrr@�get_interpreterr"rrr�test_read_shebang�s

zZipAppTest.test_read_shebangcCsV|jd}|��|d��|jd}t�t|�t|��|�t�t|��d�dSrrlr"rrr�test_read_missing_shebang�s

z$ZipAppTest.test_read_missing_shebangcCs||jd}|��|d��|jd}tjt|�t|�dd�|jd}tjt|�t|�dd�|�t�t|��d�dS)Nrrrrcrd�changed.pyz�	python2.7rl�rrr#�
new_targetrrr�test_modify_shebang��


zZipAppTest.test_modify_shebangcCst|jd}|��|d��|jd}tjt|�t|�dd�t��}tjt|�|dd�|�|�	��
d��dS)Nrrrrcrdrq�#!python2.7
)rrrrrrr)r*r rhrirrrrr�test_write_shebang_to_fileobj�s

z(ZipAppTest.test_write_shebang_to_fileobjcCsh|jd}|��|d��|jd}|jd}tj||dd�tj||dd�|�t�|�d�dS)Nrrztarget1.pyzztarget2.pyzrcrdrq)rrrrrr@rm)rr�target1�target2rrr�test_read_from_pathobj�s


z!ZipAppTest.test_read_from_pathobjcCs~|jd}|��|d��|jd}t��}tjt|�|dd�t��}|�d�tj||dd�|�	|�
��d��dS)	Nrrrrcrdrrqrv)rrrr)r*rrrr+r rhri)rrr#�temp_archiversrrr�test_read_from_fileobjs


z!ZipAppTest.test_read_from_fileobjcCs||jd}|��|d��|jd}tjt|�t|�dd�|jd}tjt|�t|�dd�|�t�t|��d�dS)Nrrrrcrdrprlrrrrr�test_remove_shebangruzZipAppTest.test_remove_shebangcCs�|jd}|��|d��t��}tjt|�|dd�t��}|�d�tj||dd�|�d�t	�
|d��}|�t|�
��dh�Wd�dS1sPwYdS)Nrrrcrdrr()rrrr)r*rrrr+r,r-r@�setr/)rrr#rsr1rrr�test_content_of_copied_archives


"�z)ZipAppTest.test_content_of_copied_archive�win32z*Windows does not support an executable bitcCsZ|jd}|��|d��|jd}tjt|�t|�dd�|�|��jtj	@�dSrk)
rrrrrrr �stat�st_mode�S_IEXECr"rrr�test_shebang_is_executable.�

z%ZipAppTest.test_shebang_is_executablecCsZ|jd}|��|d��|jd}tjt|�t|�dd�|�|��jtj	@�dS)Nrrrrd)
rrrrrr�assertFalser�r�r�r"rrr�!test_no_shebang_is_not_executable9r�z,ZipAppTest.test_no_shebang_is_not_executableN)#�__name__�
__module__�__qualname__�__doc__rr$r%r2r;rBrDrrIrNrRrTrWr[rbrgrjrnrortrwrzr|r}r�unittest�skipIf�sys�platformr�r�rrrrrsF			
		
			
�
	�rc@s^eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	e
dejd�dd��Z
dd�ZdS)�ZipAppCmdlineTestz$Test zipapp module command line API.cCrrrrrrrrIrzZipAppCmdlineTest.setUpcCs8|jd}|��|d��|jd}t�||�|Sr)rrrrrr"rrr�make_archiveNs

zZipAppCmdlineTest.make_archivecCsN|jd}|��|d��t|�g}t�|�|�d�}|�|���dS)Nrrz.pyz)	rrrrrrQ�with_suffixr r!)rr�argsr#rrr�test_cmdline_createWs



z%ZipAppCmdlineTest.test_cmdline_createcCs@|��}|jd}t|�dt|�g}t�|�|�|���dS�N�
target.pyz�-o)r�rrrrQr r!)r�originalr#r�rrr�test_cmdline_copyas


z#ZipAppCmdlineTest.test_cmdline_copycCsj|��}|jd}t|�dt|�g}|�t��
}t�|�Wd�n1s'wY|�|jj	�dSr��
r�rrrL�
SystemExitrrQr �	exception�code�rr�r#r��cmrrr�test_cmdline_copy_inplaceis
�z+ZipAppCmdlineTest.test_cmdline_copy_inplacecCsn|��}|jd}t|�dt|�ddg}|�t��
}t�|�Wd�n1s)wY|�|jj	�dS)Nr�r�z-mzfoo:barr�r�rrr�test_cmdline_copy_change_mainss
�z/ZipAppCmdlineTest.test_cmdline_copy_change_mainz
sys.stdout)�new_callablecCsl|��}t|�dg}|�t��
}t�|�Wd�n1swY|�|jjd�|�|�	�d�dS)N�--inforzInterpreter: <none>
)
r�rrLr�rrQr@r�r�rh)r�mock_stdoutr#r�r�rrr�test_info_command}s�z#ZipAppCmdlineTest.test_info_commandcCs\|jd}t|�dg}|�t��
}t�|�Wd�n1s wY|�|jj�dS)Nz	dummy.pyzr�)	rrrLr�rrQr r�r�)rr#r�r�rrr�test_info_error�s
�z!ZipAppCmdlineTest.test_info_errorN)r�r�r�r�rr�r�r�r�r�rr)�StringIOr�r�rrrrr�Es	




r��__main__)r�r)rr�r�rr�rr,�test.supportr�
unittest.mockr�TestCaserr�r�rQrrrr�<module>s$8M�

Youez - 2016 - github.com/yon3zu
LinuXploit