Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/distutils/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/distutils/tests/__pycache__/test_dist.cpython-38.opt-2.pyc
U

@��g�J�@sddlZddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZddl
mZmZmZmZddlmZddlmZGdd	�d	e�ZGd
d�de�ZGdd
�d
ejejejej�ZGdd�dejejej�Zdd�Zedkr�ee��dS)�N)�mock)�Distribution�fix_help_options�DistributionMetadata)�Command)�TESTFN�captured_stdout�captured_stderr�run_unittest)�support)�logc@seZdZdgZdd�ZdS)�	test_dist)zsample-option=�Sz	help textcCs
d|_dS�N)�
sample_option��self�r�8/opt/cppython/lib/python3.8/distutils/tests/test_dist.py�initialize_optionssztest_dist.initialize_optionsN)�__name__�
__module__�__qualname__Zuser_optionsrrrrrr
s�r
c@seZdZdd�ZdS)�TestDistributioncCs|jSr)�
_config_filesrrrr�find_config_files(sz"TestDistribution.find_config_filesN)rrrrrrrrr srcszeZdZ�fdd�Z�fdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Z�ZS)�DistributionTestCasecs4tt|���tjtjdd�f|_tjdd�=dS)N�)�superr�setUp�sys�argvr��	__class__rrr1szDistributionTestCase.setUpcs2|jdt_|jdtjdd�<tt|���dS�Nrr)r!r rr�tearDownrr"rrr%6szDistributionTestCase.tearDownrcCs t�}||_|��|��|Sr)rrZparse_config_files�parse_command_line)rZconfigfiles�drrr�create_distribution;s
z(DistributionTestCase.create_distributioncCs*tj�d�|��}|�|��dg�dS)N�build�distutils.command)r r!�appendr(�assertEqual�get_command_packages)rr'rrr�!test_command_packages_unspecifiedBsz6DistributionTestCase.test_command_packages_unspecifiedcCsfddlm}tj�ddddg�|��}|�|��ddd	g�|�d�}|�	||�|�|j
d
�dS)Nr)r
�--command-packageszfoo.bar,distutils.testsr
z
-Ssometextr*�foo.barzdistutils.testsZsometext)Zdistutils.tests.test_distr
r r!�extendr(r,r-Zget_command_obj�assertIsInstancer)rr
r'�cmdrrr�test_command_packages_cmdlineGs�
�
z2DistributionTestCase.test_command_packages_cmdlinec	Cs:tj�d�|�tjt�d}ttd��}td�	|�|d�W5QRXt
jjtddd��}|�
tg�}W5QRXt|f}|||||||||||||d�
}|�t|j�d����t|����|j�d���D]\}}|�|||�q�t
jjtdd	d��}|�
tg�}W5QRX|��D]}|�||j�di���qdS)
N�installz/somedir�wz�[install]
install-base = {0}
install-platbase = {0}
install-lib = {0}
install-platlib = {0}
install-purelib = {0}
install-headers = {0}
install-scripts = {0}
install-data = {0}
prefix = {0}
exec-prefix = {0}
home = {0}
user = {0}
root = {0}��filez/a)�prefix�base_prefix)
Zinstall_baseZinstall_platbaseZinstall_libZinstall_platlibZinstall_purelibZinstall_headersZinstall_scriptsZinstall_datar9�exec_prefix�home�user�rootz/b)r r!r+�
addCleanup�os�unlinkr�open�print�formatrZpatchZmultipler(r,�sortedZcommand_options�get�keys�items�assertNotIn)	rZfakepath�f�valuesr'�option_tupleZresult_dict�key�valuerrr�test_venv_install_optionsVsH
�
��
�z.DistributionTestCase.test_venv_install_optionscCs�tj�d�|�tjt�ttd�}zt	d|d�t	d|d�W5|��X|�
tg�}|�|��dddg�d	d
dgtjdd�<|�
tg�}|�|��dd
g�d	ddgtjdd�<|�
tg�}|�|��dg�dS)
Nr)r6z[global]r7z!command_packages = foo.bar, splatr*r0Zsplatr/Zsporkr�)
r r!r+r?r@rArrB�closerCr(r,r-)rrJr'rrr� test_command_packages_configfile�s&


�
�z5DistributionTestCase.test_command_packages_configfilecsbg��fdd�}|�ttdtj�|t_tddddid�d�}|�t��d�|�d	t|��dS)
Ncs��|�dSr)r+)�msg�Zwarnsrr�_warn�sz6DistributionTestCase.test_empty_options.<locals>._warn�warn�xxxZxxxx)Zauthor�name�versionZurl�options��attrsrrZ)	r?�setattr�warningsrVrr,�lenrI�dir)rrU�distrrTr�test_empty_options�s�
z'DistributionTestCase.test_empty_optionscCs�ddd�}t|d�}|��|�|jjddg�|�|jjddg�ddd�}t|d�}|��|�|jjdg�|�|jjdg�dS)N�one,two)�keywords�	platformsr[�one�twozfoo bar)rZfinalize_optionsr,�metadatarerd�rr\rarrr�test_finalize_options�s�
�
z*DistributionTestCase.test_finalize_optionscCs^t�}|�|jd�|��}|�|dg�|�|jdg�d|_|��}|�|dddg�dS)Nr*rcrfrg)rr,Zcommand_packagesr-)rraZcmdsrrr�test_get_command_packages�s�z.DistributionTestCase.test_get_command_packagescCs(t�}d}ddi}|�t|j||�dS)N)�ok�levelZok2)r�assertRaises�
ValueErrorZannounce)rra�args�kwargsrrr�
test_announce�sz"DistributionTestCase.test_announcec	s�|���tjdkr"tj��d�}ntj��d�}t|d��}|�d�W5QRX�fdd�}tjj}|tj_z*t�}|�	�}tdd	gid
�}|�	�}W5|tj_X|�
t|�dt|��dS)N�posix�.pydistutils.cfg�pydistutils.cfgr6z[distutils]
cs�Srr)�path�Z	temp_homerr�	_expander�szFDistributionTestCase.test_find_config_files_disable.<locals>._expanderZscript_argsz
--no-user-cfgr[r)�mkdtempr@rXrv�joinrB�write�
expanduserrrr,r_)r�
user_filenamerJrxZold_expanderr'Z	all_files�filesrrwr�test_find_config_files_disable�s 

z3DistributionTestCase.test_find_config_files_disable)r)rrrrr%r(r.r4rOrRrbrjrkrrr�
__classcell__rrr"rr,s
:rcs�eZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z�ZS)1�MetadataTestCasecs(tt|���tjtjdd�f|_dSr)rr�rr r!rr"rrrszMetadataTestCase.setUpcs2|jdt_|jdtjdd�<tt|���dSr$)r!r rr�r%rr"rrr%szMetadataTestCase.tearDowncCst��}|j�|�|��Sr)�io�StringIOrh�write_pkg_file�getvalue)rra�siorrr�format_metadatasz MetadataTestCase.format_metadatacCs\ddd�}t|�}|�|�}|�d|�|�d|���|�d|���|�d|���dS)N�package�1.0)rXrYzMetadata-Version: 1.0�	provides:�	requires:�
obsoletes:)rr��assertInrI�lower�rr\ra�metarrr�test_simple_metadatas�
z%MetadataTestCase.test_simple_metadatacCs|ddddgd�}t|�}|�|j��ddg�|�|��ddg�|�|�}|�d|�|�d|���|�d|���dS)Nr�r�zpackage.sub�rXrYZprovides�Metadata-Version: 1.1r�r�)rr,rhZget_providesr�r�rIr�r�rrr�
test_providess��
�
zMetadataTestCase.test_providescCs|�ttdddgd��dS)Nr�r��my.pkg (splat)r��rnrorrrrr�test_provides_illegal(s��z&MetadataTestCase.test_provides_illegalcCs�ddddgd�}t|�}|�|j��ddg�|�|��ddg�|�|�}|�d|�|�d|���|�d|�|�d	|�|�d
|���dS)Nr�r��otherzanother (==1.0)�rXrY�requiresr�r�zRequires: otherzRequires: another (==1.0)r�)rr,rhZget_requiresr�r�rIr�r�rrr�
test_requires.s"��
�
zMetadataTestCase.test_requirescCs|�ttdddgd��dS)Nr�r�r�r�r�rrrr�test_requires_illegal>s��z&MetadataTestCase.test_requires_illegalcCs,dtdg�d�}t|�}|�|jjt�dS)Nr�r�)rXr�)�iterrr2rhr��listrirrr�test_requires_to_listDs
�z&MetadataTestCase.test_requires_to_listcCs�ddddgd�}t|�}|�|j��ddg�|�|��ddg�|�|�}|�d|�|�d|���|�d|���|�d	|�|�d
|�dS)Nr�r�r�zanother (<1.0)�rXrY�	obsoletesr�r�r�zObsoletes: otherzObsoletes: another (<1.0))rr,rhZ
get_obsoletesr�r�rIr�r�rrr�test_obsoletesKs"��
�
zMetadataTestCase.test_obsoletescCs|�ttdddgd��dS)Nr�r�r�r�r�rrrr�test_obsoletes_illegal[s��z'MetadataTestCase.test_obsoletes_illegalcCs,dtdg�d�}t|�}|�|jjt�dS)Nr�r�)rXr�)r�rr2rhr�r�rirrr�test_obsoletes_to_listas
�z'MetadataTestCase.test_obsoletes_to_listcCsBdddgd�}t|�}|�|��dg�|�|�}|�d|�dS)N�Boa�3.0�#Programming Language :: Python :: 3�rXrY�classifiersr�)rr,Zget_classifiersr�r�r�rrr�test_classifiergs�
�
z MetadataTestCase.test_classifierc	Csbdddd�}t��}t|�}W5QRX|�d|���|�|jjt�|�|jjt|d��dS)Nr�r�)r�r��should be a listr�)	r	rr�r�r2rhr�r�r,�rr\�errorr'rrr�test_classifier_invalid_typeps�

�z-MetadataTestCase.test_classifier_invalid_typecCs4dddddgd�}t|�}|�|��dddg�dS)N�Montyr��spam�eggs�
life of brian�rXrYrd)rr,Zget_keywordsrirrr�
test_keywords|s�
�zMetadataTestCase.test_keywordsc	Csbdddd�}t��}t|�}W5QRX|�d|���|�|jjt�|�|jjt|d��dS)Nr�r�)r�r�r�r�r�rd)	r	rr�r�r2rhrdr�r,r�rrr�test_keywords_invalid_type�s�z+MetadataTestCase.test_keywords_invalid_typecCs0ddddgd�}t|�}|�|��ddg�dS)Nr�r��	GNU/Linux�Some Evil Platform�rXrYre)rr,Z
get_platformsrirrr�test_platforms�s�
�zMetadataTestCase.test_platformsc	Csbdddd�}t��}t|�}W5QRX|�d|���|�|jjt�|�|jjt|d��dS)Nr�r�)r�r�r�r�re)	r	rr�r�r2rhrer�r,r�rrr�test_platforms_invalid_types�s�z-MetadataTestCase.test_platforms_invalid_typescCs.dddd�}t|�}|�|�}|�d|�dS)Nr�r�zhttp://example.org/boa)rXrY�download_urlr�)rr�r�r�rrr�test_download_url�s�
z"MetadataTestCase.test_download_urlcCsDt�d�}dd|d�}t|�}|�|�}|�dd�}|�||�dS)Nzc        example::
              We start here
            and continue here
          and end here.r�r�)rXrY�long_descriptionz	
        �
)�textwrap�dedentrr��replacer�)rZ	long_descr\rar�rrr�test_long_description�s
�
z&MetadataTestCase.test_long_descriptionc	Cs�tjdkrd}nd}|��}tj�||�}t|d�}z|�d�W5|��Xzdt	�}t
jdkr~|tjd<|�
�}|�||�t
jdkr�|tjd	<|�
�}|�||d
||f�W5t�|�XdS)Nrsrtrur6�.)�linux�darwin�HOME�win32ZUSERPROFILEz%r not found in %r)r@rXryrvrzrBrQr{�removerr �platform�environrr�)rr}Ztemp_dirrJrar~rrr�test_custom_pydistutils�s,







�z(MetadataTestCase.test_custom_pydistutilscCs4ddg}t|�}|�|dd�|�|dd�dS)N)�a�b�cr')r���r)r�r�r�r)rr�r�)rr,)rZhelp_tuplesZ
fancy_optionsrrr�test_fix_help_options�sz&MetadataTestCase.test_fix_help_optionsc	Csj|�tjtjj�t�}gt_d|_d|_	t
��}|��W5QRXdd�|���
d�D�}|�|�dS)Nrzsetup.pycSsg|]}|��dkr|�qS)rP)�strip)�.0�linerrr�
<listcomp>�s�z3MetadataTestCase.test_show_help.<locals>.<listcomp>r�)r?rZ
set_thresholdZ_global_logZ	thresholdrr r!�helpZscript_namerr&r��splitZ
assertTrue)rra�s�outputrrr�test_show_help�szMetadataTestCase.test_show_helpcCs�dddddddgdgd	�}t|�}|j}t��}|�|�|�d
�|�|�|�|jd�|�|j	d�|�|j
d�|�|jd�|�|jddg�|�|j
dg�|�|jd�|�|jdg�dS)Nr�r�ZdescrWzhttp://example.comrfrgZfoo)rXrYr��descriptionr�rdr�rZUNKNOWN)rrhr�r�r��seekZ
read_pkg_filer,rXrYr�r�rdrer�r�)rr\rarhZPKG_INFOrrr�test_read_metadata�s,�


z#MetadataTestCase.test_read_metadata)rrrrr%r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr"rr��s0
	#r�cCs,t��}|�t�t��|�t�t��|Sr)�unittestZ	TestSuiteZaddTestZ	makeSuiterr�)Zsuiterrr�
test_suite	sr��__main__) r@r�r r�r^r�rZdistutils.distrrrZ
distutils.cmdrZtest.supportrrr	r
Zdistutils.testsrZ	distutilsrr
rZLoggingSilencerZTempdirManagerZEnvironGuardZTestCaserr�r�rrrrr�<module>s6�T�

F1le Man4ger