%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_posix.pyc

ó
Nêáac@s?dZddlmZejdƒZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddl
Z
ddlZddlZejje
jƒejdƒZejddeƒdejfd	„ƒYZd
ejfd„ƒYZd„Zed
kr;eƒndS(sTest posix functionsiÿÿÿÿ(ttest_supporttposixNs-dummy-symlinktignores.* potential security risk .*tPosixTestercBseZd„Zd„Zd„Zejeedƒdƒd„ƒZ	ejeedƒdƒd„ƒZ
ejeed	ƒd
ƒd„ƒZejeed	ƒd
ƒd„ƒZejeed
ƒdƒd„ƒZ
ejeed
ƒdƒd„ƒZejeedƒdƒd„ƒZejeedƒdƒd„ƒZejeedƒdƒd„ƒZejeedƒdƒd„ƒZejeedƒdƒd„ƒZejeed ƒd!ƒd"„ƒZejeed#ƒd$ƒd%„ƒZd&„Zejeed'ƒd(ƒd)„ƒZejeed'ƒd(ƒd*„ƒZejeed'ƒokejjd+ƒd(ƒd,„ƒZejeed-ƒd.ƒd/„ƒZejeed0ƒd1ƒd2„ƒZejeed3ƒd4ƒd5„ƒZejeed6ƒd7ƒd8„ƒZ ejeed6ƒd7ƒejeed9ƒd:ƒd;„ƒƒZ!d<„Z"ejeed=ƒd>ƒd?„ƒZ#ejeed@ƒdAƒdB„ƒZ$ejeedCƒdDƒdE„ƒZ%ejeedFƒdGƒdH„ƒZ&ejeedIƒdJƒdK„ƒZ'ejeedLƒdMƒdN„ƒZ(ejeedOƒdPƒdQ„ƒZ)ejeedRƒdSƒdT„ƒZ*ejeedUƒdVƒdW„ƒZ+ejeedXƒdYƒdZ„ƒZ,ejeed[ƒd\ƒd]„ƒZ-ejeed^ƒd_ƒd`„ƒZ.da„Z/ejeedbƒdcƒdd„ƒZ0ejeedeƒdfƒdg„ƒZ1ejeedeƒdfƒdh„ƒZ2ejee3diƒdjƒdk„ƒZ4ejeedlƒdmƒdn„ƒZ5ejee3doƒdpƒdq„ƒZ6e7j8dr„ƒZ9ds„Z:RS(tcCs/ttjdƒ}|jƒtjg|_dS(Nsw+(topenRtTESTFNtclosetteardown_files(tselftfp((s+/usr/local/lib/python2.7/test/test_posix.pytsetUps
cCs%x|jD]}tj|ƒq
WdS(N(Rtostunlink(Rt
teardown_file((s+/usr/local/lib/python2.7/test/test_posix.pyttearDown#scCs©ddddddddd	d
ddd
ddg}tjƒdtjddtƒxI|D]A}tt|dƒ}|dk	rZ|ƒ|jt|dƒqZqZWWdQXdS(Ntctermidtgetcwdtgetcwdutunamettimest
getloadavgttmpnamtgetegidtgeteuidtgetgidt	getgroupstgetpidtgetpgrptgetppidtgetuidRti(	twarningstcatch_warningstfilterwarningstDeprecationWarningtgetattrRtNonetassertRaisest	TypeError(RtNO_ARG_FUNCTIONStnamet
posix_func((s+/usr/local/lib/python2.7/test/test_posix.pyttestNoArgFunctions's	

t	getresuidstest needs posix.getresuid()cCsGtjƒ}|jt|ƒdƒx|D]}|j|dƒq)WdS(Nii(RR+tassertEqualtlentassertGreaterEqual(Rtuser_idstval((s+/usr/local/lib/python2.7/test/test_posix.pyttest_getresuid8s
t	getresgidstest needs posix.getresgid()cCsGtjƒ}|jt|ƒdƒx|D]}|j|dƒq)WdS(Nii(RR2R,R-R.(Rt	group_idsR0((s+/usr/local/lib/python2.7/test/test_posix.pyttest_getresgid@s
t	setresuidstest needs posix.setresuid()cCsBtjƒ}|jtj|Œƒ|jtjdddƒƒdS(Niÿÿÿÿ(RR+tassertIsNoneR5(Rtcurrent_user_ids((s+/usr/local/lib/python2.7/test/test_posix.pyttest_setresuidHscCsLtjƒ}d|krH|ddddf}|jttj|ŒndS(Niiiÿÿÿÿ(RR+R%tOSErrorR5(RR7tnew_user_ids((s+/usr/local/lib/python2.7/test/test_posix.pyttest_setresuid_exceptionPst	setresgidstest needs posix.setresgid()cCsBtjƒ}|jtj|Œƒ|jtjdddƒƒdS(Niÿÿÿÿ(RR2R6R<(Rtcurrent_group_ids((s+/usr/local/lib/python2.7/test/test_posix.pyttest_setresgidYscCsLtjƒ}d|krH|ddddf}|jttj|ŒndS(Niiiÿÿÿÿ(RR2R%R9R<(RR=t
new_group_ids((s+/usr/local/lib/python2.7/test/test_posix.pyttest_setresgid_exceptionast
initgroupsstest needs os.initgroups()cCs|jttjƒ|jttjdƒ|jttjddƒ|jttjddtƒƒtjƒdkrytj	tjƒƒj
}Wn tk
r±tj
dƒ‚nXytj|dƒWn)tk
rñ}|j|jtjƒqX|jdƒndS(Nitfooisneed a pwd entryi
s+Expected OSError to be raised by initgroups(R%R&RRAR$tobjectRRtpwdtgetpwuidtpw_nametKeyErrortunittesttSkipTestR9R,terrnotEPERMtfail(RR(te((s+/usr/local/lib/python2.7/test/test_posix.pyttest_initgroupsjs
tstatvfsstest needs posix.statvfs()cCs|jtjtjƒƒdS(N(t
assertTrueRRORtcurdir(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_statvfsƒstfstatvfsstest needs posix.fstatvfs()cCsAttjƒ}z |jtj|jƒƒƒWd|jƒXdS(N(RRRRPRRStfilenoR(RR	((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_fstatvfsˆs t	ftruncatestest needs posix.ftruncate()cCsUttjdƒ}z1|jdƒ|jƒtj|jƒdƒWd|jƒXdS(Nsw+ttesti(	RRRtwritetflushRRVRTR(RR	((s+/usr/local/lib/python2.7/test/test_posix.pyttest_ftruncate‘s

tdupstest needs posix.dup()cCsWttjƒ}z6tj|jƒƒ}|j|tƒtj	|ƒWd|j	ƒXdS(N(
RRRRR[RTtassertIsInstancetintRR(RR	tfd((s+/usr/local/lib/python2.7/test/test_posix.pyttest_dupstconfstrstest needs posix.confstr()cCs?|jttjdƒ|jttjdƒƒdktƒdS(Nt
CS_garbagetCS_PATHi(R%t
ValueErrorRR`R,R-tTrue(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_confstr¨stdup2stest needs posix.dup2()cCsZttjƒ}ttjƒ}z tj|jƒ|jƒƒWd|jƒ|jƒXdS(N(RRRRRfRTR(Rtfp1tfp2((s+/usr/local/lib/python2.7/test/test_posix.pyt	test_dup2®s 
cGs8tjtjtjƒ}tj||Œ}|jƒdS(N(RRRRtO_RDONLYRtfdopenR(RtargsR^Rh((s+/usr/local/lib/python2.7/test/test_posix.pyt
fdopen_helper¹sRkstest needs posix.fdopen()cCs+|jƒ|jdƒ|jddƒdS(Ntrid(Rm(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_fdopen¾s

cCsªy,tjdtjƒ}|jtj|ƒWn6tk
rd}|j|jtjƒ|j	dƒnX|j
tƒ}tj|dƒWdQX|j|j
jtjƒdS(Nt.ssystem cannot open directoriesRn(RRRjt
addCleanupRR9R,RJtEACCEStskipTestR%tIOErrorRkt	exceptiontEISDIR(RR^RMtcm((s+/usr/local/lib/python2.7/test/test_posix.pyttest_fdopen_directoryÅstsunoscCsBtjtjtjƒ}|jttj|dƒtj	|ƒdS(Ntw(
RRRRRjR%R9RRkR(RR^((s+/usr/local/lib/python2.7/test/test_posix.pyt#test_fdopen_keeps_fd_open_on_errorsÒstO_EXLOCKstest needs posix.O_EXLOCKcCsÖtjtjtjtjBtjBƒ}|jttjtjtjtjBtj	Bƒtj
|ƒttdƒrÒtjtjtjtj
BtjBƒ}|jttjtjtjtjBtj	Bƒtj
|ƒndS(NtO_SHLOCK(RRRRtO_WRONLYR|tO_CREATR%R9t
O_NONBLOCKRthasattrRR}(RR^((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_osexlockÚs
R}stest needs posix.O_SHLOCKcCsÜtjtjtjtjBtjBƒ}tjtjtjtjBtjBƒ}tj|ƒtj|ƒtt	dƒrØtjtjtjtjBtjBƒ}|j
ttjtjtjtj
BtjBƒtj|ƒndS(NR|(RRRRR~R}RRRRR%R9RjR|R€(Rtfd1tfd2R^((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_osshlockês

tfstatstest needs posix.fstat()cCsAttjƒ}z |jtj|jƒƒƒWd|jƒXdS(N(RRRRPRR†RTR(RR	((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_fstatûs tstatstest needs posix.stat()cCs|jtjtjƒƒdS(N(RPRRˆRR(R((s+/usr/local/lib/python2.7/test/test_posix.pyt	test_statstmakedevstest needs posix.makedev()cCsÂtjtjƒ}|j}|j|ttfƒ|j|dƒtj	|ƒ}|j|ttfƒ|j|dƒ|j
tj	t|ƒƒ|ƒ|j
tj	t|ƒƒ|ƒ|jttj	t
|ƒƒ|jttj	ƒ|jttftj	dƒtj|ƒ}|j|ttfƒ|j|dƒ|j
tjt|ƒƒ|ƒ|j
tjt|ƒƒ|ƒ|jttjt
|ƒƒ|jttjƒ|jttftjdƒtjjdƒrë|dkrë|jdƒn|j
tj||ƒ|ƒ|j
tjt|ƒt|ƒƒ|ƒ|j
tjt|ƒt|ƒƒ|ƒ|jttjt
|ƒ|ƒ|jttj|t
|ƒƒ|jttj|ƒ|jttjƒdS(NiiÿÿÿÿtfreebsdIsEbpo-31044: on FreeBSD CURRENT, minor() truncates 64-bit dev to 32-bit(RRˆRRtst_devR\R]tlongR.tmajorR,R%R&tfloatRct
OverflowErrortminortsystplatformt
startswithRsRŠ(RtsttdevRŽR‘((s+/usr/local/lib/python2.7/test/test_posix.pyttest_makedev	s:	((c	s‡‡‡fd†}tjƒ}tjƒ}|ˆ||ƒ|||ƒ|ˆd|ƒ|||ƒ|ˆ|dƒ|||ƒ|dkrðd
}|ˆ||ƒ|||ƒ|ˆddƒ|||ƒ|ˆ||ƒ|||ƒn«tjƒdkrtjdƒ‚n‡ˆjt|ˆddƒ|||ƒˆjt|ˆddƒ|||ƒdtj	ƒkr›ˆjt|ˆddƒ|||ƒnxlt
tfD]^}ˆjt|ˆ||ƒ|ƒ|||ƒˆjt|ˆ|||ƒƒ|||ƒq¨Wd	S(s/Common code for chown, fchown and lchown tests.csEˆdk	rAˆˆƒ}ˆj|j|ƒˆj|j|ƒndS(N(R$R,tst_uidtst_gid(tuidtgidRˆ(tfirst_paramRt	stat_func(s+/usr/local/lib/python2.7/test/test_posix.pyt
check_stat1siÿÿÿÿiiisHP-UXtSunOSs1Skipping because of non-standard chown() behaviorNI€(sHP-UXRŸ(
RRRR“tsystemRHRIR%R9RtstrRR&(	Rt
chown_funcRœRRžRšR›t	big_valuett((RœRRs+/usr/local/lib/python2.7/test/test_posix.pyt_test_all_chown_common/s>







tchownstest needs os.chown()cCsntjtjƒ|jttjtjddƒttjdƒj	ƒ|j
tjtjttddƒƒdS(NiÿÿÿÿRzRˆ(
RRRRR%R9RR¦RRR¥R#R$(R((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_chownjs
tfchownstest needs os.fchown()cCsftjtjƒttjdƒ}z2|jƒ}|jtj|t	tddƒƒWd|jƒXdS(NRzR†(RRRRRRTR¥RR¨R#R$R(Rt	test_fileR^((s+/usr/local/lib/python2.7/test/test_posix.pyttest_fchownustlchownstest needs os.lchown()cCsLtjtjƒtjttjƒ|jtjtjt	tddƒƒdS(Ntlstat(RRRRtsymlinkt_DUMMY_SYMLINKR¥RR«R#R$(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_lchown‚stchdirstest needs posix.chdir()cCs-tjtjƒ|jttjtjƒdS(N(RR°RRQR%R9RR(R((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_chdirŠstlsdirstest needs posix.lsdir()cCs#|jtjtjtjƒƒdS(N(tassertInRRRR²RRQ(R((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_lsdirstaccessstest needs posix.access()cCs#|jtjtjtjƒƒdS(N(RPRRµRRRtR_OK(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_access“stumaskstest needs posix.umask()cCs0tjdƒ}|j|tƒtj|ƒdS(Ni(RR¸R\R](Rtold_mask((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_umask—ststrerrorstest needs posix.strerror()cCs|jtjdƒƒdS(Ni(RPRR»(R((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_strerrorstpipestest needs posix.pipe()cCs0tjƒ\}}tj|ƒtj|ƒdS(N(RR½RR(Rtreadertwriter((s+/usr/local/lib/python2.7/test/test_posix.pyt	test_pipe¢s
ttempnamstest needs posix.tempnam()cCsrtjƒ`tjddtƒ|jtjƒƒ|jtjtjƒƒ|jtjtjdƒƒWdQXdS(NRRÁtblah(	RR R!R"RPRRÁRRQ(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_tempnam¨s

ttmpfilestest needs posix.tmpfile()cCs@tjƒ.tjddtƒtjƒ}|jƒWdQXdS(NRRÄ(RR R!R"RRÄR(RR	((s+/usr/local/lib/python2.7/test/test_posix.pyttest_tmpfile±s
tutimestest needs posix.utime()cCsÁtjƒ}tjtjdƒ|jttjtjdƒ|jttjtj|dfƒ|jttjtjd|fƒtjtjt|ƒt|ƒfƒtjtj||fƒdS(N(NN(	ttimeRRÆRRR$R%R&R](Rtnow((s+/usr/local/lib/python2.7/test/test_posix.pyt
test_utime¹s""%c	Cstj|ƒ}|jt|dƒƒy|||jtjBƒWn>tk
r€}|jtjkrj‚nd}|j	|ƒnXzotj|ƒ}|j
|jtjB|jƒyt|dƒ}Wn)tk
rî}|j
|jtj
ƒnXWdtj||jƒXdS(Ntst_flagss2chflag UF_IMMUTABLE not supported by underlying fssw+(RRˆRPRRÊtUF_IMMUTABLER9RJt
EOPNOTSUPPRsR,RRtRKRtchflags(	Rtchflags_functtarget_fileR•terrtmsgtnew_stR^RM((s+/usr/local/lib/python2.7/test/test_posix.pyt_test_chflags_regular_fileÃs"RÍstest needs os.chflags()cCs|jtjtjƒdS(N(RÓRRÍRR(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_chflagsÚstlchflagsstest needs os.lchflags()cCs|jtjtjƒdS(N(RÓRRÕRR(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_lchflags_regular_fileÞscCs,tjtjƒ}|jt|dƒƒtjtjtƒ|jj	tƒtj
tƒ}ytjt|j
tjBƒWn>tk
r¸}|jtjkr¢‚nd}|j|ƒnXzXtjtjƒ}tj
tƒ}|j|j
|j
ƒ|j|j
tjB|j
ƒWdtjt|j
ƒXdS(NRÊs2chflag UF_IMMUTABLE not supported by underlying fs(RRˆRRRPRR­R®RtappendR¬RRÕRÊRËR9RJRÌRsR,(Rt	testfn_sttdummy_symlink_stRÐRÑt
new_testfn_sttnew_dummy_symlink_st((s+/usr/local/lib/python2.7/test/test_posix.pyttest_lchflags_symlinkâs(	tputenvsrequires os.putenv()c	Csv|jtƒtjddƒWdQX|jtƒtjddƒWdQX|jtƒtjddƒWdQXdS(NsFRUITVEGETABLEtcabbagetFRUITsorangeVEGETABLE=cabbagesFRUIT=ORANGEtlemon(R%R&RRÝRc(R((s+/usr/local/lib/python2.7/test/test_posix.pyttest_putenvsRstest needs posix.getcwd()cs¥d}tjƒ}tjjtjƒd}ytj|ƒtj|ƒWnˆjdƒnXz#d‡‡fd†‰ˆ|ƒWdtj|ƒt	j
|ƒXdS(Ns8getcwd-test-directory-0123456789abcdef-01234567890abcdefs.getcwds#cannot create directory for testingics5ytj|ƒWnˆjdƒnXtj|ƒzÞy8tjƒ|dkroˆ||t|ƒdƒnWnŸtk
r}tj}dt	j
kpµdt	j
kpµdt	j
k}|rÊtj}ndt	j
krûˆj|jtj
tjfƒqˆj|j|ƒnXWdtjdƒtj|ƒXdS(	Ns?mkdir cannot create directory sufficiently deep for getcwd testiiRytnetbsdtopenbsdtdarwins..(RtmkdirRsR°RR-R9RJtENAMETOOLONGR’R“tERANGER³tENOENTR,trmdir(tdirnametcurrent_path_lengthRMtexpected_errnotquirky_platform(t_create_and_do_getcwdR(s+/usr/local/lib/python2.7/test/test_posix.pyRîs,

"	"
(RRtpathtabspathRRRåR°Rstshutiltrmtree(RRêRQt	base_path((RîRs+/usr/local/lib/python2.7/test/test_posix.pyttest_getcwd_long_pathnames	s
!
Rstest needs os.getegid()cCstjdƒ%}|jƒjƒ}|jƒ}WdQX|dksI|r[tjdƒ‚ntj	dkrÌddl
}|jdƒpˆd}td„|j
dƒd	d
!DƒƒdkrÌtjd
ƒ‚qÌn|jtg|j
ƒD]}t|ƒ^qâƒttjƒtjƒgƒƒdS(Nsid -G 2>/dev/nullsneed working 'id -G'RäiÿÿÿÿtMACOSX_DEPLOYMENT_TARGETs10.0css|]}t|ƒVqdS(N(R](t.0tn((s+/usr/local/lib/python2.7/test/test_posix.pys	<genexpr>KsRpiii
is$getgroups(2) is broken prior to 10.6(i
i(RtpopentreadtstripRR$RHRIR’R“t	sysconfigtget_config_varttupletsplitR,tsetR]RRR(RtidgtgroupstretRûtdttx((s+/usr/local/lib/python2.7/test/test_posix.pyttest_getgroups>s,(cCs?tj}y|jtjƒWn$ttfk
rC|jdƒnX|d}|jtj|ƒtj|ƒd}z6|j
tƒ!tj|tj
tjBƒ}WdQXWd|dk	rÉtj|ƒnX|jtjj|ƒƒ|j
ttj|ƒ|jtjj|ƒƒt|dƒjƒ|j
ttj|ƒdS(Ns"Requires unicode filenames supportutwb(RtTESTFN_UNICODEtencodetTESTFN_ENCODINGtUnicodeErrorR&RsRqRR$R%RRR~RRtassertFalseRïtexistsRåRˆ(Rtfntfn_with_NULR^((s+/usr/local/lib/python2.7/test/test_posix.pyttest_path_with_null_unicodeVs&	

&cCstj}|d}|jtj|ƒtj|ƒd}z6|jtƒ!tj|tj	tj
Bƒ}WdQXWd|dk	rŽtj|ƒnX|jtj
j|ƒƒ|jttj|ƒ|jtj
j|ƒƒt|dƒjƒ|jttj|ƒdS(NsR(RRRqRR$R%R&RRR~RRRRïRRåRˆ(RR
RR^((s+/usr/local/lib/python2.7/test/test_posix.pyttest_path_with_null_bytems	

&(;t__name__t
__module__R
RR*RHt
skipUnlessRRR1R4R8R;R>R@RNRRRURZR_ReRiRmRoRxR’R“R”R{R‚R…R‡R‰R—R¥R§RªR¯R±R´R·RºR¼RÀRÃRÅRÉRÓRÔRÖRÜRRáRôRRtrequires_unicodeRR(((s+/usr/local/lib/python2.7/test/test_posix.pyRs’			

	'%	;$$
$$$$$$$
	$$$$	4$tPosixGroupsTestercBsbeZd„Zd„Zejeedƒdƒd„ƒZejeedƒdƒd„ƒZ	RS(cCsytjƒdkr$tjdƒ‚nttdƒsEtjdƒ‚ntjdkrftjdƒ‚ntjƒ|_dS(Nisnot enough privilegesRsneed posix.getgroupsRäsgetgroups(2) is broken on OSX(	RRRHRIRR’R“Rtsaved_groups(R((s+/usr/local/lib/python2.7/test/test_posix.pyR
‚scCsgttdƒr"tj|jƒnAttdƒrctjtjƒƒj}tj||jdƒndS(Nt	setgroupsRAi(	RRRRRDRERRFRA(RR(((s+/usr/local/lib/python2.7/test/test_posix.pyR‹s
RAstest needs posix.initgroups()cCs^t|jpdgƒd}tjtjƒƒj}tj||ƒ|j|tj	ƒƒdS(Nii(
tmaxRRDRERRRFRAR³R(RtgR(((s+/usr/local/lib/python2.7/test/test_posix.pyRN’sRstest needs posix.setgroups()cCsGx@dgtdƒgD])}tj|ƒ|j|tjƒƒqWdS(Nii(trangeRRtassertListEqualR(RR((s+/usr/local/lib/python2.7/test/test_posix.pyttest_setgroupsœs
(
RRR
RRHRRRRNR(((s+/usr/local/lib/python2.7/test/test_posix.pyR€s				cCstjttƒdS(N(Rtrun_unittestRR(((s+/usr/local/lib/python2.7/test/test_posix.pyt	test_main¤st__main__(t__doc__RWRt
import_moduleRRJR’RÇRR“RDRñRˆttempfileRHRRïtjoint
gettempdirRR®R!tRuntimeWarningtTestCaseRRRR(((s+/usr/local/lib/python2.7/test/test_posix.pyt<module>s2ÿÿg$	

Zerion Mini Shell 1.0