Current File : //opt/imh-python/lib/python2.7/test/test_os.pyc
�
��Wc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	yddl
Z
Wnek
r�dZ
nXddl
mZddlmZddlZddlZejddee�ejddee�dejfd��YZd	ejfd
��YZdejfd��YZdd
l
mZdejfd��YZdejfd��YZdejfd��YZdejfd��YZdejfd��YZ ej!d�dkZ"ej#e"d�dejfd��Y�Z$dejfd��YZ%ej&ej'dkd �d!ejfd"��Y�Z(d#ejfd$��YZ)ej#ej'dkd%�d&ejfd'��Y�Z*ej&ej'dkd �d(ejfd)��Y�Z+d*�Z,ed+kre,�ndS(,i����N(ttest_support(tassert_python_oktignorettempnamttmpnamt	FileTestscBs;eZd�ZeZd�Zd�Zejd��ZRS(cCs,tjjtj�r(tjtj�ndS(N(tostpathtexistsRtTESTFNtunlink(tself((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pytsetUpscCsOtjtjtjtjB�}tj|�|jtjtjtj	��dS(N(
RtopenRR	tO_CREATtO_RDWRtcloset
assertTruetaccesstW_OK(Rtf((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_access#s
cCs�tjtjtjtjB�}tj|�}zjd}x]||dkr�tj|�|d7}|dkr}|jd�n|tj|�}}q:WWdtj|�Xtj	||d�|j
ttj|d�dS(Niii
s%couldn't allocate two consecutive fdsita(
RR
RR	RRtdupRtskipTestt
closerangetassertRaisestOSErrortwrite(Rtfirsttsecondtretries((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_closerange(s

cCsZttj�}tj|�}|jttj|d�tj|�}|j	||�dS(Ni(
tunicodeRR	tsystgetrefcountRt	TypeErrorRtrenametassertEqual(RRtoldtnew((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_rename=s
(	t__name__t
__module__RttearDownRR Rtcpython_onlyR)(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRs
			tTemporaryFileTestscBs�eZd�Zd�Zd�Zejeed�d�d��Z	ejeed�d�d��Z
ejeed	�d
�d��ZRS(cCsg|_tjtj�dS(N(tfilesRtmkdirRR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRGs	cCs5x|jD]}tj|�q
Wtjtj�dS(N(R/RR
trmdirRR	(Rtname((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR,KscCs=|jtjj|�d�t|d�|jj|�dS(Ns&file already exists for temporary filetw(tassertFalseRRRR
R/tappend(RR2((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pytcheck_tempfilePs
Rstest needs os.tempnam()c	Cs�tj���tjddtd�tjddt�|jtj��tjtj	�}|j|�tjtj	d�}|j
tjj|�d dk�|j|�WdQXdS(NRRstest_os$tpfxi(
twarningstcatch_warningstfilterwarningstRuntimeWarningtDeprecationWarningR6RRRR	RRtbasename(RR2((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_tempnamXs

#ttmpfilestest needs os.tmpfile()c	Cs@tj��.tjddt�tjdkr�d}tjj|�rWtj	|�nyt
|d�}Wn]tk
r�}ytj�}Wn)t
k
r�}|j|j|j�nX|jd�dSX|j�tj	|�ntj�}|jd�|jdd�|j�}|j�|j|dk�WdQXdS(	NRR?twin32s \python_test_os_test_tmpfile.txtR3s&expected os.tmpfile() to raise OSErrortfoobari(R8R9R:R<R"tplatformRRRtremoveR
tIOErrorR?RR&targstfailRRtseektreadR(RR2tfpRRts((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_tmpfilegs.




Rstest needs os.tmpnam()c	Cs�tj��utjddtd�tjddt�tj�}tjdkrp|j	tj
j|�d�n
|j|�WdQXdS(NRRstest_os$R@s&file already exists for temporary file(swin32(
R8R9R:R;R<RRR"RBR4RRR6(RR2((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_tmpnam�s

(R*R+RR,R6tunittestt
skipUnlessthasattrRR>RKRL(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR.Fs			$$2tStatAttributeTestscBs"eZd�Zd�Zejeed�d�d��Zejeed�d�d��Z	d�Z
d	�Zejej
d
kd�ejeej�dkd
�d���Zejej
d
kd�ejeej�dkd
�d���Zejej
d
kd�d��ZRS(cCsXtjtj�tjjtjd�|_t|jd�}|jd�|j	�dS(Ntf1twbtABC(
RR0RR	RtjointfnameR
RR(RR((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR�s

cCs$tj|j�tjtj�dS(N(RR
RUR1RR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR,�ststatstest needs os.stat()cCsddl}tj|j�}|j||jd�|j|jd�t|�}x�t|�D]�}|d dkra|j�}|jd�r�d�}n	d�}|j|t	||��|t	||��|j
||�qaqaWy|d|jd�Wntk
rnXyd	|_
|jd�Wnttfk
rJnXyd	|_|jd�Wnttfk
r~nXyd	|_|jd�Wntk
r�nXy tjd�}|jd�Wntk
r�nXytjd�}Wntk
rnXdS(Ni����itST_tTIMEcSs
t|�S(N(tint(tx((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttrunc�scSs|S(N((RZ((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR[�si�sNo exception raisedii
iiiiiiii	iii
i(i
(iiiiiiiiii	i
iii
i(RVRRUR&tST_SIZEtst_sizetdirtlowertendswithtgetattrtassertInRFt
IndexErrortst_modetAttributeErrorR$tst_rdevtparrottstat_result(RRVtresulttmembersR2tattrR[tresult2((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_stat_attributes�sV	
			


tstatvfsstest needs os.statvfs()cCsdytj|j�}Wn5tk
rM}|jtjkrN|jd�qNnX|j|j|d�d}x;t	|�D]-\}}|jt
|d
|�||�qxWyd|_|jd�Wntk
r�nXyd|_
|jd�Wntk
rnXy tjd�}|jd�Wntk
r8nXytjd�}Wntk
r_nXdS( Ns%glibc always returns ENOSYS on AtheOSitbsizetfrsizetblockstbfreetbavailR/tffreetfavailtflagtnamemaxtf_isNo exception raisedi
iiiiiiii	iii
i(
RoRpRqRrRssfilesRtRuRvRw(i
(iiiiiiiiii	i
iii
i(RRnRURterrnotENOSYSRR&tf_bfreet	enumerateRaRFR$RgRetstatvfs_result(RRiteRjtvaluetmemberRl((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_statvfs_attributess:%	
	


cCswd}tjtj�}tjtj|jt|j|�f�tjtj�}|j|jt|j|��dS(Ni@B(	RRVRR	tutimetst_atimeRYtst_mtimeR&(Rtdeltatsttst2((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_utime_dir,s
)c
Cs�tjdkr�tjjtjj|��dd}ddl}|jj}|j	dd�}|j
|ddddd|t|��r�|j
SndS(NR@is\i����tid(R"RBRRt
splitdrivetabspathtctypestwindlltkernel32tcreate_string_buffertGetVolumeInformationAtNonetlenR(RtrootR�R�tbuf((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pytget_file_system7s&*R@sWin32 specific teststNTFSs
requires NTFScCsBd}tj|j||f�|jtj|j�j|�dS(Ng�g�E�A(RR�RUR&RVR�(Rtt1((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_1565150@scCsBd}tj|j||f�|jtj|j�j|�dS(NI�*(RR�RUR&RVR�(RR�((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_large_timeHscCsWytjd�Wn?tk
rR}|jdkrB|jd�n|jd�nXdS(Nsc:\pagefile.sysisc:\pagefile.sys does not existsCould not stat pagefile.sys(RRVtWindowsErrorRyRRF(RR~((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_1686475Ps(R*R+RR,RMRNRORRmR�R�R�R"RBRR	R�R�R�(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRP�s		$=$,			(t
mapping_teststEnvironTestscBsheZdZd
Zd�Zd�Zd�Zd�Zd�Z	e
jej
jd�d�d	��ZRS(s8check that os.environ object conform to mapping protocolcCsidd6dd6dd6S(NtVALUE1tKEY1tVALUE2tKEY2tVALUE3tKEY3((R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
_reference_scCstjj�tjS(N(Rtenvirontclear(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt_empty_mappingas
cCs#ttj�|_tjj�dS(N(tdictRR�t_EnvironTests__saveR�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRdscCs$tjj�tjj|j�dS(N(RR�R�tupdateR�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR,gs
cCsftjjd�rbtjjdd�tjd��)}|j�j�}|j|d�WdQXndS(Ns/bin/shtHELLOtWorlds/bin/sh -c 'echo $HELLO'(	RRRR�R�tpopenRHtstripR&(RR�R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_update2ls
tfreebsdtdarwins%due to known OS bug: see issue #13415cCsXtjdkr5dd}|jttjj|�nd}|jttjj|�dS(NR@RZiP�skey=(R"RBRt
ValueErrorRR�t__delitem__R(Rtkey((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_unset_errorus

N(R�sdarwin(R*R+t__doc__R�t	type2testR�R�RR,R�RMtskipIfR"RBt
startswithR�(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR�\s						t	WalkTestscBs eZdZd�Zd�ZRS(sTests for os.walk().cCslddl}ddlm}|tjd�}||d�}||d�}||d�}||d�}||d�}||d	�}	||d
�}
|tjd�}|tjdd�}|j|�|j|�|j|�xH|||	|fD]4}
t|
d
�}|jd|
d�|j�q�Wt	|d�rs|j
|jj|�|
�|d
gd	gf}n|gd	gf}t
|j|��}|jt|�d�|ddddk}|ddj�|j|d|ddgdgf�|j|d||dgdgf�|j|d||ggf�|j|dd||�g}xR|j|�D]A\}}}|j|||f�d|krz|jd�qzqzW|jt|�d�|j|d|dgdgf�|j|d|�t
|j|dt��}|jt|�d�|ddddk}|ddj�|j|d|ddgdgf�|j|||ggf�|j||d|dgdgf�|j|dd||�t	|d�rhxi|j|dt�D]B\}}}||
kr|j|g�|j|dg�PqqW|jd�ndS(Ni����(RTtTEST1tSUB1tSUB11tSUB2ttmp1ttmp2ttmp3tlinktTEST2ttmp4R3sI'm s" and proud of it.  Blame test_os.
tsymlinkiiiiittopdowntfollowlinkss+Didn't follow symlink with followlinks=True(Rtos.pathRTRR	tmakedirstfileRRROR�RR�tlisttwalkR&R�tsortR5RCtFalsetTrueRF(RRRTt	walk_patht	sub1_patht
sub11_patht	sub2_patht	tmp1_patht	tmp2_patht	tmp3_patht	link_pathtt2_patht	tmp4_pathRRt	sub2_treetalltflippedR�tdirsR/((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_traversal�sl


&'!#&'%cCs�x�tjtjdt�D]�\}}}x*|D]"}tjtjj||��q/WxR|D]J}tjj||�}tjj|�s�tj	|�q\tj|�q\WqWtj	tj�dS(NR�(
RR�RR	R�RCRRTtislinkR1(RR�R�R/R2tdirname((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR,�s(
 
(R*R+R�R�R,(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR��s	YtMakedirTestscBs#eZd�Zd�Zd�ZRS(cCstjtj�dS(N(RR0RR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR�sc	Cs�tj}tjj|ddd�}tj|�tjj|dddd�}tj|�|jttjtj�tjj|dddddtj�}tj|�tjj|dtjddddd�}tj|�dS(Ntdir1tdir2tdir3tdir4tdir5tdir6(	RR	RRRTR�RRtcurdir(RtbaseR((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_makedir�s	

'
cCsstjjtjdddddd�}x8tjj|�ra|tjkratjj|�}q*Wtj|�dS(NR�R�R�R�R�R�(RRRTRR	RR�t
removedirs(RR((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR,s
%(R*R+RR�R,(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR��s		tDevNullTestscBseZd�ZRS(cCs_ttjd�}|jd�|j�ttjd�}|j|j�d�|j�dS(NR3thellotrR�(R�RtdevnullRRR&RH(RR((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_devnulls

(R*R+R�(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR�stURandomTestscBs,eZd�Zd�Zd�Zd�ZRS(cCs�|jttjd��d�|jttjd��d�|jttjd��d�|jttjd��d�|jttjd��d�dS(Niii
idi�(R&R�Rturandom(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_urandom_lengths
cCs2tjd�}tjd�}|j||�dS(Ni(RR�tassertNotEqual(Rtdata1tdata2((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_urandom_value scCs�djdd|dddf�}tjd|g}tj|dtjd	tjd
tj�}|j�\}}|j|j�d|j�|f�t	|�}|jt
|�||�|S(Ns
simport os, syssdata = os.urandom(%s)ssys.stdout.write(repr(data))ssys.stdout.flush()s&print >> sys.stderr, (len(data), data)s-ctstdintstdouttstderri(RTR"t
executablet
subprocesstPopentPIPEtcommunicateR&twaittevalR�(Rtcounttcodetcmd_linetptoutterr((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pytget_urandom_subprocess%s%cCs2|jd�}|jd�}|j||�dS(Ni(RR�(RR�R�((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_urandom_subprocess7s(R*R+R�R�RR	(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR�s			tHAVE_GETENTROPYis+getentropy() does not use a file descriptortURandomFDTestscBs#eZejed�d��ZRS(s!test requires the resource modulecCsd}td|�dS(Ns�if 1:
            import errno
            import os
            import resource

            soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
            resource.setrlimit(resource.RLIMIT_NOFILE, (1, hard_limit))
            try:
                os.urandom(16)
            except OSError as e:
                assert e.errno == errno.EMFILE, e.errno
            else:
                raise AssertionError("OSError not raised")
            s-c(R(RR((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_urandom_failureBs(R*R+RMRNtresourceR(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR?stExecvpeTestscBseZd�ZRS(cCs |jttjdgd�dS(Ntnotepad(RR�RtexecvpeR�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_execvpe_with_bad_arglist\s(R*R+R(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRZsR@sWin32 specific teststWin32ErrorTestscBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs'|jttjtjtjd�dS(Ns.bak(RR�RR%RR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR)bscCs|jttjtj�dS(N(RR�RRCRR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_removeescCs|jttjtj�dS(N(RR�RtchdirRR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_chdirhscCsQttjd�}z|jttjtj�Wd|j�tjtj�XdS(NR3(	R
RR	RR�RR0RR
(RR((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_mkdirks

cCs |jttjtjd�dS(N(RR�RR�RR	R�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_utimesscCs |jttjtjd�dS(Ni(RR�RtchmodRR	(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_chmodvs(R*R+R)RRRRR(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR`s					t
TestInvalidFDc	Bs�eZdddddddddg	Zd	�Zx%eD]Zee�e�d
e<q7Wd�Zeje	e
d�d
�d��Zeje	e
d�d�d��Zeje	e
d�d�d��Z
eje	e
d�d�d��Zeje	e
d�d�d��Zeje	e
d�d�d��Zeje	e
d�d�d ��Zeje	e
d!�d"�d#��Zeje	e
d$�d%�d&��Zeje	e
d'�d(�d)��Zeje	e
d*�d+�d,��ZRS(-tfchdirtfdopenRt	fdatasynctfstattfstatvfstfsynct	tcgetpgrptttynamecs�fd�}|S(Ncs,tt��r(|jtt���ndS(N(RORtcheckRa(R(R(se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pythelpers((RR$((Rse/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
get_single~sttest_cGsXy|tj�|�Wn)tk
rB}|j|jtj�nX|jd|�dS(Ns4%r didn't raise a OSError with a bad file descriptor(Rtmake_bad_fdRR&RytEBADFRF(RRRER~((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR#�s	tisattystest needs os.isatty()cCs#|jtjtj��t�dS(N(R&RR)RR'R�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_isatty�sRstest needs os.closerange()cCs�tj�}x>td�D]0}ytj||�Wntk
rGqXPqW|dkrktjd��n|jtj	|||d�d�dS(Ni
is5Unable to acquire a range of invalid file descriptorsi(RR'trangeRRRRMtSkipTestR&RR�(Rtfdti((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyR �s
tdup2stest needs os.dup2()cCs|jtjd�dS(Ni(R#RR/(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt	test_dup2�stfchmodstest needs os.fchmod()cCs|jtjd�dS(Ni(R#RR1(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_fchmod�stfchownstest needs os.fchown()cCs|jtjdd�dS(Ni����(R#RR3(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_fchown�st	fpathconfstest needs os.fpathconf()cCs|jtjd�dS(NtPC_NAME_MAX(R#RR5(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_fpathconf�st	ftruncatestest needs os.ftruncate()cCs|jtjd�dS(Ni(R#RR8(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_ftruncate�stlseekstest needs os.lseek()cCs|jtjdd�dS(Ni(R#RR:(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_lseek�sRHstest needs os.read()cCs|jtjd�dS(Ni(R#RRH(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt	test_read�st	tcsetpgrpstest needs os.tcsetpgrp()cCs|jtjd�dS(Ni(R#RR=(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_tcsetpgrpt�sRstest needs os.write()cCs|jtjd�dS(Nt (R#RR(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_write�s(R*R+tsinglesR%RtlocalsR#RMRNRORR*R R0R2R4R7R9R;R<R>R@(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRys"	
		$$$$$$$$$$sPosix specific teststPosixUidGidTestscBs(eZejeed�d�d��Zejeed�d�d��Zejeed�d�d��Zejeed	�d
�d��Z	ejeed�d
�d��Z
ejeed�d
�d��Zejeed�d�d��Zejeed�d�d��Z
RS(tsetuidstest needs os.setuid()cCsHtj�dkr.|jtjtjd�n|jttjd�dS(Niii I(RtgetuidRterrorRDt
OverflowError(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_setuid�stsetgidstest needs os.setgid()cCsHtj�dkr.|jtjtjd�n|jttjd�dS(Niii I(RRERRFRIRG(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_setgid�stseteuidstest needs os.seteuid()cCsHtj�dkr.|jtjtjd�n|jttjd�dS(Niii I(RRERRFRKRG(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_seteuid�stsetegidstest needs os.setegid()cCsHtj�dkr.|jtjtjd�n|jttjd�dS(Niii I(RRERRFRMRG(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_setegid�stsetreuidstest needs os.setreuid()cCsgtj�dkr1|jtjtjdd�n|jttjdd�|jttjdd�dS(Niii II(RRERRFRORG(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_setreuid�scCstjtjddg�dS(Ns-cs,import os,sys;os.setreuid(-1,-1);sys.exit(0)(R�t
check_callR"R�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_setreuid_neg1�s	tsetregidstest needs os.setregid()cCsgtj�dkr1|jtjtjdd�n|jttjdd�|jttjdd�dS(Niii II(RRERRFRSRG(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_setregid�scCstjtjddg�dS(Ns-cs,import os,sys;os.setregid(-1,-1);sys.exit(0)(R�RQR"R�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_setregid_neg1�s	(R*R+RMRNRORRHRJRLRNRPRRRTRU(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRC�s$$$$$$$tWin32KillTestscBsMeZd�Zd�Zd�Zd�Zejd�d��Zd�Z	RS(cCsddl}ddlm}ddl}|jjj}|j|_|j|j	|j
�|j|j	|j�|j	|j�|j	|j�f|_d}t
jtjddj|�gdt
jdt
jdt
j�}|j|jj�|j|jj�|j|jj�d\}}	x�||	kr�|j�dkr�|jt|��}
||j|jj��|
|j|
�ddd�}|j|d	d�|
j r�|j!||
j �Pnt"j#d�|d
7}q!W|j$d�t%j&|j'|�|j!|j(�|�dS(Ni����(twintypestrunnings-cs<import sys;sys.stdout.write('{}');sys.stdout.flush();input()R�R�R�iidsPeekNamedPipe failedg�������?is1Did not receive communication from the subprocess(iid()R�RWtmsvcrtR�R�t
PeekNamedPipetBOOLtrestypetHANDLEtPOINTERtc_chartDWORDtargtypesR�R�R"R�tformatR�t
addCleanupR�RR�R�tpollR�R�R�t
get_osfhandletfilenotsizeofR�RR&ttimetsleepRFRtkilltpidR(RtsigR�RWRYRZtmsgtprocRtmaxR�trslt((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt_killsF		!	

cCs|jtj�dS(N(RqtsignaltSIGTERM(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_kill_sigterm8scCs|jd�dS(Nid(Rq(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt
test_kill_int<scCs6dtj�}tjdd|�}d|d<tjtjtjj	tjj
t�d�|gdtj�}d
\}}xZ||kr�|j
�dkr�|dd	kr�Pntjd
�|d7}q}W|jd�tj|j|�tjd
�|j
�s2tj|jtj�|jdj|��ndS(Ns
test_os_%si����it0iswin_console_handler.pyt
creationflagsit1g�?s'Subprocess didn't finish initializationssubprocess did not stop on {}(ii(tuuidtuuid1tmmapR�R�R"R�RRRTR�t__file__tCREATE_NEW_PROCESS_GROUPRdR�RhRiRFRjRkRrtSIGINTRb(RteventR2ttagnametmRnRRo((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt_kill_with_event@s&
!


s.subprocesses aren't inheriting Ctrl+C propertycCs�ddlm}ddl}|j|j��}|jjj}|j|j�|jf|_|j|_	||d�|j
tjd�dS(Ni����(RWitCTRL_C_EVENT(
R�RWR^tc_intR�R�tSetConsoleCtrlHandlerR[RaR\R�RrR�(RRWR�tNULLR�((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_CTRL_C_EVENT[s
cCs|jtjd�dS(NtCTRL_BREAK_EVENT(R�RrR�(R((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyttest_CTRL_BREAK_EVENTns(
R*R+RqRtRuR�RMtskipR�R�(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyRVs	6			cCs8tjtttttttt	t
ttt
tt�dS(N(Rtrun_unittestRR.RPR�R�R�R�R�RRRRRCRV(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt	test_mainrst__main__(-RRyRMR8R"RrR�t	sysconfigttextwrapRhR
tImportErrorR�ttestRttest.script_helperRR{RyR:R;R*tTestCaseRR.RPR�tBasicTestMappingProtocolR�R�R�R�R�tget_config_varR
R�RRRNRBRRRCRVR�(((se/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_os.pyt<module>sV

)q�%l!	&		N8q