Current File : //opt/imh-python/lib/python2.7/test/test_pty.pyo
�
��Wc@sddlmZmZmZed�Zed�ddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZdZ
dZer�d�Zn	d�Zd	�Zd
ejfd��YZdejfd
��YZdd�Zedkre�ndS(i����(tverbosetrun_unittestt
import_moduletfcntlttermiosNsI wish to buy a fish license.
sFor my pet fish, Eric.
cCs	|GHdS(N((tmsg((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pytdebugscCsdS(N((R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyRscCsB|jd�r|jdd�S|jd�r>|jdd�S|S(Ns

s
s
(tendswithtreplace(tdata((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pytnormalize_outputs
tPtyTestcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs,tjtj|j�|_tjd�dS(Ni
(tsignaltSIGALRMt
handle_sigt	old_alarmtalarm(tself((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pytsetUp5scCs'tjd�tjtj|j�dS(Ni(RRR
R(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyttearDown;s
cCs|jd�dS(Nsisatty hung(tfail(Rtsigtframe((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyR@scCs�ybtd�tj�\}}td||f�td|f�tj|�}td|�Wntk
r�tjd�nX|jtj	|�d�t
j
|t
j�}t
j
|t
j|tj
B�y&tj|d�}|jd|�Wn+tk
r }|jtjkr!�q!nXt
j
|t
j|�td	�tj|t�tj|d�}|jd
t|��td�tj|td �tj|td�tj|d�}|jd
t|��tj|�tj|�dS(NsCalling master_open()s#Got master_fd '%d', slave_name '%s'sCalling slave_open(%r)sGot slave_fd '%d's,Pseudo-terminals (seemingly) not functional.sslave_fd is not a ttyitsWriting to slave_fdsI wish to buy a fish license.
sWriting chunked outputisFor my pet fish, Eric.
(Rtptytmaster_opent
slave_opentOSErrortunittesttSkipTestt
assertTruetostisattyRtF_GETFLtF_SETFLt
O_NONBLOCKtreadtassertEqualterrnotEAGAINtwritet
TEST_STRING_1R
t
TEST_STRING_2tclose(Rt	master_fdt
slave_nametslave_fdt
orig_flagsts1tets2((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyt
test_basicCs@



	


cCstd�tj�\}}|tjkr�tjd�sTtd�tjd�ntd�ytj�WnRtk
r�td�nOt	k
r�td�n5td�tjd�nXtd	�tjd
�tjd�ntd|�x[t
rSytj|d
�}Wntk
r)PnX|s4Pntj
j|jdd��q�Wtj|d�\}}|d?}td|||f�|dkr�|jd�nT|d
kr�|jd�n8|dkr�|jd�n|dkr�|jd�ntj|�dS(Nscalling pty.fork()isChild's fd 1 is not a tty?!isIn child, calling os.setsid()sGood: OSError was raised.sNo setsid() available?sAn unexpected error was raised.sos.setsid() succeeded! (bad!)iis!Waiting for child (%d) to finish.iPs
s
iis&Child (%d) exited with status %d (%d).s3Child raised an unexpected exception in os.setsid()s1pty.fork() failed to make child a session leader.s8Child spawned by pty.fork() did not have a tty as stdouts&pty.fork() failed for unknown reasons.(RRtforktCHILDRR t_exittsetsidRtAttributeErrortTrueR$tsyststdoutR(RtwaitpidRR+(RtpidR,R	tstatustres((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyt	test_forkrsT









	
 

(t__name__t
__module__RRRR3R@(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyR4s
				/t
SmallPtyTestscBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s)These tests don't spawn children or hang.cCsCtj|_tj|_tj|_g|_g|_g|_	dS(N(
RtSTDIN_FILENOtorig_stdin_filenot
STDOUT_FILENOtorig_stdout_filenotselecttorig_pty_selecttfdstselect_rfds_lengthstselect_rfds_results(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyR�s		cCsW|jt_|jt_|jt_x,|jD]!}ytj	|�Wq.q.Xq.WdS(N(
RERRDRGRFRIRHRJRR+(Rtfd((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyR�scCs tj�}|jj|�|S(N(RtpipeRJtextend(Rtpipe_fds((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyt_pipe�scCs;|j|jjd�t|��|jjd�ggfS(Ni(R%RKtpoptlenRL(Rtrfdstwfdstxfds((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyt_mock_select�s"c	Cs�|j�\}}|t_|j�\}}|t_tj�}g|D]}|j�^qI}|jj|�t	j
|dd�t	j
|d�|jt_|j
jd�|jj||dg�|j
jd�|jt��tj|d�WdQXtj||dgggd�d}|j||dg|�|jt	j|d�d�|jt	j|dd�d�dS(s6Test the normal data case on both master_fd and stdin.isfrom masters
from stdiniiNi(RQRRFRDtsockett
socketpairtfilenoRJRORR(RWRHRKtappendRLtassertRaisest
IndexErrort_copyR%R$(	Rtread_from_stdout_fdtmock_stdout_fdt
mock_stdin_fdtwrite_to_stdin_fdRYtstmastersRT((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyttest__copy_to_each�s&		&cCs|j�\}}|t_|j�\}}|t_tj�}g|D]}|j�^qI}|jj|�t	j
|d�|dj
�t	j
|�|jt_|j
jd�|jj||dg�|j
jd�|jt��tj|d�WdQXdS(s9Test the empty read EOF case on both master_fd and stdin.iiiN(RQRRFRDRXRYRZRJRORR+RWRHRKR[RLR\R]R^(RR_R`RaRbRYRcRd((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyttest__copy_eof_on_alls 		
(	RARBt__doc__RRRQRWReRf(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyRC�s		
			cCsttt�dS(N(RRCR(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyt	test_mainst__main__(ttest.test_supportRRRRR&RRR:RHRRXRR)R*RR
tTestCaseRRCtNoneRhRA(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_pty.pyt<module>s*
		�V