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: //proc/thread-self/root/usr/local/lib/python3.7/test/__pycache__/test_ensurepip.cpython-37.pyc
B

��gP'�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	ZGdd�dej
�ZGdd�d�ZGdd�deej
�Z
ejejfdd	��ZGd
d�deej
�ZdejZGd
d�deej
�ZGdd�deej
�Zedkr�e��dS)�Nc@seZdZdd�ZdS)�TestEnsurePipVersioncCs|�tjt���dS)N)�assertEqual�	ensurepip�_PIP_VERSION�version)�self�r�//usr/local/lib/python3.7/test/test_ensurepip.py�test_returns_versionsz)TestEnsurePipVersion.test_returns_versionN)�__name__�
__module__�__qualname__r
rrrr	r
src@seZdZdd�ZdS)�EnsurepipMixincCsttj�d�}|��|_d|j_|�|j�tj	}tj�d�}|��}|�|j�||_	tj
|_
tj��|_
|_dS)Nzensurepip._run_piprzensurepip.os)�unittest�mockZpatch�start�run_pip�return_valueZ
addCleanup�stop�os�devnull�path�environ�copy�
os_environ)rZ
run_pip_patchZreal_devnullZos_patchZ
patched_osrrr	�setUps
zEnsurepipMixin.setUpN)rrr
rrrrr	rsrc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
TestBootstrapc	CsPt��|j�ddddtjjddgtjj�|jjdd}|�t	|�d	�dS)
N�installz--no-cache-dirz
--no-indexz--find-links�
setuptools�pipr��)
r�	bootstrapr�assert_called_once_withrr�ANY�	call_argsr�len)r�additional_pathsrrr	�test_basic_bootstrapping&s
z&TestBootstrap.test_basic_bootstrappingcCs8tjdd�|j�ddddtjjdddd	g	tjj�dS)
Nz	/foo/bar/)�rootrz--no-cache-dirz
--no-indexz--find-linksz--rootrr)rr"rr#rrr$)rrrr	�test_bootstrapping_with_root4s
z*TestBootstrap.test_bootstrapping_with_rootc
Cs6tjdd�|j�ddddtjjddd	gtjj�dS)
NT)�userrz--no-cache-dirz
--no-indexz--find-linksz--userrr)rr"rr#rrr$)rrrr	�test_bootstrapping_with_user@s
z*TestBootstrap.test_bootstrapping_with_userc
Cs6tjdd�|j�ddddtjjddd	gtjj�dS)
NT)Zupgraderz--no-cache-dirz
--no-indexz--find-linksz	--upgraderr)rr"rr#rrr$)rrrr	�test_bootstrapping_with_upgradeKs
z-TestBootstrap.test_bootstrapping_with_upgradec
Cs6tjdd�|j�ddddtjjddd	gtjj�dS)
Nr )�	verbosityrz--no-cache-dirz
--no-indexz--find-linksz-vrr)rr"rr#rrr$)rrrr	�#test_bootstrapping_with_verbosity_1Vs
z1TestBootstrap.test_bootstrapping_with_verbosity_1c
Cs6tjdd�|j�ddddtjjddd	gtjj�dS)
Nr!)r.rz--no-cache-dirz
--no-indexz--find-linksz-vvrr)rr"rr#rrr$)rrrr	�#test_bootstrapping_with_verbosity_2as
z1TestBootstrap.test_bootstrapping_with_verbosity_2c
Cs6tjdd�|j�ddddtjjddd	gtjj�dS)
N�)r.rz--no-cache-dirz
--no-indexz--find-linksz-vvvrr)rr"rr#rrr$)rrrr	�#test_bootstrapping_with_verbosity_3ls
z1TestBootstrap.test_bootstrapping_with_verbosity_3cCst��|�|jdd�dS)N�ENSUREPIP_OPTIONSr)rr"rr)rrrr	�'test_bootstrapping_with_regular_installwsz5TestBootstrap.test_bootstrapping_with_regular_installcCs"tjdd�|�|jdd�dS)NT)�
altinstallr3r5)rr"rr)rrrr	�#test_bootstrapping_with_alt_install{sz1TestBootstrap.test_bootstrapping_with_alt_installcCstjdd�|�d|j�dS)NT)�default_pipr3)rr"�assertNotInr)rrrr	�#test_bootstrapping_with_default_pipsz1TestBootstrap.test_bootstrapping_with_default_pipc	Cs6|�t��tjddd�WdQRX|�|jj�dS)NT)r5r7)�assertRaises�
ValueErrorrr"�assertFalser�called)rrrr	�$test_altinstall_default_pip_conflict�sz2TestBootstrap.test_altinstall_default_pip_conflictcCs$d|jd<t��|�d|j�dS)Nztest fodder�PIP_THIS_SHOULD_GO_AWAY)rrr"r8)rrrr	�&test_pip_environment_variables_removed�s
z4TestBootstrap.test_pip_environment_variables_removedcCs t��|�|jdtj�dS)N�PIP_CONFIG_FILE)rr"rrrr)rrrr	�test_pip_config_file_disabled�sz+TestBootstrap.test_pip_config_file_disabledN)rrr
r(r*r,r-r/r0r2r4r6r9r>r@rBrrrr	r$src	#sr�dkrd}nG�fdd�d�}|�}t�}tj�d|�}|tjd<z
|VWd||krbtjd=n
|tjd<XdS)NcseZdZ�ZdS)zfake_pip.<locals>.FakePipN)rrr
�__version__r)rrr	�FakePip�srDr)�object�sys�modules�get)rrrD�sentinelZorig_pipr)rr	�fake_pip�s


rJc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
TestUninstallc	Cs.td��t��WdQRX|�|jj�dS)N)rJr�_uninstall_helperr<rr=)rrrr	�)test_uninstall_skipped_when_not_installed�s
z7TestUninstall.test_uninstall_skipped_when_not_installedc
Cs\td��$tj���}t��WdQRXWdQRX|����}|�d|�|�	|j
j�dS)Nznot a valid versionz!only uninstall a matching version)rJ�test�supportZcaptured_stderrrrL�getvalue�stripZassertInr<rr=)r�stderrZwarningrrr	�5test_uninstall_skipped_with_warning_for_wrong_version�s
zCTestUninstall.test_uninstall_skipped_with_warning_for_wrong_versionc	Cs4t��t��WdQRX|j�dddddg�dS)N�	uninstallz-yz--disable-pip-version-checkrr)rJrrLrr#)rrrr	�test_uninstall�s
zTestUninstall.test_uninstallc	Cs:t��tjdd�WdQRX|j�ddddddg�dS)	Nr )r.rTz-yz--disable-pip-version-checkz-vrr)rJrrLrr#)rrrr	�test_uninstall_with_verbosity_1�s

z-TestUninstall.test_uninstall_with_verbosity_1c	Cs:t��tjdd�WdQRX|j�ddddddg�dS)	Nr!)r.rTz-yz--disable-pip-version-checkz-vvrr)rJrrLrr#)rrrr	�test_uninstall_with_verbosity_2�s

z-TestUninstall.test_uninstall_with_verbosity_2c	Cs:t��tjdd�WdQRX|j�ddddddg�dS)	Nr1)r.rTz-yz--disable-pip-version-checkz-vvvrr)rJrrLrr#)rrrr	�test_uninstall_with_verbosity_3�s
z-TestUninstall.test_uninstall_with_verbosity_3c	Cs6d|jd<t��t��WdQRX|�d|j�dS)Nztest fodderr?)rrJrrLr8)rrrr	r@�s
z4TestUninstall.test_pip_environment_variables_removedc	Cs2t��t��WdQRX|�|jdtj�dS)NrA)rJrrLrrrr)rrrr	rB�sz+TestUninstall.test_pip_config_file_disabledN)rrr
rMrSrUrVrWrXr@rBrrrr	rK�s	rKzpip c@s$eZdZdd�Zdd�Zdd�ZdS)�TestBootstrappingMainFunctionc
Csbtj���(}|�t��t�dg�WdQRXWdQRX|����}|�	|t
�|�|jj
�dS)Nz	--version)rNrO�captured_stdoutr:�
SystemExitr�_mainrPrQr�EXPECTED_VERSION_OUTPUTr<rr=)r�stdout�resultrrr	�test_bootstrap_version�s z4TestBootstrappingMainFunction.test_bootstrap_versionc	Cs^t�g�}|j�ddddtjjddgtjj�|jjdd}|�t	|�d	�|�|d�dS)
Nrz--no-cache-dirz
--no-indexz--find-linksrrrr r!)
rr\rr#rrr$r%rr&)r�	exit_coder'rrr	r(s

z6TestBootstrappingMainFunction.test_basic_bootstrappingcCs"d|j_t�g�}|�|d�dS)Nr!)rrrr\r)rrarrr	�test_bootstrapping_error_codes
z;TestBootstrappingMainFunction.test_bootstrapping_error_codeN)rrr
r`r(rbrrrr	rY�srYc@s$eZdZdd�Zdd�Zdd�ZdS)�TestUninstallationMainFunctionc
Csdtj���*}|�t��tj�dg�WdQRXWdQRX|���	�}|�
|t�|�|j
j�dS)Nz	--version)rNrOrZr:r[r�
_uninstallr\rPrQrr]r<rr=)rr^r_rrr	�test_uninstall_versions"z5TestUninstallationMainFunction.test_uninstall_versionc	CsDt��tj�g�}WdQRX|j�dddddg�|�|d�dS)NrTz-yz--disable-pip-version-checkrrr)rJrrdr\rr#r)rrarrr	�test_basic_uninstall!sz3TestUninstallationMainFunction.test_basic_uninstallc	Cs6t��d|j_tj�g�}WdQRX|�|d�dS)Nr!)rJrrrrdr\r)rrarrr	�test_uninstall_error_code.sz8TestUninstallationMainFunction.test_uninstall_error_codeN)rrr
rerfrgrrrr	rcs
rc�__main__)rZ
unittest.mockZtest.supportrNrZos.path�
contextlibrFrZensurepip._uninstallZTestCaserrr�contextmanagerrrJrKr]rYrcr�mainrrrr	�<module>s&qN