403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.230
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_venv.cpython-36.pyc
3

x2_G�@s*dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
mZmZddlZddlZyddlZWnek
r�dZYnXyddlZWnek
r�dZYnXejejejkd�Zddd�ZGdd�dej�ZGd	d
�d
e�ZeGdd�de��Zed
k�r&ej�dS)z|
Test harness for the venv module.

Copyright (C) 2011-2012 Vinay Sajip.
Licensed to the PSF under a contributor agreement.
�N)�captured_stdout�captured_stderr�
requires_zlib�can_symlink�EnvironmentVarGuard�rmtreezTest not appropriate in a venvcCsBtj|tjtj|d�}|j�\}}|jr:tj|j|||��||fS)N)�stdout�stderr�encoding)�
subprocess�Popen�PIPEZcommunicate�
returncode�CalledProcessError)�cmdr
�p�out�err�r�3/opt/alt/python36/lib64/python3.6/test/test_venv.py�check_output#src@s<eZdZdZdZdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�BaseTestzBase class for venv tests.�P�2cCs�tjjtj��|_tjdkr0d|_d
|_d|_	n$d|_ddt
jdd�f|_d	|_	t
jd
krtdtj
krttj
d}nt
j}tjj|�d|_dS)N�nt�Scripts�Lib�Include�bin�libzpython%d.%d��include�darwin�__PYVENV_LAUNCHER__�)r���)�os�path�realpath�tempfileZmkdtemp�env_dir�name�bindirrr!�sys�version_info�platform�environ�
executable�split�exe)�selfr1rrr�setUp2s
zBaseTest.setUpcCst|j�dS)N)rr*)r4rrr�tearDownBszBaseTest.tearDowncOs>t��"}t��}|||�WdQRXWdQRX|j�|j�fS)N)rr�getvalue)r4�func�args�kwargs�output�errorrrr�run_with_captureEszBaseTest.run_with_capturecGstjj|jf|��S)N)r&r'�joinr*)r4r9rrr�get_env_fileKszBaseTest.get_env_filec	Gs(t|j|�d��}|j�}WdQRX|S)N�r)�openr?�read)r4r9�f�resultrrr�get_text_file_contentsNszBaseTest.get_text_file_contentsNi�)
�__name__�
__module__�__qualname__�__doc__ZmaxDiffr5r6r=r?rErrrrr.src	@s�eZdZdZdd�Zdd�Zdd�Zedd	��Ze	j
d
kr@d0Zn4d1d2d3dde	jdd�fdde	jdd�dffZdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zeje�d!�d"d#��Zed$d%��Zeje�d!�d&d'��Zejejd(kd)�d*d+��ZdS)4�	BasicTestzTest venv module functionality.cGs |j|�}|jtjj|��dS)N)r?�
assertTruer&r'�isdir)r4r9�fnrrrrLVs
zBasicTest.isdircCsDt|j�|jtj|j�|j|j�|j|j�|j|j�|j	d�}t
jd�dkohtj
dkohtjdk}|r�|jtjj|��n|jtjj|��|jd�}tjdkr�dtjkr�tjd}ntj}tjj|�}|jd||�|j	|j|j�}tjj|��s(|j	|j�}td	|�td
tj|��|jtjj|�d|�dS)
zB
        Test the create function with default arguments.
        �lib64�P��posixr"z
pyvenv.cfgr#z	home = %szContents of %r:z    %rzFile %r should exist.N)rr*r=�venv�createrLr,r!rr?�structZcalcsizer&r+r-r/rKr'�islink�assertFalse�existsrEr0r1�dirname�assertInr3�print�listdir)r4rZ
conditions�datar1r'rM�bdrrr�
test_defaultsZs0



zBasicTest.test_defaultscCsbtjj|j�d}tj�}|j|j�}|j|jd|�tjdd�}|j|j�}|j|jd�dS)Nr$z(%s) z	My prompt)�promptz(My prompt) )	r&r'r2r*rR�
EnvBuilderZensure_directories�assertEqualr_)r4Zenv_name�builder�contextrrr�test_promptzszBasicTest.test_promptcCs�|jtjtj�|jtjtj�t|j�|jt	j
|j�tjj
|j|j|j�}|ddg}x\d|jfd|jfdtjfdtjffD]4\}}d||d<t|�\}}|j|j�|j��q�WdS)z>
        Test that the prefix values are as expected.
        z-cN�prefix�base_prefix�base_exec_prefixzimport sys; print(sys.%s)r )rar-rfrerg�exec_prefixrr*r=rRrSr&r'r>r,r3r�strip�encode)r4�envpyrreZexpectedrrrrr�
test_prefixes�s

zBasicTest.test_prefixesZwin32rrr�
site-packagesrr!rzpython%d.%dNr c
Cs^xX|D]P}tjj|jf|��}tj|�tjj||�}t|d��}|jd�WdQRXqWdS)zn
        Create some files in the environment which are unrelated
        to the virtual environment.
        �wbsStill here?N)r&r'r>r*�mkdirrA�write)r4�paths�filename�subdirs�drMrCrrr�create_contents�s

zBasicTest.create_contentscCs�|j|jd�tj|j�x^|jD]T}tjj|jf|d��}|jtjj	|��t
|d��}|j|j�d�WdQRXq"Wtj
dd�}|j|j�x8|jD].}tjj|jf|d��}|jtjj	|��q�WdS)	zE
        Test creating environment in an existing directory.
        �foo�rbsStill here?NT)�clear)rv)rv)ru�ENV_SUBDIRSrRrSr*r&r'r>rKrWrArarBr`rV)r4rsrMrCrbrrr�test_overwrite_existing�sz!BasicTest.test_overwrite_existingcCs^xXtj|�D]J}tjj||�}tjj|�s6tjj|�rBtj|�qtjj|�rt|�qWdS)N)	r&r[r'r>rU�isfile�removerLr)r4r'rMrrr�clear_directory�szBasicTest.clear_directorycCsrxl|jdd�D]Z}tjj|jf|��}t|d��}|jd�WdQRX|jtt	ft
j|j�|j|j�qWdS)N�rn�)
ryr&r'r>r*rArpZassertRaises�
ValueError�OSErrorrRrSr})r4rqrMrCrrr�test_unoverwritable_fails�sz#BasicTest.test_unoverwritable_failscCs�x�dD]�}tj|d�}|j|j|j�|j|j�|j|j�|j|j�|j	|j|j
�}tjj
|�s�|j	|j�}td|�tdtj|��|jtjj
|�d|�qWdS)	zC
        Test upgrading an existing environment directory.
        FT)�upgradezContents of %r:z    %rzFile %r should exist.N)FT)rRr`r=rSr*rLr,r!rr?r3r&r'rWrZr[rK)r4r�rbrMr]rrr�test_upgrade�s
zBasicTest.test_upgradecCsJxDdD]<\}}tjd|d�}|j|j�|jd�}|jd||�qWdS)z:
        Test isolation from system site-packages
        T�trueF�false)rx�system_site_packagesz
pyvenv.cfgz"include-system-site-packages = %s
N�Tr��Fr�)r�r�)rRr`rSr*rErY)r4Zssp�srbr\rrr�test_isolation�s

zBasicTest.test_isolationzNeeds symlinkscCsRxLdD]D}tjd|d�}|j|j�|j|j|j�}|r|jtj	j
|��qWdS)z3
        Test symlinking works as expected
        FT)rx�symlinksN)FT)rRr`rSr*r?r,r3rKr&r'rU)r4ZuslrbrMrrr�test_symlinking�s
zBasicTest.test_symlinkingcCsbt|j�|jtj|j�tjjtjj|j�|j	|j
�}t|ddg�\}}|j|j
�|j��dS)zD
        Test that the sys.executable value is as expected.
        z-cz!import sys; print(sys.executable)N)rr*r=rRrSr&r'r>r(r,r3rrarirj)r4rkrrrrr�test_executable
s
zBasicTest.test_executablecCslt|j�tjddd�}|j|j�tjjtjj|j�|j	|j
�}t|ddg�\}}|j|j
�|j��dS)zD
        Test that the sys.executable value is as expected.
        T)rxr�z-cz!import sys; print(sys.executable)N)rr*rRr`rSr&r'r>r(r,r3rrarirj)r4rbrkrrrrr�test_executable_symlinkss
z"BasicTest.test_executable_symlinksrzonly relevant on WindowscCs�t|j�tjjtjj|j�d�}tjdd�}|j|�tjj||j	d�}tjj||j	|j
�}t|d|j
ddgdd	�\}}|j|j
�d
�dS)z0
        Test handling of Unicode paths
        uϼўТλФЙT)rxzactivate.bat�&z-czprint(0)Zoem)r
�0N)rr*r&r'r>r(rRr`rSr,r3rrari)r4r*rbZactivaterkrrrrr�test_unicode_in_batch_file(s

z$BasicTest.test_unicode_in_batch_file�r�r�r�rrm)r�r�r�r�)r)r!)r)rFrGrHrIrLr^rd�
skipInVenvrlr-r/ryr.rurzr}r�r�r��unittest�
skipUnlessrr�r�r�r&r+r�rrrrrJSs2 
	

rJc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	j
ed�e	j
ed
�e
dd����ZdS)�
EnsurePipTestz%Test venv module installation of pip.cCsdtjjtjj|j�|j|j�}t|ddg�\}}|jd�}|j	|d�|jd�}|j	|j
�d�dS)Nz-cz1try:
 import pip
except ImportError:
 print("OK")zlatin-1�ZOK)r&r'r>r(r*r,r3r�decoderari)r4rkrrrrr�assert_pip_not_installed<s

z&EnsurePipTest.assert_pip_not_installedcCs&t|j�|jtj|j�|j�dS)N)rr*r=rRrSr�)r4rrr�test_no_pip_by_defaultIs
z$EnsurePipTest.test_no_pip_by_defaultcCs*t|j�|jtj|jdd�|j�dS)NF)�with_pip)rr*r=rRrSr�)r4rrr�test_explicit_no_pipNs
z"EnsurePipTest.test_explicit_no_pipc
Csdttjd��}|j|j�d�WdQRXtjj�dkrL|jtjjtj��n|j	tjjtj��dS)NrwrZnul)
rAr&�devnullrarB�lowerrVr'rWrK)r4rCrrr�test_devnullSs
zEnsurePipTest.test_devnullc)Cs2t|j�t����}d|d<d|d<tj���}||d<d}d}d}xX|fD]N\}}tjj||�}	tj|	�tjj|	|�}
t	|
d��}|j
|�WdQRXqJWy|jtj
|j|dd
�WnJtjk
�r}z*|jjdd�}
d}|j|j||
��WYdd}~XnXWdQRXWdQRXtjjtjj|j�|j|j�}t|dddg�\}}|jd�}|j|d�|jd�}djtj��}|j|dt|��|�tj|j�jd�}|j||�t��}t|ddg�\}}WdQRX|jd�}tjdd|tj d�}|j|j!�d�|jd�}|jd|�|jd|�|�s.|j"�dS)N�eZPYTHONWARNINGS�1ZPIP_NO_INSTALL�HOMEz[global]
no-install=1�pip�pip.ini�.pip�pip.conf�wT)r�r��replace)�errorsz{}

**Subprocess Output**
{}z-Imz	--versionzlatin-1r�zpip {}zensurepip._uninstallzN^The directory .* or its parent directory is not owned by the current user .*$)�flagszSuccessfully uninstalled pipz#Successfully uninstalled setuptools)r�r�)r�r�)#rr*rr)ZTemporaryDirectoryr&r'r>rorArpr=rRrSrrr;r�Zfail�formatr(r,r3rra�	ensurepip�version�len�fsencoderY�re�sub�	MULTILINE�rstripr�)r4r�ZenvvarsZhome_dirZ
bad_configZwin_locationZposix_locationrXZfname�dirpathZfpathrC�excZdetails�msgrkrrZexpected_versionr*rrr�do_test_with_pipasV



8



zEnsurePipTest.do_test_with_pipz@some dependencies of pip import threading module unconditionallyzpip requires ctypescCs|jd�|jd�dS)NFT)r�)r4rrr�
test_with_pip�s
zEnsurePipTest.test_with_pipN)rFrGrHrIr�r�r�r�r�r�r��	threading�ctypesrr�rrrrr�9s
T

r��__main__)N) rIr�r&Zos.pathr�rTrr-r)Ztest.supportrrrrrrr�rRr��ImportErrorr�ZskipIfrerfr�rZTestCaserrJr�rF�mainrrrr�<module>s< 


%g


Youez - 2016 - github.com/yon3zu
LinuXploit