%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/distutils/tests/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/distutils/tests/__pycache__/test_exec_command.cpython-39.pyc

a

z[yc��@s�ddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
Gdd�d�ZGd	d
�d
�ZGdd�d�Zd
d�Zdd�ZGdd�d�ZdS)�N)�
TemporaryFile)�exec_command)�
get_pythonexe)�tempdir�assert_�assert_warns)�StringIOc@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
�redirect_stdoutz9Context manager to redirect stdout for exec_command test.NcCs|ptj|_dS�N)�sys�stdout�_stdout)�selfr�r�M/usr/lib64/python3.9/site-packages/numpy/distutils/tests/test_exec_command.py�__init__szredirect_stdout.__init__cCstj|_|jt_dSr
)rr�
old_stdoutr
�rrrr�	__enter__szredirect_stdout.__enter__cCs |j��|jt_|j��dSr
)r
�flushrrr�close�r�exc_type�	exc_value�	tracebackrrr�__exit__s
zredirect_stdout.__exit__)N��__name__�
__module__�__qualname__�__doc__rrrrrrrr	
s
r	c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
�redirect_stderrz9Context manager to redirect stderr for exec_command test.NcCs|ptj|_dSr
)r�stderr�_stderr)rr"rrrrszredirect_stderr.__init__cCstj|_|jt_dSr
)rr"�
old_stderrr#rrrrr!szredirect_stderr.__enter__cCs |j��|jt_|j��dSr
)r#rr$rr"rrrrrr%s
zredirect_stderr.__exit__)Nrrrrrr!s
r!c@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�emulate_nonposixz.Context manager to emulate os.name != 'posix' �	non-posixcCs
||_dSr
)�	_new_name)rZosnamerrrr-szemulate_nonposix.__init__cCstj|_|jt_dSr
)�os�name�	_old_namer'rrrrr0szemulate_nonposix.__enter__cCs|jt_dSr
)r*r(r)rrrrr4szemulate_nonposix.__exit__N)r&rrrrrr%+s
r%cCsFtt���ltt���Btt��t�d�Wd�n1s@0YWd�n1s^0YWd�n1s|0Ytjdk�rBt	���tt���ltt���Btt��t�d�Wd�n1s�0YWd�n1s�0YWd�n1�s0YWd�n1�s80YdS)N�cd '.'�posix)
r	rr!rr�DeprecationWarningrr(r)r%rrrr�test_exec_command_stdout8s
d
r.cCsJttdd���ltt���Btt��t�d�Wd�n1sD0YWd�n1sb0YWd�n1s�0Ytjdk�rFt	���tt���ltt���Btt��t�d�Wd�n1s�0YWd�n1s�0YWd�n1�s0YWd�n1�s<0YdS)Nzw+)�moder+r,)
r	rr!rrr-rr(r)r%rrrr�test_exec_command_stderrPs
d
r0c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestExecCommandcCst�|_dSr
)r�pyexerrrr�setup_methodaszTestExecCommand.setup_methodcKsVt�d�\}}t|dk�t|dk�t�d|j�\}}t|dk�t|dk�dS)Nzcmd /C echo path=%path%r�z3"%s" -c "import sys;sys.stderr.write(sys.platform)"�win32)rrr2�r�kws�s�orrr�check_ntds�zTestExecCommand.check_ntcKstjdi|��\}}t|dk�t|dk�tjdi|��\}}t|dk�t|dk�tjdddi|��\}}t|dk�t|dk�tjdi|��\}}t|dk�t|dk�d	tjv�r�d
tjd	<tjdi|��\}}t|dk�t|d
k�tjdd	di|��\}}t|dk�t|dk�tjdi|��\}}t|dk�t|d
k�tjd	=tjdi|��\}}t|dk�t|dk�tjdi|��\}}t|dk�t|dk�tjdi|��\}}t|dk�t|dk�tjd|jfi|��\}}t|dk�t|dk�dS)N�
echo Hellor�Hello�	echo $AAAr4�echo "$AAA"ZAAAZTereZBBBZHi�echo "$BBB"ZHey�this_is_not_a_command�echo path=$PATHz1"%s" -c "import sys,os;sys.stderr.write(os.name)"r,)r;)r=)r>)r>)r?)r?)r?)r?)r@)rA)rrr(�environr2r6rrr�check_posixnsT
���
zTestExecCommand.check_posixcGs�tjd|jfi|��\}}t|dk�t|dk�tjd|jfi|��\}}t|dk�t|dk�tjd|jfi|��\}}t|dk�t|dk�tjd|jfi|��\}}t|dk�t|d	k�dS)
Nz"%s" -c "raise 'Ignore me.'"rr4zV"%s" -c "import sys;sys.stderr.write('0');sys.stderr.write('1');sys.stderr.write('2')"Z012z!"%s" -c "import sys;sys.exit(15)"�z"%s" -c "print('Heipa'")ZHeipa)rr2rr6rrr�check_basic�s<��
���
��
��
zTestExecCommand.check_basicc	Ks�t���}d}tj�||�}t|d��}|�d�Wd�n1sD0Ytjd|j|ffi|��\}}t|dk�t|dk�tjd|j|ffd|i|��\}}t|dk�t|dk�Wd�n1s�0YdS)	N�file�wr<z("%s" -c "f = open('%s', 'r'); f.close()"rr4z9"%s" -c "f = open('%s', 'r'); print(f.read()); f.close()"Z
execute_in)	rr(�path�join�open�writerr2r)rr7Ztmpdir�fnZtmpfile�fr8r9rrr�check_execute_in�s2(���
����
z TestExecCommand.check_execute_inc
Cs�tt����tt����tt��ntjdkrF|jdd�|jdd�n"tjdkrh|jdd�|jdd�|j	dd�|j	dd�Wd�n1s�0YWd�n1s�0YWd�n1s�0YdS)Nr,r)Zuse_tee��nt)
r	rr!rr-r(r)rCr:rNrrrr�
test_basic�s


zTestExecCommand.test_basicN)	rrrr3r:rCrErNrQrrrrr1`s
4r1)r(rZtempfilerZnumpy.distutilsrZnumpy.distutils.exec_commandrZ
numpy.testingrrr�iorr	r!r%r.r0r1rrrr�<module>s


Zerion Mini Shell 1.0