python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_os.cpython-312.pyc

ΑeHddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$	ddl%Z%	ddl'Z'	ddl(Z(	ddl)Z)e)jTDcgc]}|jVc}Z,	dd	l.m/Z/m0Z0	ddl2Z2dd
l3m4Z4ddlm5Z5ddl6m7Z7d
Z8e9e	dre	jtdk(Z8e9edr<ejvjxr&ejvjxj{dZ>nd
Z>ejFj{dxre	j~dk(Z@dZAddZBejejFj{ddZDdZEGddejZGGddejZHGddejZIGddejZJddlmKZKGd d!eKjZMGd"d#ejZNeje9e	d$d%Gd&d'eNZPGd(d)eNZQeje9e	d$d%Gd*d+ePZRGd,d-ejZSejGd.d/ejZUGd0d1ejZVejejd2Gd3d4ejZXGd5d6ejZYeje9e	d7d8Gd9d:ejZZejd;d<k(xs,ejd=d<k(xsejd>d<k(Z\eje\d?ejejFd@k(dAGdBdCejZ]ejddDZ_eje9e	dEdFGdGdHejZ`ejejFdIk(dJGdKdLejZaejejdMGdNdOejZbeje9e	dPdQGdRdSejZcejejFdIk(dTGdUdVejZdejejFdIk(dTGdWdXejZeejejFdIk(dJGdYdZejZfejejFdIk(dJGd[d\ejZgeje	jd]k(d^Gd_d`ejZieje9e	dadbGdcddejZjejejFdIk(dJejGdedfejZlejejFdIk(dJGdgdhejZmejejFdIk(dJGdidjejZnejGdkdlejZoGdmdnejZpGdodpejZqejGdqdrejZsejGdsdtejZtejdueje9e	dvdwGdxdyejZveje9e	dzxr	e9e	d{d|Gd}d~ejZweje9e	ddGddejZydZzejezdejdddGddejZ|eje9e	ddGddejZ}eje9e	ddejddGddejZ~eje9e	ddejdddGddejZGddejZGddejZejGddejZGddejZeje9e	ddejejdejejFdIk(dGddejZGddejZGddejZGddejZGddejZGddejZejGddejZe9e	drGddeZedk(rejyy#e&$rdZ%Y
OwxYw#e&$rdZ'Y
XwxYw#e&$rdZ(Y
awxYwcc}w#e&e-f$rgZ,Y
HwxYw#e&$rejbxZ/Z0Y
YwxYw#e&$rdZ2Y
bwxYw)N)support)
import_helper)	os_helper)
socket_helper)set_recursion_limit)warnings_helper)win32_is_iot)INT_MAXPY_SSIZE_T_MAXassert_python_ok)
unix_shell)FakePathFgeteuidthread_infolinuxthreadsfreebsdcPtjtt|d|zS)Nzrequires os.%s)unittest
skipUnlesshasattrosnames @/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_os.pyrequires_os_funcrYs"wr402BT2IJJcjt|dd5}|j|dddy#1swYyxYw)Nxbr)openwrite)filenamecontentfps   rcreate_filer%]s1	
ha	 B
s)2aixz%on AIX, splice() only accepts socketsc.tjdyN)asyncioset_event_loop_policyrrtearDownModuler,gs!!$'rceZdZdZdZdZy)	MiscTestscXtj}|j|tyr()rgetcwdassertIsInstancestrselfcwds  rtest_getcwdzMiscTests.test_getcwdlsiikc3'rc`d}tjdk(rd}d}d}|d|t|z
zz}tj5}tj|5}|}	tj}|j|||t|ttjjzz
}|dkrnft||kDr
|dkDr|d|}tjj||}	tj|tj||}t&j(rt+dt|ddddddy#t$rYCt $r(}	|	j"t"j$k(rYd}	~	md}	~	wwxYw#1swYPxYw#1swYyxYw)	Nivxworkspython_test_dir_arz!Tested current directory length: )sysplatformlentempfileTemporaryDirectoryr
change_cwdrr0assertEqualpathsepjoinmkdirchdirFileNotFoundErrorOSErrorerrnoENAMETOOLONGrverboseprint)
r4min_lendirlendirnametmpdirrDexpectedr5needexcs
          rtest_getcwd_long_pathzMiscTests.test_getcwd_long_pathps<<9$G$SFS\$9:;

(
(
*"	Jf%%f-!
J))+C$$S(3"c#hRWW[[1A&ABDqy7|d*tax")%4.77<<g6D" $H7:??=c#hZHIC!
J"	J"	J(-""99(:(::!!	"1!
J!
J"	J"	JsaF$BF5*E*F	F$	F#F%F-F
FFFFF!	F$$F-ctj}|j|t|j	tj
|tjyr()rgetcwdbr1bytesrCfsdecoder0r3s  rtest_getcwdbzMiscTests.test_getcwdbs<jjlc5)S)299;7rN)__name__
__module____qualname__r6rVr[r+rrr.r.ks(7Jr8rr.ceZdZdZeZdZejejdejejddZejdZ
dZejejeekdej$ed	zd
dd
ZdZdZejej.dk(ddZdZdZdZdZdZejeedddZ ejeedddZ!ejeedddZ"ejeedddZ#ejeedde$d Z%ejeedde$d!Z&ejeedde$d"Z'y#)$	FileTestsctjjtjr$tj
tjyyr()rrDlexistsrTESTFNunlinkr4s rsetUpzFileTests.setUps/
77??9++,IIi&&'-rc6tjtjtjtj
z}tj||jtjtjtjyr()
rr rrcO_CREATO_RDWRclose
assertTrueaccessW_OKr4fs  rtest_accesszFileTests.test_accesssQGGI$$bjj&:;
		)"2"2BGG<=rz"Test is unstable under Emscripten.zWASI does not support dup.cFtjtjtjtj
z}tj|}	d}||dzk7rPtj||dz
}|dkDr|jd|tj|}}||dzk7rPtj|tj||dz|jttj|dy#tj|wxYw)Nr
z%couldn't allocate two consecutive fdsa)
rr rrcrhriduprjskipTest
closerangeassertRaisesrJr!)r4firstsecondretriess    rtest_closerangezFileTests.test_closeranges	(("**RYY*>?
	GEAI%1R<MM"IJ &vv
EAI%
HHV


eUQY''288UD9
HHVs
AD		D ctj}tj|}|j	t
tj|dtj|}|j||yNr)	rrcr=getrefcountry	TypeErrorrrenamerC)r4rDoldnews    rtest_renamezFileTests.test_renamesQood#)RYYa8ood#c"rcttjd5}|jd|j	|j}t
j|ddt
j|d}|jt|t|j|ddddy#1swYyxYw)Nw+bspamr)r rrcr!flushfilenorlseekreadrCtyperY)r4fobjfdss    r	test_readzFileTests.test_reads
)""E
*	)dJJwJJLBHHRAAAT!We,Q(	)	)	)sBB44B=zneeds INT_MAX < PY_SSIZE_T_MAXrsrrF)sizememusedry_runc^|jtjtjt	tjdttjd5}t
j|j|}ddd|jdy#1swYxYw)Nstestrb)

addCleanuprrdrcr%r rrrrC)r4rr$datas    rtest_large_readzFileTests.test_large_reads	
	(()*:*:;I$$g.)""D
)	.R77299;-D	.
	
w'	.	.s#%B##B,cftjtjtjtj
z}|j
ttj|dtj|dtj|tdtj|tdtj|ttjd5}|j|jjgddddy#1swYyxYw)Nbeanssbacon
seggs
sspam
r)sbaconseggsr)rr rrcrhO_WRONLYryrr!	bytearray
memoryviewrjrCr
splitlines)r4rrs   r
test_writezFileTests.test_writes
WWY%%rzzBKK'?
@)RXXr7;
Z 
Yy)*
Z	*+

)""D
)	.TTYY[335,
.	.	.	.s-1D''D0cttj|tjd}|j|dy)NT)
creationflagsshellr)
subprocesscallCREATE_NEW_CONSOLErC)r4argsretcodes   rwrite_windows_consolezFileTests.write_windows_consoles0//$$77	
	
!$rwin32z$test specific to the Windows consolecd}|jtjd||jtjdd|y)Nzprint('x' * 100000)-cz-u)rr=
executabler4codes  rtest_write_windows_consolez$FileTests.test_write_windows_consoles7%""3>>4>""3>>4tDrctjtjtj}tj
|g|ddi}|j
y)Nencodingutf-8)rr rrcO_RDONLYfdopenrj)r4rrros    r
fdopen_helperzFileTests.fdopen_helpers=
WWY%%r{{
3IIb242'2		rctjtjtjtj
z}tj||j|jd|jddy)Nrd)rr rrcrhrirjrr4rs  rtest_fdopenzFileTests.test_fdopensZ
WWY%%rzz"))';
<
33$rcFtjdz}|jtjtj|jtj|t	tjdt	|dtjtj||jtt
jtjt|dd5}|j|jddddy#1swYyxYw)Nz.212rrr1)
rrcrrdr%rreplaceryrIstatr rCr)r4TESTFN2ros   rtest_replacezFileTests.test_replace's""T)	(()*:*:;	(('2I$$d+GT"


9##W-+RWWi6F6FG
'3
1	,QQVVXs+	,	,	,s-!DD ctjttjdd}tj|y)N)rDflagsmodedir_fd)rr __file__rrjrns  rtest_open_keywordszFileTests.test_open_keywords4s(GG5

rctjtd}	|dtjddy#t
tf$rYywxYw)NsymlinktargetF)srcdsttarget_is_directoryr)r
get_attributerrrcNotImplementedErrorrJ)r4rs  rtest_symlink_keywordszFileTests.test_symlink_keywords9sG''I6	i&6&6$)$
8#W-		s7A	A	copy_file_rangeztest needs os.copy_file_range()c|jt5tjddddddy#1swYyxYwNrrri)ry
ValueErrorrrres r#test_copy_file_range_invalid_valuesz-FileTests.test_copy_file_range_invalid_valuesAs7


z
*	*q!S)	*	*	*	7Acptjdz}d}ttj||jtjtjttjd}|j|j|j}t|d}|jtj||j|j|j}	tj||d}|j|tddt|d5}|j|j|d|dddy#1swYyxYw#t$r9}|jtj k7r|j#|Yd}~yd}~wwxYw)N.3
0123456789rrr)rrcr%rrdr rjrrrassertInrangerCrrJrKENOSYSrw)	r4rrin_filein_fdout_fileout_fdies	         rtest_copy_file_rangezFileTests.test_copy_file_rangeFsL""T)I$$d+	(()*:*:;y''.

& '	(('2'"	;""5&!4A
MM!U1a[)gt$
;  bq:
;
;
;	ww%,,&MM!
	s$;E3:$E''E03	F5</F00F5ctjdz}d}d}d}d}ttj||jtjtjttjd}|j|j|j}t|d}|jtj||j|j|j}		tj||	|||}
|j|
td	|d
zt|d5}|j}ddd|jd|d|z|j||d||||
zy#1swY=xYw#t$r9}|jtj k7r|j#|Yd}~yd}~wwxYw)N.4rrrrr)
offset_src
offset_dstrrr)rrcr%rrdr rjrrrrrrrCrJrKrrw)
r4TESTFN4r
bytes_to_copyin_skipout_seekrrrrrrrs
             rtest_copy_file_range_offsetz%FileTests.test_copy_file_range_offseths""T)
I$$d+	(()*:*:;y''.

& '	(('2'"	6""5&-.5.68A
MM!U1mAo67gt$
&||~
&
T)8_gh.>?
T()_!''!)4
6

&
&	ww%,,&MM!
	s$FFF	G!(/GG!spliceztest needs os.splice()c|jt5tjddddddy#1swYyxYwr)ryrrrres rtest_splice_invalid_valuesz$FileTests.test_splice_invalid_valuess5


z
*	!IIaC 	!	!	!rctjdz}d}ttj||jtjtjttjd}|j|j|j}tj\|jfd|jfd	tj|d}|j|tdd|jtjd	|d|y#t$r9}|j t j"k7r|j%|Yd}~yd}~wwxYw)
Nrrrc.tjSr(rrjread_fdsr<lambda>z'FileTests.test_splice.<locals>.<lambda> 1rc.tjSr(rwrite_fdsrrz'FileTests.test_splice.<locals>.<lambda> 2rrrrr)rrcr%rrdr rjrrpiperrrrCrrJrKrrw)	r4rrrrrrrrs	       @@rtest_splicezFileTests.test_splices ""T)I$$d+	(()*:*:;y''.

& GGI1223	>		%1-A
MM!U1a[)RWWWc2D!H=	ww%,,&MM!
	s%E	F/E??Fc*
tjdz}d}d}d}ttj||jtjtjttjd}|j|j|j}tj\
|j
fd|jfd	tj|||}|j|td	|d
ztj
d}|j|||||zy#t$r9}	|	j t j"k7r|j%|	Yd}	~	yd}	~	wwxYw)Nrrrrrc.tjSr(rrsrrz1FileTests.test_splice_offset_in.<locals>.<lambda>rrc.tjSr(rrsrrz1FileTests.test_splice_offset_in.<locals>.<lambda>rr)rrrrr)rrcr%rrdr rjrrrrrrrrCrJrKrrw)r4rrrrrrrrrrrs          @@rtest_splice_offset_inzFileTests.test_splice_offset_ins=""T)
I$$d+	(()*:*:;y''.

& GGI1223	<		%=WMA
MM!U1mAo67777C(D
T4	#:;	ww%,,&MM!
	s)E	F/F

Fctjdz}d}d}d}ttj||jtjtjtj\|jfd|jfdtj|t|d}|jtj||j|j|j}	tj|||}|j|td	|d
zt|d5}|j}	ddd|j	d|d|z|j|	|d|d|y#1swY:xYw#t $r9}
|
j"t"j$k7r|j'|
Yd}
~
yd}
~
wwxYw)
Nrrrrc.tjSr(rrsrrz2FileTests.test_splice_offset_out.<locals>.<lambda>rrc.tjSr(rrsrrz2FileTests.test_splice_offset_out.<locals>.<lambda>rrr)rrrrrr)rrcr%rrdrrr!r rjrrrrrrCrJrKrrw)
r4rrrrrrrrrrrrs
           @@rtest_splice_offset_outz FileTests.test_splice_offset_outs""T)
I$$d+	(()*:*:;GGI1223
4 '	(('2'"	8		'6=XNA
MM!U1mAo67gt$
&||~
&
T)8_gh.>?
T()_d2Ah7

&
&	ww%,,&MM!
	s$F+FF(+	G-4/G((G-N)(r\r]r^rftearDownrprskipIfr
is_emscriptenis_wasir}cpython_onlyrrrr
r
bigmemtestrrrr=r>rrrrrrrrrrrrrequires_splice_piperr	r
r+rrr`r`s}(H>
X__CX__5::*
##)
X>19;WWr\!UC(D;(
.%X0?AEAE
%,
X%679Z[*\*X%679Z[;\;BX%679Z[*6\*6XXX.0HI!J!XX.0HI>J>>XX.0HI"<J"<HXX.0HI'8J'8rr`cfeZdZdZdZdZdZdZeje
edddZeje
edd	d
Z
ejejdk(dd
Zejejdk(deje
edddZdZejejdk(ddZejejdk(ddZejejdk(ddZy)StatAttributeTestsctj|_|jtj|jt|jdy)NABC)rrcfnamerrdr%res rrfzStatAttributeTests.setUps5%%
	(($**5DJJ'rc	tj|}|j|tjd|j|jdt|}ttD]x}|dddk(s|j
}|jdrd}nd}|j|t|||tt||j||zdjD]@}tt||dz}t||dzd	z}|j||d
B	t|jdz}|jd	z}|j||d
	|d|j!d
	d|_|j!d
	d|_|j!d
	d|_|j!d
	tj,d}	|j!d
	tj,d}	y#t$rYwxYw#t"$rYwxYw#t$rYwxYw#tt(f$rYwxYw#t$rYwxYw#t($rYswxYw#t($rYywxYw)NrST_TIMEct|Sr()intxs rtruncz7StatAttributeTests.check_stat_attributes.<locals>.trunc!s
Q-rc|Sr(r+rs rr!z7StatAttributeTests.check_stat_attributes.<locals>.trunc#s(rzst_atime st_mtime st_ctimei_nsi'rtdeltar:No exception raisedrrrsrrrrtrrrr	rs
)rrrCST_SIZEst_sizedirlowerendswithgetattrrsplitrassertAlmostEqualst_birthtimest_birthtime_nsAttributeErrorfail
IndexErrorst_modest_rdevrparrotstat_result)
r4rresultmembersrattrr!floatynanosecondyresult2s
          rcheck_stat_attributesz(StatAttributeTests.check_stat_attributess	
-q1+f+I		-DBQx5 zz|==(/*  wvt'<!="(t)<"=?

dG,		-1668	AD.78F!&$,75@K""6;a"@	A	A,,v56F 00E9K
""6;a"@	3KII+,
	FNII+,	FNII+,	FMII+,
	nnU+GII+,
	nn%IJGO							*								s~>'H:H(H7*II&I*I9	H%$H%(	H43H47	IIII	I'&I'*	I65I69	JJc:|j|jyr()rGrres rtest_stat_attributesz'StatAttributeTests.test_stat_attributes^s""4::.rc	|jjtj}|j
y#t$r!|jd|jzY;wxYw)Nz#cannot encode %a for the filesystem)rencoder=getfilesystemencodingUnicodeEncodeErrorrwrG)r4rs  rtest_stat_attributes_bytesz-StatAttributeTests.test_stat_attributes_bytesas^	NJJ%%c&?&?&ABE	
""5)"	NMM?$**LM	Ns-A'A+*A+ctj|j}ttj
dzD]}|j
d|5t	j||}|jd||dkr|jd|t	j|}|j||dddy#1swYxYw)Nrrz	protocol sstat_resultrscos
stat_result
)rrrrpickleHIGHEST_PROTOCOLsubTestdumpsrloadsrCr4rAprotop	unpickleds     rtest_stat_result_picklez*StatAttributeTests.test_stat_result_picklehs$622Q67	4E	%12
4LL/

na019MM"7;"LLO	  3

4
4	4
4
4s
A'CC	statvfsztest needs os.statvfs()ctj|j}|j|j|dd}t|D]'\}}|jt
|d|z||)|jt|jt|jt|d	d|_|jd	d|_|jd	tjd}|jd	tjd}y#t$rYbwxYw#t$rYXwxYw#t $rY@wxYw#t $rYywxYw)	Nr)
bsizefrsizeblocksbfreebavailfilesffreefavailflagnamemaxf_rsrrr&r'r()rrZrrCf_bfree	enumerater5rk
isinstancef_fsidrr?r;r:r?statvfs_resultr)r4rArBvaluememberrFs      rtest_statvfs_attributesz*StatAttributeTests.test_statvfs_attributesssTDJJ'	
3:&w/	LME6WVTF];VE]K	L	

6==#67	
Vb)	FNII+,	FMII+,
	''.GII+,
	''(LMG%								sH;D*D9-&EE*	D65D69	EE	EE	E#"E#need os.statvfs()cPtj|j}ttj
dzD]h}t	j||}|jd||dkr|jd|t	j|}|j||jy)Nrrsstatvfs_resultrscos
statvfs_result
)
rrZrrrPrQrSrrTrCrUs     rtest_statvfs_result_picklez-StatAttributeTests.test_statvfs_result_picklesDJJ'622Q67	0EVU+AMM+Q/qy

6:QIVY/
	0rrWin32 specific testsc	tjdy#t$r|jdYyt$r}|jdYd}~yd}~wwxYw)Nzc:\pagefile.syszc:\pagefile.sys does not existzCould not stat pagefile.sys)rrrIrwrJr;r4rs  rtest_1686475zStatAttributeTests.test_1686475sI	5GG&' 	=MM;<	5II344	5sAAAArzrequires os.pipe()ctj\}}	tj|tj|tj||j	t
5}tj|ddd|j
jjtjy#tj|tj|wxYw#1swYmxYwr()
rrrrjryrJrC	exceptionrKEBADF)r4rwctxs    r
test_15261zStatAttributeTests.test_15261swwy1	GGAJHHQKHHQK


w
'	3GGAJ	,,ekk:	
HHQKHHQK		sC-C/,C,/C8c|jt|d|jt|jt|jd|jcxkxr
dkycy)Nst_file_attributesr)rkrrir}r)r4rAs  rcheck_file_attributesz(StatAttributeTests.check_file_attributessQ(<=>
6#<#<cBCV66D*DEDErz$st_file_attributes is Win32 specificctj|j}|j||j	|j
tjzdtjdz}tj||jtj|tj|}|j||j	|j
tjztjy)Nrr2)rrrrrCr}FILE_ATTRIBUTE_DIRECTORYrrcrGrrmdir)r4rArQs   rtest_file_attributesz'StatAttributeTests.test_file_attributess$""6*%%(E(EE
	
""U*
'*!""6*%%(E(EE))	+rctjjtjd|jdz}|jtj|t|dd}tjd|ddg|tj|}|j|jd	|jtjj|y)
NTEMP_accessrr*z
icacls.exez/denyz*S-1-5-32-545:(S)rr)rrDrFenvironrrrrdr%r
check_callrassertNotEqualr1rkisfile)r4rDETACHED_PROCESSrAs    rtest_access_deniedz%StatAttributeTests.test_access_deniedsRZZ/i1GH	((%0E6"5'+>?*		
FNNA.u-.rcdtjjtjdz}tj|}|j|jtjy)Nz//./r)rrD
splitdriver0rrCr=S_IFBLK)r4rrAs   rtest_stat_block_devicez)StatAttributeTests.test_stat_block_devicesM++BIIK8;;6rN)r\r]r^rfrGrIrNrYrrrrrnrqr=r>rur{rrrrr+rrrrs(
HT/*	4XY/1JK)L)VXY/,.	0.	0X02HI5J5X02HIXV,.BC
;DJ
;F
X0?A+A+&X02HI/J/*X02HI7J7rrceZdZdZdZddZdZedZdZ	dZ
eje
je
jvd	d
Zeje
je
j"vddZeje
je
j&vd
dZdZdZdZdZdZdZdZej:dZy)
UtimeTestscHtj|_tjj|jd|_|jtj|jtj|jt|jy)Nf1)rrcrQrrDrFrrrmtreerGr%res rrfzUtimeTests.setUps] ''WW\\$,,5
	(($,,7
DJJrctj|}|j|dk7xs&|j|dk7xs|j|dk7S)Nr)r*r+)rrst_atimest_mtimest_ctime)r4r"sts   rsupport_subsecondzUtimeTests.support_subsecondsQWWX
1%*KK2a5(*KK2a5(	+rNc|s|j}|j|}|rd}d}nd}d}||||ftj|}|rC|j	|j
|dzd|j	|j|dzdn>|j|j
|dz|j|j|dz|j|j||j|j|y)Ni8Z;l
o]rTlP9&.>gư>r$)
rrrrr7rrrCst_atime_nsst_mtime_ns)r4set_timer"ratime_nsmtime_nsrs       r_test_utimezUtimeTests._test_utimeszzH 228<"H!H!H HHh/0
WWX
""2;;4t"L""2;;4t"LR[[(T/:R[[(T/:22rc,d}|j|y)Nc2tj||yNnsrutimer"rs  rrz'UtimeTests.test_utime.<locals>.set_time.HHX"%rrr4rs  r
test_utimezUtimeTests.test_utime-s	&	
"rc|dzdzS)Nrg&.>r+rs r	ns_to_seczUtimeTests.ns_to_sec3s
T	V##rc2fd}j|y)Nc|\}}j|}j|}tj|||fyr(rrrr"rrratimemtimer4s      rrz2UtimeTests.test_utime_by_indexed.<locals>.set_time<s=!#HhNN8,ENN8,E
HHXu~.rrrs` rtest_utime_by_indexedz UtimeTests.test_utime_by_indexed:s	/	
"rc2fd}j|y)Nc|\}}j|}j|}tj|||fy)N)timesrrs      rrz0UtimeTests.test_utime_by_times.<locals>.set_timeFs;!#HhNN8,ENN8,EHHXeU^4rrrs` rtest_utime_by_timeszUtimeTests.test_utime_by_timesEs	5	
"rz9follow_symlinks support for utime required for this test.c,d}|j|y)Nc4tj||dy)NF)rfollow_symlinksrrs  rrz9UtimeTests.test_utime_nofollow_symlinks.<locals>.set_timeRs
HHX"e<rrrs  rtest_utime_nofollow_symlinksz'UtimeTests.test_utime_nofollow_symlinksNs	=	
"rz,fd support for utime required for this test.c,d}|j|y)Nct|dd5}tj|j|dddy#1swYyxYw)Nwbrr)r rrr)r"rr$s   rrz*UtimeTests.test_utime_fd.<locals>.set_time[s;ha(
-B,
-
-
-s	&=Arrs  r
test_utime_fdzUtimeTests.test_utime_fdXs	-
	
"rz0dir_fd support for utime required for this test.c,d}|j|y)Nctjj|\}}tj|5}tj
|||dddy#1swYyxYw)N)rr)rrDr6ropen_dir_fdr)r"rrQrdirfds     rrz.UtimeTests.test_utime_dir_fd.<locals>.set_timeesMGGMM(3MGT&&w/
45e3
4
4
4sAA#rrs  rtest_utime_dir_fdzUtimeTests.test_utime_dir_fdbs	4
	
"rcDd}|j||jy)Nc2tj||yrrrs  rrz1UtimeTests.test_utime_directory.<locals>.set_timemrr)r")rrQrs  rtest_utime_directoryzUtimeTests.test_utime_directoryls 	&	
DLL9rcPtj}||j|j|jsd}nd}tj|j}d|j
d|d|j
|z
}|j
|j
|||y)Ng?g?zst_time=z
, current=z, dt=)r%msg)timerrrrrr7)r4rcurrentr%rrs      r_test_utime_currentzUtimeTests._test_utime_currentrs))+	%%djj1EE
WWTZZ
 ++wg(=?r{{G%*		5rc2fd}j|y)NcDtjjyr(rrrr"r4s rrz/UtimeTests.test_utime_current.<locals>.set_timesHHTZZ rrrs` rtest_utime_currentzUtimeTests.test_utime_currents	!	
  *rc2fd}j|y)NcFtjjdyr(rrs rrz3UtimeTests.test_utime_current_old.<locals>.set_timesHHTZZ&rrrs` rtest_utime_current_oldz!UtimeTests.test_utime_current_olds	'	
  *rcftjdk(rtjj	tjj|ddz}ddl}|jj}|jdd}|j|ddddd|t|}|r|jSyy)Nrr\r)
r=r>rrDrabspathctypeswindllkernel32create_unicode_bufferGetVolumeInformationWr?rl)r4rDrootrrbufoks       rget_file_systemzUtimeTests.get_file_systems<<7"77%%bggood&;<Q?$FD}}--H..r37C//dA04dD03SX?Byy #rc|j|jdk7r|jdd}tj|j
||f|j
tj|j
j|y)NNTFSz
requires NTFSr)	rrQrwrrrrCrr)r4larges  rtest_large_timezUtimeTests.test_large_timese-7MM/*
eU^,,55u=rc|jt5tj|jddddd|jt
5tj|jddgddd|jt
5tj|jdddd|jt
5tj|jdddd|jt
5tj|jddgddd|jt
5tj|jdddd|jt
5tj|jddddtjtjvr@|jt5tj|jdddddtjtjvrbt|jdd	5}|jt
5tj|jdddddddtjtjvrA|jt5tj|jdd	
dddyy#1swYxYw#1swYxYw#1swYexYw#1swY4xYw#1swYxYw#1swYxYw#1swYxYw#1swYIxYw#1swYxYw#1swYxYw#1swYyxYw)N)rrrr)r)rrrFrrrr)ryrrrrrsupports_follow_symlinksrsupports_fdr rsupports_dir_fd)r4r$s  rtest_utime_invalid_argumentsz'UtimeTests.test_utime_invalid_argumentss


z
*	4HHTZZF3	4


y
)	)HHTZZ!Q(	)


y
)	'HHTZZ&	'


y
)	,HHTZZ+	,


y
)	,HHTZZQF+	,


y
)	*HHTZZD)	*


y
)	/HHTZZI.	/882666""#67
DVUC
D
882>>)djj$*
2b&&y12HHRYY[&12
2882---""#67
7VA6
7
7.-	4	4	)	)	'	'	,	,	,	,	*	*	/	/
D
D22
2
2
7
7s#L#L
!L!L'$L4"M"M1#MM4)%M(M4#NL

LL$'L14L>MMM%(M1	-M44M=N	cd}|jt5tj|j|ddfddd|jt5tj|j|ddfddd|jt5tj|j|ddfdddy#1swYxYw#1swY]xYw#1swYyxYw)Nc*Gfdd}|S)NceZdZfdZy)?UtimeTests.test_issue31577.<locals>.get_bad_int.<locals>.BadIntcSr(r+)rdivmod_ret_vals r
__divmod__zJUtimeTests.test_issue31577.<locals>.get_bad_int.<locals>.BadInt.__divmod__s	))rN)r\r]r^r)rsrBadIntrs*rrr+)rrs` rget_bad_intz/UtimeTests.test_issue31577.<locals>.get_bad_ints
*
*8Or*rrrr+)rrrtr)ryrrrr)r4rs  rtest_issue31577zUtimeTests.test_issue31577s	


y
)	:HHTZZ[_a$89	:


y
)	:HHTZZ[_a$89	:


y
)	AHHTZZ[%;Q$?@	A	A		:	:	:	:	A	As#*C *C&'*C2C#&C/2C;r()r\r]r^rfrrrstaticmethodrrrrrrrrrrrrrrrrrrrrrrrr+rrrrs +3>#$$	##XR%@%@@*+#+#XR^^3GI#I#XR%7%77KM#M#:5,++
!>78

A
Arr)
mapping_testsceZdZdZdZdZdZdZdZe	jexrejjede	jeedd	ej"d
Ze	jexrejjede	jeedd	ej"dZdZd
ZdZdZe	jej0ddZej"dZej6dddZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&d Z'y)!EnvironTestsz8check that os.environ object conform to mapping protocolNcttj|_tjrttj
|_|jjD]\}}|tj|<yr()	dictrr_EnvironTests__savesupports_bytes_environenvironb_EnvironTests__saveb
_referenceitemsr4keyrls   rrfzEnvironTests.setUps[2::&
$$,DL//+113	$JC#BJJsO	$rcBtjjtjj|jtj
rHtjjtjj|jyyr()rrclearupdaterrrr	res rrzEnvironTests.tearDowns\





$++&
$$KKKKt||,%rcddddS)NVALUE1VALUE2VALUE3)KEY1KEY2KEY3r+res rr
zEnvironTests._referencesBBrc^tjjtjSr()rrrres r_empty_mappingzEnvironTests._empty_mappings


zzrzrequires a shellpopenzneeds os.popen()cBtjjtjjdtjdt
z5}|j
j}|j|ddddy#1swYyxYw)NWorld)HELLOz%s -c 'echo $HELLO')	rrrrrrrstriprC)r4rrls   rtest_update2zEnvironTests.test_update2sv
	




(
XX+j8
9	-UJJL&&(EUG,	-	-	-s1BBcTtjdtz5}t|}|j	t|d|j	t|d|j	t|d|j
tt
|dddy#1swYyxYw)Nz %s -c 'echo "line1
line2
line3"'zline1
zline2
zline3
)rrriterrCnextry
StopIteration)r4rits   rtest_os_popen_iterzEnvironTests.test_os_popen_iters
XX<"#$	7',eBT"Xy1T"Xy1T"Xy1mT26
	7	7	7sA8BB'ctjjD]C\}}|jt	|t
|jt	|t
Eyr()rrrrCrr2)r4r
vals   rtest_keyvalue_typesz EnvironTests.test_keyvalue_typessJ

((*	-HCT#Y,T#Y,	-rc|jjD]4\}}|jtjj||6yr()r
rrCrrgetrs   r
test_itemszEnvironTests.test_itemssB//+113	9JCRZZ^^C0%8	9rctj}djd|jD}|j	t|d|dy)z>Check that the repr() of os.environ looks like environ({...}).z, c30K|]\}}|d|yw)z: Nr+).0r
rls   r	<genexpr>z-EnvironTests.test___repr__.<locals>.<genexpr>s'$
UgRy!$
sz	environ({z})N)rrrFrrCrepr)r4envformatted_itemss   r
test___repr__zEnvironTests.test___repr__sLjj))$
!iik$

	
cj0A$EFrcztjjtj}gd}dtjj	|i}tj
}	t
|t_|j|tj|j|tjd|t_|j|tji|jdtjddi|j|tj|tjr	tjd5dd	d
}ddd|jttj|jtjddid
g|jtjdd
id
g|jtjddid
gyy#|t_wxYw#1swYxYw#t$rYwxYw)N)z/montyz/pythonrz/flying/circusPATHr1rrT)recordrr)r5PATHr9abcabc)rdefpathr6pathseprFrrassertSequenceEqual
get_exec_pathrwarningscatch_warningsryrBytesWarning)r4defpath_list	test_pathtest_env
saved_environ	mixed_envs      rtest_get_exec_pathzEnvironTests.test_get_exec_path!szz''

3?	BJJOOI67


	'hBJ$$Y0@0@0BC$$Y0@0@T0JK&BJ	
  r/?/?/CD  (8(8&(EF  B,<,<X,FG
$$
K,,D9=),t <I=!!*b.>.>	J
$$R%5%5w6G%H
$$R%5%5w6F%G
$$R%5%5vv6F%G
#%'BJ==

s7$AHH.%H"+H.
H"H+'H..	H:9H:z#os.environb required for this test.crd}	|jtjd}|t
jd<|jt
jd||jt
jdd}|t
jd<|jt
jd||jtjd}|jt
jd|y#t$r,dtj}|j	|Y
wxYw)	Nueuro€surrogateescapez%U+20AC character is not encodable to unicodesunicodesbytesrY)
rKr=rLrMrwrrrCrdecode)r4rlvalue_bytesr	value_strs     r
test_environbzEnvironTests.test_environbJs	,,s'@'@'B'8:K!&

9I.6Z0+> %HX.6LL!:!:!<>OP	G,i8"	))+.CMM#	s$D1D65D6cd}d}d|d}tj5}|j|dtj||tjtjd|gdt
jd}|j|jjt|tj|tjtjd|gdt
jd}|j|jjtddddy#1swYyxYw)N
PYTHONTESTVAR	testvaluez%import os; print(repr(os.environ.get(z)))rT)checkstdouttext)rEnvironmentVarGuardpoprputenvrrunr=rPIPErCrUrstripr0unsetenv)r4rrlrr1procs      rtest_putenv_unsetenvz!EnvironTests.test_putenv_unsetenvas6thcB

*
*
,	?GGD$IIdE">>3>>4">d)3tEDT[[//14;?KK>>3>>4">d)3tEDT[[//14:>	?	?	?sDD<<ErsrcdD]Y}|jttftj|d|jttftj
|[tjdk(rwddz}|jttj|d|jttjd||jttj
|yy)N)rz=namezna=mezname=znameznamerlrr rX)ryrJrrrYr]r=r>)r4rlongstrs   rtest_putenv_unsetenv_errorz'EnvironTests.test_putenv_unsetenv_errorusH	HDw
3RYYgNw
3R[[$G	H<<7"FlGj"))WcBj"))S'Bj"++w?
#rcpd}|j|tj|jt5}tj|ddd|jjjd||j|jj|jt5}tj|=ddd|j|jjd||j|jjy#1swYxYw#1swYdxYw)N
missingkeyr)
assertNotInrrryKeyErrorassertIsrwrrk__suppress_context__)r4missingcms   r
test_key_typezEnvironTests.test_key_types"**-


x
(	 BJJw	 

bll''*G499:


x
(	$B

7#	$

bll''*G499:	 	 
	$	$sD 7D, D),D5ct|}d}t|dtj|<	t||j	tj|dtj|=y#tj|=wxYw)N__new_key__test_environ_iteration)r!r"rrrC)r4
collectioniteratornew_keys    r_test_environ_iterationz$EnvironTests._test_environ_iterationsg
#X7

7	$NRZZ02JK

7#

7#s.A--BcB|jtjyr()rtrrres r(test_iter_error_when_changing_os_environz5EnvironTests.test_iter_error_when_changing_os_environs$$RZZ0rc^|jtjjyr()rtrrrres r.test_iter_error_when_changing_os_environ_itemsz;EnvironTests.test_iter_error_when_changing_os_environ_itemss$$RZZ%5%5%78rc^|jtjjyr()rtrrvaluesres r/test_iter_error_when_changing_os_environ_valuesz<EnvironTests.test_iter_error_when_changing_os_environ_valuess$$RZZ%6%6%89rcBtr#tjjtsytj
sytjtd|d5}|jj}ddd|j|y#1swYxYw)Nz -c 'echo $')
rrrDexistsrhas_subprocess_supportrrrrC)r4varrSrrls     r_test_underlying_process_envz)EnvironTests._test_underlying_process_envsyrww~~j9//
XXKuA6
7	)5JJL&&(E	)	
5)	)	)sBBcd}d}|tj|<dddd|di}ttj}|j|tj|z}|j	|||jd|||j
}|jttjj||jdd|j||y	N
_TEST_VAR_original_value_A_r_B_23r)rrrrassertDictEqualrCrriNotImplemented__or__rr4overridden_keyr
new_vars_dictrSactualnew_vars_itemss       rtest_or_operatorzEnvironTests.test_or_operators%)%3

>"UCE


#
&m+Xv.f^45&,,.

nbjj&7&7&GH))%4))..Ircd}dtj|<dddd|di}ttj}|j|txj|zc_|j	|tj|j	dtj||jdd|j|dy)NrrrrrrrrrrrrCr)r4rrrSs    rtest_ior_operatorzEnvironTests.test_ior_operators%%5

>"UCE


#
&


m#
2::.bjj89))%5)).#>rctjj}|jt5ddi}txj|zc_ddd|jt5ddi}txj|zc_ddd|j|tjy#1swYexYw#1swY6xYw)Nrrr)rrcopyryrrC)r4os_environ_copydict_with_bad_keydict_with_bad_vals    rtest_ior_operator_invalid_dictsz,EnvironTests.test_ior_operator_invalid_dictss**//+


y
)	,!"E
JJ++J	,

y
)	,!&
JJ++J	,
	
"**5	,	,	,	,sB6/C6B?Ccd}dtj|<dd|dff}ttj}|j|txj|zc_|j	|tj|j	dtj||jdd|j|dy)Nrr)rr)rrrrrr)r4rrrSs    r$test_ior_operator_key_value_iterablez1EnvironTests.test_ior_operator_key_value_iterables%%5

>"&~s6KL

#'


n$
2::.bjj89))%5)).#>rcd}d}|tj|<dddd|di}t|}|jtj|tjz}|j	|||j||||j
}|jttjj||jdd|j||yr)rrrrrrCrrir__ror__rrs       rtest_ror_operatorzEnvironTests.test_ror_operators%)%3

>"UCE

&

#+Xv.)?@&,,.

nbjj&8&8&HI))%4))..Ir)(r\r]r^__doc__	type2testrfrr
rrrrrrDr~rrrequires_subprocessrr%r(r+r3rHrrPr_requires_mac_verrdrmrtrvrxr{rrrrrrr+rrrrsBI$-C
XBz(B+-XW-/AB W  "-#C--XBz(B+-XW-/AB W  "7#C-7-
9
G'RX22>@9@9*!W  "?#?&Wb!$
@%
@;
$19:	*J&
?6
?JrrcNeZdZdZdZdZdZd
dZdZdZ	d	Z
d
ZdZdZ
y)	WalkTestszTests for os.walk().c^d|vr|jd|d<tj|fi|SNrfollowlinks)rXrwalk)r4topkwargss   rrzWalkTests.walk
s2&$*JJ/@$AF=!wws%f%%rctjj}|jtj
tj|tjd|_||jd|_||jd|_	||jd}||d}||jd}||jd}||d}||d}||d	|_
|tjd
}|tjd
d}	||d}
||d
}||d}tj|jtj|tj|tj|||||	|fD]0}
t|
dd5}|jd|
zdzddd2t	jrtjtjj!||jtjd|
dtj|dd|dtj|dd|d|dd	ggdf|_n|dgdgf|_t$j&stj(|d	tj*|tj(|t,j.tj0|tj2||j"ddd=y#1swYxYw#t4$r2|jtj(|t,j.YywxYw)NTEST1SUB1SUB11SUB2SUB21tmp1tmp2tmp3linkTEST2tmp4broken_linkbroken_link2broken_link3r rrzI'm z" and proud of it.  Blame test_os.
brokenTtmp5)rrrrrrr)rrDrFrrrrc	walk_path	sub1_path
sub11_path	link_pathmakedirsr r!can_symlinkrr	sub2_treerrchmodlistdirrS_IRWXUrdrPermissionError)r4rF	sub2_path
sub21_path	tmp1_path	tmp2_path	tmp3_path	tmp5_patht2_path	tmp4_pathbroken_link_pathbroken_link2_pathbroken_link3_pathrDros               rrfzWalkTests.setUpsww||	(()*:*:;&i..8dnnf5t~~w70	)W-
0	0	F+	V,	i0y''1))7F;		=9 N; N;	DOO$
I
J
Gy)Y	I	ODdC'2
Oa
(MMN
O
O	O  "JJrwww/@JJx!148JJtFH-/@$GJJtGV,.?F''6):'(DN('VH=DN$$HHZ#	&JJz"
HHZ.IIi HHZ q!"1"%3
O
O&	@OOBHHj$,,?	@s7L5?M5L?	8M=<M=cft|j|j}|jt	|d|ddddk7}|ddj|dd|zz
dj|dd|zz
dj|j|d|jddgd	gf|j|d|z|jd
gdgf|j|d|z|jggf|j|dd|zz
|jy)Nrrrrrrrtrrrr)	listrrrCr?sortrrrr4allflippeds   rtest_walk_topdownzWalkTests.test_walk_topdownYs&499T^^,-S1%a&)A,&(Aq	AGOR %%'AGOQ$$&Q$..662BVH!MNQ[)DNNWIx+PQQ[)DOOR+DEQW_-t~~>rNc||j}g}|j|D]0\}}}|j|||fd|vs |jd2|j	t|d|j	|d|jdgdgf|ddj
|ddj
|j	|d|jy)Nrrtrrrrrr)rrappendremoverCr?rr)r4rrrdirsras      rtest_walk_prunezWalkTests.test_walk_prunejsI!%9!5	$D$JJdE*+~F#	$	
S1%Q$..6(VH!EFAr
Aq	Q0rcL|jt|jyr()rrrres rtest_file_like_pathzWalkTests.test_file_like_path}sXdnn56rcft|j|jd}|jt	|d||ddddk7}|ddj|dd|zz
d	j|dd|zz
dj|j|d|jdd
gdgf|j|||jggf|j||dz|jdgd
gf|j|dd|zz
|jy)NFtopdownrrrrrrrtrrrrr)	rrrrCr?rrrrrs   rtest_walk_bottom_upzWalkTests.test_walk_bottom_ups5499T^^U9;<S1c*a&)A,&(Aq	AGOR %%'AGOQ$$&Q..66*:VHE	GW//2r2	4Wq[)..7)fX>	@QW_-	)rc,tjs|jd|j|jd}|D]<\}}}||j
k(s|j
|g|j
|dgy|jdy)Nzneed symlink supportTrrz+Didn't follow symlink with followlinks=True)rrrwrrrrCr;)r4walk_itrrras     rtest_walk_symlinkzWalkTests.test_walk_symlinks$$&MM01))DNND)A!(	ED$t~~%  r*  1		E
IICDrcg}|j|j|j}t|\}}}|j	|gd}t
jj||}t
jj||dz}tj||	|D	
cgc]\}	}
}|	
}}
}	}|j||j|||j|||D]8}
|
|k7s	|jt
jj||
|:	tj||ycc}}
}	w#tj||wxYw)N)onerrorrz.new)rrrr"rCrrDrFrrkrgr)r4errorsrrrradir1path1path1newrdrorootsdir2s              rtest_walk_bad_dirzWalkTests.test_walk_bad_dirs)))DNNFMM)B MdE$T4(77<<dVm4
		%"		'&-..71aQ.E.OOF#UE*Xu-
C4<MM"'',,tT":EB
C
IIh&/
IIh&s%'E-
E:AE>2EEE'cd}tjjtjd}tjj|gdg|z}tj
|t
dDcgc]}|j|d}}t
|dzD]M}||rdgnggf}|D]}|jt||tjj|}Ot
dDcgc]}|j|d}}|}t
|dzD]Q}|||krdgnggf}|D]}|jt||tjj|d}Sycc}wcc}w)	NdeeprrFrrrT)rrDrFrrcrrrrCr"rQ)	r4depthbaserWjitersrrSr$s	         rtest_walk_many_open_filesz#WalkTests.test_walk_many_open_filesshww||I,,f5GGLL.#u.
A9>sDA4/DDuqy!	#AAC52r2H
5  b84
5"A		#9>c
C14.CCuqy!	%AAIC52r:H
5  b84
5Q$A		%EDs7E?>Fcd}tjtjj|jgdg|zt|dz
5t
|j|j}ddd|jd}D],\}}}||k(s
|j|j.g}|j}t|D]7}	tjj|d}|j|dggf9|ddj|jdgdgf|jggfg|jg|d	}
|dd}|j|d
gfg}|D]}|j|
||j!t#||dz|j!t%|gd	|j!||y#1swYdxYw)N2rrrrrrrr)rrrrr)rrrDrFrrrrrrrrrrrextendrCr?sorted)
r4rrrrrra	d_entriesd_path_sectionsrSrs
             rtest_walk_above_recursion_limitz)WalkTests.test_walk_above_recursion_limits
BGGLLBC55=BC
 
+	2tyy01C	2NN1%	!$	D$y 		

	
	u	2AWW\\&#.FfseR01	2	"
a 
'VH5"b)^^$

1vay^^TF845	)AOOHQK(	)	
S519-'<=h'G	2	2s%GG#r()r\r]r^rrrfrrrrrrrrr+rrrrs:&
E&N?"1&7)*E'*%*&(rrfwalkzTest needs os.fwalk()ceZdZdZdZdZdZdZdZdZ	e
jejdd	Zd
Zd
Zy
)
FwalkTestszTests for os.fwalk().c+TK|j|fi|D]\}}}}|||fywr()r)r4rrrrraroot_fds       rrzFwalkTests.walks;*4$**S*CF*C	&&D$wu%%	&s&(c,tj|i|Sr()rrr4rrs   rrzFwalkTests.fwalksxx(((rc	|j}|j}tjddD]\}}|j|||j||i}t	j
di|D]\}}}t
|t
|f||<!|jdi|D]B\}}}}	|j|||j||t
|t
|fDy)z.
        compare with walk() results.
        TFrtrepeat)rr)rrNr+)
r	itertoolsproductrrrsetrrrC)
r4walk_kwargsfwalk_kwargsrrrSrrrarootfds
          r_compare_to_walkzFwalkTests._compare_to_walks"&&(#((*(1(9(9-PQ(R
	J$G_wOLQH%'WW%;{%;
9!dE"%d)SZ!8
9.8TZZ-G,-G
J)dE6

dH-  $#d)SZ1HI
J
	JrcLdtji}|j||y)Nr)rrcr)r4rs  rtest_compare_to_walkzFwalkTests.test_compare_to_walks"))*ff-rc	tjdtj}dtji}|j}||d<|j
||tj|y#tjwxYw)N.rr)rr rrrcrrrj)r4rrrs    rtest_dir_fdzFwalkTests.test_dir_fdsj	bkk*B )"2"23K&++-L%'L"!!+|<HHRLBHHRLsAA55Bc	ztjddD]\}}tj|df}|j|d|iD]t\}}}}tj|tj||jttj|t|t|zvy)Nr
rtrr)rrrrcrrfstatrrCrr)r4rrrrrrars        rtest_yields_correct_dir_fdz%FwalkTests.test_yields_correct_dir_fd!s(1(9(9-PQ(R	R$G_##Wd2D-7TZZ-_-_
R)dE6   RZZ%7!8#d)c%j:PQ

R	RrzCannot dup stdout on EmscriptencNtjd}tj|tdD]&}|j	t
jD]}(tjd}|jtj||j||y)Nrr)	rrvrjrrrrcrrC)r4minfdrr newfds     rtest_fd_leakzFwalkTests.test_fd_leak-sq	
s	AZZ	 0 01

	q	%(&rN)r\r]r^rrrrrrrrrrrr#rrr+rrrrs^&)J$.
RX__@''!%&*#rrceZdZdZdZy)BytesWalkTestsTests for os.walk() with bytes.c+Kd|vr|jd|d<tjtj|fi|D]\}}}tj|}tt
tj|}tt
tj|}|||ftt
tj||ddtt
tj||ddywr)rXrrfsencoderZrmap)	r4rrbrootbdirsbfilesrrras	         rrzBytesWalkTests.walkEs&$*JJ/@$AF=!$&GGBKK,<$G$G	6 E5&;;u%DBKK/0DR[[&12Eu%%CT23E!HSe45F1I
	6sC:C<N)r\r]r^rrr+rrr%r%Cs
)	6rr%ceZdZdZddZy)BytesFwalkTestsr&c/Ktjtj|g|i|D]\}}}}tj|}t	ttj|}	t	ttj|}
||	|
|ft	ttj|	|ddt	ttj|
|ddywr()rrr(rZrr))r4rrrr*r+r,topfdrrras           rrzBytesFwalkTests.fwalkSs+-88BKK4D+Vt+Vv+V	6'E5&%;;u%DBKK/0DR[[&12Eue,,CT23E!HSe45F1I
	6sC'C)N)r)r\r]r^rrr+rrr.r.Ps
)6rr.cJeZdZdZdZejejxsejddZ
ejejxsejddZejejxsejddZdZ
dZy	)
MakedirTestscJtjtjyr(rrGrrcres rrfzMakedirTests.setUp^s
!!"rc
tj}tjj	|ddd}tj
|tjj	|dddd}tj
||j
ttj
tjtjj	|dddddtj}tj
|tjj	|dtjddddd}tj
|yNrrdir3dir4dir5dir6)	rrcrrDrFrryrJcurdir)r4rrDs   rtest_makedirzMakedirTests.test_makedirasww||D&&&9
Dww||D&&&&A
D	
'2;;		:ww||D&&&&&"))T
Dww||D&"))VVV"F,
Drz$Emscripten's/WASI's umask is a stub.ctjd5tj}tjj|d}tjj|d}tj|d|jtjj||jtjj|tjdk7rd|jtj|jdzd|jtj|jdzddddy#1swYyxYw)Nrtrrimntri)r
temp_umaskrcrrDrFrrkr~isdirrrCrr=)r4rparentrDs    r	test_modezMakedirTests.test_modeps

!
!%
(		I##DWW\\$/F77<</DKKe$OOBGGNN401OOBGGMM$/0ww$  !6!6!>F  !8!85!@%H		I		I		IsD:EE"cHtjjtjd}d}tj
d}tj|||jttj|||jttj||dtj|ddtj||dtj
|tjtjjd	dy)
NrrFexist_okiT)rrF/)
rrDrFrrcumaskrryrJr)r4rDrold_masks    r test_exist_ok_existing_directoryz-MakedirTests.test_exist_ok_existing_directorys
ww||I,,f588E?
D$'2;;d;'2;;dUK
D%$/
Dtd3
	BGGOOC(48rctjjtjd}t
j}d}tjd}	tjtjtjj}	tjtj||ztjtjj|z|k7rtjdtj|||ztj||dtj|tjtj|j|ztj|||zdtj|y#t$rtjdwxYw#tj|wxYw)NrrrDzCannot set S_ISGID for dir.z No support for S_ISGID dir mode.TrE)rrDrFrrcrS_ISGIDrHS_IMODElstatr=rrrSkipTestr)r4rDrLrrIexisting_testfn_modes      rtest_exist_ok_s_isgid_directoryz,MakedirTests.test_exist_ok_s_isgid_directorysa
ww||I,,f5,,88E?	#'<<HHY--.66$8 
G))+?'+IJ))*22W<G''(JKK
KKdWn-
KKdT2HHT4<<(>(>?7(JKKKdWnt<HHX#
G''(EFF
G
HHXs&AG'F3?CG3GGG,ctj}tjj	tjd}t|dd5}|j
dddd|jttj||jttj|d|jttj|dtj|y#1swYxYw)	Nrryrrr;FrET)rrcrrDrFr r!ryrJrr)r4rrDros    r#test_exist_ok_existing_regular_filez0MakedirTests.test_exist_ok_existing_regular_filesww||I,,f5
$g
.	!
GGEN	'2;;5'2;;uE'2;;tD
		$		s
C00C9c	tjjtjdddddd}tjj|se|tjk7rRtjj
|}tjj|s|tjk7rRtj|yr6)rrDrFrrcr~rQ
removedirsr4rDs  rrzMakedirTests.tearDownsww||I,,fff"FF4
''..&493C3C+C77??4(D''..&493C3C+C	

drN)r\r]r^rfr<rrrrrrBrJrQrSrr+rrr2r2]s#
X__0.
I	
IX__0.9	9X__0.	6	rr2ceZdZedZdZejee	dddZ
ejexree
dkDddZejexree
dkDd	d
ZedZy)
ChownFileTestscJtjtjyr(r4clss r
setUpClasszChownFileTests.setUpClass
!!"rctjtj}|j}|j
}ddt
jdtjddfD]l}|jttjtj|||jttjtj||n|jtjtj|||jtjtjddy)Ngyrrt)rrrrcst_uidst_giddecimalDecimal	fractionsFractionryrchownassertIsNone)r4ruidgidrls     r*test_chown_uid_gid_arguments_must_be_indexz9ChownFileTests.test_chown_uid_gid_arguments_must_be_indexswwy''(kkkkC!4i6H6HQ6OP	QEi93C3CUCPi93C3CS%P	Q	
"((9#3#3S#>?"((9#3#3R<=r	getgroupszneed os.getgroupscdtj}t|dkr|jd|dd\}}tjt
jj}tjt
j||tjt
jj}|j||tjt
j||tjt
jj}|j||y)Nrtztest needs at least 2 groups)rrkr?rwrrrcr`rfrarC)r4groupsgid_1gid_2rhris      rtest_chown_gidzChownFileTests.test_chown_gidsv;?MM89bqzuggi&&'..
!!3.ggi&&'..e$
!!3.ggi&&'..e$rrrz0test needs root privilege and more than one userctdd\}}tjtjj
}tjtj||tjtjj}|j||tjtj||tjtjj}|j||yNrt)		all_usersrrrrcrarfr`rC)r4uid_1uid_2rirhs     rtest_chown_with_rootz#ChownFileTests.test_chown_with_roots!!}uggi&&'..
!!5#.ggi&&'..e$
!!5#.ggi&&'..e$rz2test needs non-root account and more than one userc^tdd\}}tjtjj
}|j
t5tjtj||tjtj||dddy#1swYyxYwrr)	rsrrrrcraryrrf)r4rtruris    rtest_chown_without_permissionz,ChownFileTests.test_chown_without_permissions|!!}uggi&&'..



/	3HHY%%uc2HHY%%uc2	3	3	3s
AB##B,cJtjtjyr()rrrrcrZs r
tearDownClasszChownFileTests.tearDownClassr]rN)r\r]r^classmethodr\rjrrrrrp
root_in_posixr?rsrvrxrzr+rrrXrXs##>X[13FG%H% X=3y>A+=KM%M%X]*As9~/AMO3O3##rrXc*eZdZdZdZdZdZdZy)RemoveDirsTestscJtjtjyr()rrrrcres rrfzRemoveDirsTests.setUps
I$$%rcJtjtjyr()rrrcres rrzRemoveDirsTests.tearDowns))*rcNtjjtjd}tj
|tjj|d}tj
|tj||jtjj||jtjj||jtjjtjy)Ndiradirb)	rrDrFrrcrGrUassertFalser~r4rrs   rtest_remove_allzRemoveDirsTests.test_remove_all
sww||I,,f5
ww||D&)



d-.-.	(8(89:rctjjtjd}tj
|tjj|d}tj
|t
tjj|dtj||jtjj||jtjj||jtjjtjyNrrfile.txt)rrDrFrrcrGr%rUrr~rkrs   rtest_remove_partialz#RemoveDirsTests.test_remove_partialsww||I,,f5
ww||D&)
BGGLLz23


d-.t,-y'7'789rctjjtjd}tj
|tjj|d}tj
|t
tjj|d|jt5tj|ddd|jtjj||jtjj||jtjjtjy#1swYxYwr)rrDrFrrcrGr%ryrJrUrkr~rs   rtest_remove_nothingz#RemoveDirsTests.test_remove_nothingsww||I,,f5
ww||D&)
BGGLLz23


w
'	 MM$	 t,-t,-y'7'789		 	 s7E..E7N)r\r]r^rfrrrrr+rrr~r~s&+;	:
:rr~zWASI has no /dev/nullceZdZdZy)DevNullTestscDttjdd5}|jd|j	dddttjd5}|j|j
ddddy#1swYMxYw#1swYyxYw)Nrrhellorr)r rdevnullr!rjrCrrns  rtest_devnullzDevNullTests.test_devnull.s
"**dA
&	!
GGH
GGI	"**d
#	,qQVVXs+	,	,			,	,s"B
 !B
BBN)r\r]r^rr+rrrr,s,rrc$eZdZdZdZdZdZy)URandomTestsc|jttjdd|jttjdd|jttjdd|jttjdd|jttjddy)Nrrrrsrr9)rCr?rurandomres rtest_urandom_lengthz URandomTests.test_urandom_length7sRZZ]+Q/RZZ]+Q/RZZ^,b1RZZ_-s3RZZ-.5rctjd}|j|ttjd}|j	||yN)rrr1rYrr4data1data2s   rtest_urandom_valuezURandomTests.test_urandom_value>s<

2eU+

2E5)rcdjdd|zddf}td|}|d}|jt|||S)N
zimport os, syszdata = os.urandom(%s)zsys.stdout.buffer.write(data)zsys.stdout.buffer.flush()rrr)rFr
rCr?)r4countroutrUs     rget_urandom_subprocessz#URandomTests.get_urandom_subprocessDsVyy#e++'	)*
tT*QVe,
rcl|jd}|jd}|j||yr)rrrs   rtest_urandom_subprocessz$URandomTests.test_urandom_subprocessOs2++B/++B/E5)rN)r\r]r^rrrrr+rrrr6s6*	*rr	getrandomzneed os.getrandom()c:eZdZedZdZdZdZdZdZ	y)GetRandomTestsc	tjdy#t$r8}|jtjk(rtjdd}~wwxYw)Nrrz%getrandom() syscall fails with ENOSYS)rrrJrKrrrO)r[rUs  rr\zGetRandomTests.setUpClassWsI	LLO	yyELL(''(OPP
	s	A3AActjd}|j|t|j	t|dyr)rrr1rYrCr?)r4rs  rtest_getrandom_typez"GetRandomTests.test_getrandom_typecs4||BdE*TB'rcRtjd}|j|dy)Nrr)rrrC)r4emptys  rtest_getrandom0zGetRandomTests.test_getrandom0hsQ$rcB|jttdy)NGRND_RANDOM)rkrrres rtest_getrandom_randomz$GetRandomTests.test_getrandom_randomlsM23rcl	tjdtjy#t$rYywxYwNrr)rr
GRND_NONBLOCKBlockingIOErrorres rtest_getrandom_nonblockz&GetRandomTests.test_getrandom_nonblockrs-	LLB,,-		s$'	33c|tjd}tjd}|j||yr)rrrrs   rtest_getrandom_valuez#GetRandomTests.test_getrandom_valuezs.R R E5)rN)
r\r]r^r{r\rrrrrr+rrrrUs-		(
%4*rrHAVE_GETENTROPYrrHAVE_GETRANDOMHAVE_GETRANDOM_SYSCALLz*os.random() does not use a file descriptorr8z$VxWorks can't set RLIMIT_NOFILE to 1cJeZdZejeddZdZdZy)URandomFDTestsz!test requires the resource modulec d}td|y)Naif 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")
            rrrs  rtest_urandom_failurez#URandomFDTests.test_urandom_failures
	t$rc(d}td|\}}}y)Naif 1:
            import os
            import sys
            import test.support
            os.urandom(4)
            with test.support.SuppressCrashReport():
                os.closerange(3, 256)
            sys.stdout.buffer.write(os.urandom(4))
            -Scr)r4rrcrerrs     rtest_urandom_fd_closedz%URandomFDTests.test_urandom_fd_closeds(t4Crc|jtjtjt	tjddjtj}t
d|\}}}|jt|d|j|dd|ddt
d|\}}}|jt|d|j||y)Nsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaif 1:
            import os
            import sys
            import test.support
            os.urandom(4)
            with test.support.SuppressCrashReport():
                for fd in range(3, 256):
                    try:
                        os.close(fd)
                    except OSError:
                        pass
                    else:
                        # Found the urandom fd (XXX hopefully)
                        break
                os.closerange(3, 256)
            with open({TESTFN!r}, 'rb') as f:
                new_fd = f.fileno()
                # Issue #26935: posix allows new_fd and fd to be equal but
                # some libc implementations have dup2 return an error in this
                # case.
                if new_fd != fd:
                    os.dup2(new_fd, fd)
                sys.stdout.buffer.write(os.urandom(4))
                sys.stdout.buffer.write(os.urandom(4))
            )rcrr*rr)
rrrdrcr%formatr
rCr?r)r4rrrrout2err2s       rtest_urandom_fd_reopenedz'URandomFDTests.test_urandom_fd_reopeneds	
	(()*:*:;I$$j10i../1	
2(t4CS1%C!Hc!Ah/)%6D$TA&D#&rN)	r\r]r^rrresourcerrrr+rrrrs1
X#FG%H%,5$'rrc#dKgfd}fd}	tj}tj}tj}|t_|t_||t_|t_|t_|t_y#t_t_t_wxYww)z
    Stubs out execv and execve functions when used as context manager.
    Records exec calls. The mock execv and execve functions always raise an
    exception as they would normally never return.
    cBjd||ftd)Nexecvzexecv called)rRuntimeErrorrrcallss  r
mock_execvz#_execvpe_mockup.<locals>.mock_execvs!
gtT*+>**rc`jd||fttjd)Nexecvez
execve called)rrJrKENOTDIRrs  rmock_execvez$_execvpe_mockup.<locals>.mock_execves'
hd+,emm_55rN)rrrr<)r<rr
orig_execvorig_execveorig_defpathrs      @r_execvpe_mockuprs
E+6"XX
iizz	 BJ	!
	!
s
B0AB
("B0
#B--B0rzneed os.execv()ceZdZejeddZdZdZeje
edddZdZ
d	Zejej d
k(ddZy
)	ExecTestsz4avoid triggering a linuxthreads bug: see issue #4970cT|jttjddgdy)Nzno such app-)ryrJrexecvperes rtest_execvpe_with_bad_programz'ExecTests.test_execvpe_with_bad_programs$	
'2::~)*D	2rc6|jttjdd|jttjdg|jttjdd|jttjddgy)Nnotepadr+r7r)ryrrrres rtest_execv_with_bad_arglistz%ExecTests.test_execv_with_bad_arglistsd*bhh	2>*bhh	2>*bhh	5A*bhh	B4@rc|jttjdgd|jttjdgi|jttjddgiy)Nrr)ryrrrres rtest_execvpe_with_bad_arglistz'ExecTests.test_execvpe_with_bad_arglistsR*bjj)RF*bjj)RD*bjj)bT2Fr_execvpez)No internal os._execvpe function to test.ctjdz}|tur<d}tjj	tj
||}|}gd}nQd}gd}tjj	||}tjdk7rtj
|}n|}ddi}t5}|jttj|||jt|d	|j|d
d||ffdddt|5}|jttj|||
|jt|d	|j|d
d|||ffdddt5}|j}	|tur||	d<n||	d<|jttj|||	
|jt|d	|j|d
d|||	ffdddy#1swYxYw#1swYxYw#1swYyxYw)Nabsolutepaths
executable)sprognamearg1arg2r)prognamerrr>spamrrrrr)r<r6rr9r5)rrErYrDrFr(rrryrrrCr?rJr>r)
r4	test_typeprogram_pathprogramfullpathnative_fullpath	argumentsr1renv_paths
          r_test_internal_execvpez ExecTests._test_internal_execvpe
svv.#Gww||BKK$=wGH&O5I"G4Iww||L':Hww$"$++h"7"*w
	J%lXy
2SZ+U1XI<'HI		J\
2	?egWiS

:SZ+$$U1X?Y,<=
?		?

	D%xxzHE!$0!#/ gWiX

?SZ+$$U1X?Y,AB
D
	D
	D#	J	J	?	?
	D
	Ds'7AH &AH-BH9 H*-H69Ic|jttjdk7r|jtyy)Nr>)rr2rrrYres rtest_internal_execvpe_strz#ExecTests.test_internal_execvpe_str>s.##C(
77d?''.rctjddg}tjj	}d|d<|jt5tj|d||dddtjj	}d|d<|jt5tj|d||dddtjj	}d|d	<|jt5tj|d||dddy#1swYxYw#1swYqxYw#1swYyxYw)
NrpasscabbageFRUITVEGETABLErorangeVEGETABLE=cabbageFRUITlemonFRUIT=ORANGE)r=rrrrryrr)r4rnewenvs   rtest_execve_invalid_envz!ExecTests.test_execve_invalid_envCsf-"%.!"


z
*	-IId1gtV,	-"5w


z
*	-IId1gtV,	-"!(~


z
*	-IId1gtV,	-	-	-	-	-	-	-	-s$D&'D2D>&D/2D;>ErzWin32-specific testc	tjddgi|jdy#t$r8}|j	|j
duxs|j
dk7Yd}~yd}~wwxYw)NrargzNo OSError raisedr)rrr;rJrkwinerrorrts  rtest_execve_with_empty_pathz%ExecTests.test_execve_with_empty_pathXsa	+IIb5'2&
II)*	COOAJJ$.A!**/BB	Cs,	A-.A((A-N)r\r]r^rrUSING_LINUXTHREADSrrrrrrrrrr=r>rr+rrrrsX__'KM2M2AG
XZ0DF-DF-D^/
-*X02GH+I+rrrrrc6eZdZdZdZdZdZdZdZdZ	y)	Win32ErrorTestsc"	tjtj|j	dtjzy#t
$rd}Yyt$r1}d}|j	dtjd|Yd}~yd}~wwxYw)Nzfile %s must not existFTzfile z% must not exist; os.stat failed with )rrrrcr;rIrJ)r4r~rUs   rrfzWin32ErrorTests.setUpesy		CGGI$$%
II.1A1AAB!	F	1FII"))30
1
1	1s#ABB'B		Bc|jttjtj
tj
dzy)Nz.bak)ryrJrrrrcres rrzWin32ErrorTests.test_renameqs,'299i.>.>	@P@PQW@WXrcj|jttjtj
yr()ryrJrrrrcres rtest_removezWin32ErrorTests.test_removets'299i.>.>?rcj|jttjtj
yr()ryrJrrHrrcres r
test_chdirzWin32ErrorTests.test_chdirws'288Y-=-=>rc$|jtjtjt	tjd5}|jttjtjdddy#1swYyxYw)Nr )	rrrdrcr ryrJrrGrns  r
test_mkdirzWin32ErrorTests.test_mkdirzsc	(()*:*:;
)""C
(	CAgrxx1A1AB	C	C	Cs	4BBcl|jttjtj
dyr()ryrJrrrrcres rrzWin32ErrorTests.test_utimes '288Y-=-=tDrcl|jttjtj
dyr)ryrJrrrrcres r
test_chmodzWin32ErrorTests.test_chmods '288Y-=-=qArN)
r\r]r^rfrr	rr
rrr+rrrrcs+
CY@?CEBrrz!Cannot create invalid FD on WASI.ceZdZgdZdZeD]Zeeedez<dZdZe	jeedddZ
e	jeed	d
dZe	jeedd
dZe	jeedd
e	j ej$ddZe	jeedddZe	jeedddZe	jeedde	j ej$xsej,ddZe	jeedddZe	jeeddd Ze	jeed!d"d#Ze	jeed$d%d&Ze	jeed'd(d)Ze	jeed*d+d,Ze	jeed-d.d/Zej>d0Z e	jeed1d2d3Z!y4)5
TestInvalidFD)fchdirrv	fdatasyncrfstatvfsfsync	tcgetpgrpttynamecfd}|S)Ncfttr |jttyyr()rrrTr5rns rhelperz(TestInvalidFD.get_single.<locals>.helpers#A

72q>*rr+)rors` r
get_singlezTestInvalidFD.get_singles	+
rtest_c	|tjg|i||jd|zy#t$r4}|j	|j
t
jYd}~yd}~wwxYw)Nz5%r didn't raise an OSError with a bad file descriptor)rmake_bad_fdr;rJrCrKrx)r4rorrrs     rrTzTestInvalidFD.checksh	
i##%777
IIM
	3QWWekk22	3s5	A2*A--A2cF|jtjdy)Nrr)rTrrres rrzTestInvalidFD.test_fdopens

299w
/risattyztest needs os.isatty()cr|jtjtjdyNF)rCrr!rrres rtest_isattyzTestInvalidFD.test_isattys$9#8#8#:;UCrrxztest needs os.closerange()c(tj}tdD]}tj||zndkrt
jd|jtj|||zdz
dy#t
$rYpwxYw)Nrsrtz5Unable to acquire a range of invalid file descriptorsrr)
rrrrrrJrrOrCrx)r4rrs   rr}zTestInvalidFD.test_closeranges

"
"
$r	A"Q$	
q5##GI
Ir26!84d;

sB	BBdup2ztest needs os.dup2()cD|jtjdy)N)rTrr&res r	test_dup2zTestInvalidFD.test_dup2s

277Brz@dup2() with negative fds is broken on Emscripten (see gh-102179)c tjttj}|j	tj
||ddg}t
j|dD]\}}||k7s|j||5|jt5}tj||ddd|jjjtjdddy#1swYHxYw#1swYxYw)Nrirtr)rfd2)rr rrrrjrrrRryrJr&rCrwrKrx)r4valid_fdfdsrr+rzs      rtest_dup2_negative_fdz#TestInvalidFD.test_dup2_negative_fds778R[[1(+

!((Q7	GGBSy\\RS\1G**73)sC()$$S]]%8%8%++FGG	G))GGs$DC81<D8D=DD
	fchmodztest needs os.fchmod()cD|jtjdyr)rTrr/res rtest_fchmodzTestInvalidFD.test_fchmods

299a rfchownztest needs os.fchown()cF|jtjddy)Nr)rTrr2res rtest_fchownzTestInvalidFD.test_fchowns

299b"%r	fpathconfztest needs os.fpathconf()z-musl libc issue on Emscripten/WASI, bpo-46390c|jtjd|jtjdy)NPC_NAME_MAX)rTrpathconfr5res rtest_fpathconfzTestInvalidFD.test_fpathconfs(	

2;;
.

2<</r	ftruncateztest needs os.ftruncate()c|jtjd|jtjdyr)rTrtruncater:res rtest_ftruncatezTestInvalidFD.test_ftruncates&

2;;"

2<<#rrztest needs os.lseek()cF|jtjddyr)rTrrres r
test_lseekzTestInvalidFD.test_lseeks

288Q"rrztest needs os.read()cD|jtjdyr)rTrrres rrzTestInvalidFD.test_reads

277Arreadvztest needs os.readv()c\td}|jtj|gy)Nrs)rrTrrA)r4rs  r
test_readvzTestInvalidFD.test_readvsm

288cU#r	tcsetpgrpztest needs os.tcsetpgrp()cD|jtjdyr)rTrrDres rtest_tcsetpgrptzTestInvalidFD.test_tcsetpgrpts

2<<#rr!ztest needs os.write()cD|jtjdy)N )rTrr!res rrzTestInvalidFD.test_writes

288T"rwritevztest needs os.writev()cF|jtjdgy)Nr:)rTrrIres rtest_writevzTestInvalidFD.test_writevs

299vh'rc|jtj|jtjdyNT)rTrget_inheritableset_inheritableres rtest_inheritablezTestInvalidFD.test_inheritables(

2%%&

2%%t,rget_blocking-needs os.get_blocking() and os.set_blocking()c|jtj|jtjdyrM)rTrrQset_blockingres r
test_blockingzTestInvalidFD.test_blocking	s&	

2??#

2??D)rN)"r\r]r^singlesrrolocalsrTrrrrrr$r}r)rrrr.r1r4rr9r=r?rrCrFrrKrrPrUr+rrrrs><G
,(m,0XX.0HIDJDX\24PQ
<R
<XV,.DE F XV,.DEX__J
G	F

GXX.0HI!J!XX.0HI&J&X[13NOX__070	P
0X[13NO$P$XW-/FG#H#XV,.DEFXW-/FG$H$X[13NO$P$XW-/FG#H#XX.0HI(J(!W  "-#-X^4HJ*J*rrrzrequires os.linkc0eZdZdZdZdZdZdZdZy)	LinkTestsctj|_tjjtjdz|_y)Nr)rrcfile1rrDrFfile2res rrfzLinkTests.setUp
	s.%%
WW\\)"2"2S"89
rc|j|jfD]7}tjj	|s#tj
|9yr()r[r\rrDr~rd)r4files  rrzLinkTests.tearDown	s9ZZ,	 Dww~~d#		$	 rc	t|	tj||t|d5}t|d5}|j
tjj|j|jddddddy#t$r}|j	d|zYd}~d}~wwxYw#1swY<xYw#1swYyxYw)N
os.link(): %sr)
r%rrrrwr rkrDsameopenfiler)r4r[r\rrf2s      r
_test_linkzLinkTests._test_link	sE	/GGE5!%
	L"d5$&7	L2OOBGG00biikJK	L	L	L	/MM/A-..	/	L	L	L	Ls:B
CACC	C"B;;CC	CCcP|j|j|jyr()rcr[r\res r	test_linkzLinkTests.test_link	s

DJJ/rc|jt|jtjt|j
tjyr()rcrYr[r=rLr\res rtest_link_byteszLinkTests.test_link_bytes 	s<djj#*C*C*EFdjj#*C*C*EF	Hrc	tjd|xj
dz
c_|j
dz|_|j|j
|jy#t$rtjdwxYw)Nñz#Unable to encode for this platform.r)rr(UnicodeErrorrrOr[r\rcres rtest_unicode_namezLinkTests.test_unicode_name$	so	KKK	

f
ZZ#%


DJJ/	K##$IJJ	KsA''BN)	r\r]r^rfrrcrergrkr+rrrYrY	s": 
L0H0rrYzPosix specific testsceZdZdZdZejeedddZ	ejeedddZ
ejeedd	d
Zejeeddd
ZejeedddZ
ejeeddejdZejeeddejdZejeeddejdZy)PosixUidGidTestssetuidztest needs os.setuid()c$tjdk7r%|jttjd|jt
tjd|jttj|jyNrz
not an int)rgetuidryrJror
OverflowErrorUID_OVERFLOWres rtest_setuidzPosixUidGidTests.test_setuid4	sX
99;!gryy!4)RYY=-D4E4EFrsetgidztest needs os.setgid()c0tjdk7r+ts%|jttj
d|jttj
d|jttj
|jyrq)	rrrHAVE_WHEEL_GROUPryrJrvrrsGID_OVERFLOWres rtest_setgidzPosixUidGidTests.test_setgid;	s[
99;!$4gryy!4)RYY=-D4E4EFrseteuidztest needs os.seteuid()c$tjdk7r%|jttjd|jt
tjd|jttj|jyrq)	rrrryrJr{rsetegidrsrtres rtest_seteuidzPosixUidGidTests.test_seteuidB	sX
99;!grzz15)RZZ>-T5F5FGrr}ztest needs os.setegid()c0tjdk7r+ts%|jttj
d|jttj
d|jttj
|jyrq)	rrrrxryrJr}rrsryres rtest_setegidzPosixUidGidTests.test_setegidI	s[
99;!$4grzz15)RZZ>-T5F5FGrsetreuidztest needs os.setreuid()ctjdk7r&|jttjdd|jt
tjdd|jt
tjdd|jttj|jd|jttjd|jyrq)rrrryrJrrrsrtres r
test_setreuidzPosixUidGidTests.test_setreuidP	s
99;!gr{{Aq9)R[[,B)R[[!\B-d6G6GK-a9J9JKrcPtjtjddgy)Nrz,import os,sys;os.setreuid(-1,-1);sys.exit(0)rrr=rres rtest_setreuid_neg1z#PosixUidGidTests.test_setreuid_neg1Y	%
	>@	Arsetregidztest needs os.setregid()ctjdk7r,ts&|jttj
dd|jttj
dd|jttj
dd|jttj
|jd|jttj
d|jyrq)	rrrrxryrJrrrsryres r
test_setregidzPosixUidGidTests.test_setregidb	s99;!$4gr{{Aq9)R[[,B)R[[!\B-d6G6GK-a9J9JKrcPtjtjddgy)Nrz,import os,sys;os.setregid(-1,-1);sys.exit(0)rres rtest_setregid_neg1z#PosixUidGidTests.test_setregid_neg1l	rrN)r\r]r^rtryrrrrrurzr~rrrrrrrr+rrrmrm.	sLLXX.0HIGJGXX.0HIGJGXY/1JKHLHXY/1JKHLHXZ02LMLNLXZ02LM W  "A#NAXZ02LM W  "L#NLXZ02LM W  "A#NArrmcjeZdZdZdZdZdZeje	e
dddZdZy	)
Pep383Testsctjrtj|_n;tjrtj|_ntj|_tj|j|_gfd}|tjtjr|tjtjr|tjs|jdt|_tj|j	D]}tjt
jj|j|tj |}||jvrt#d|jj%|y#t'j(|jxYw)Ncr	tj|}j|y#t$rYywxYwr()rr(rMr)fnbytesfns radd_filenamez'Pep383Tests.setUp.<locals>.add_filename	s7
[[_
NN2&

s*	66z&couldn't create any non-ascii filenamezduplicate filename)rTESTFN_UNENCODABLEr2TESTFN_NONASCIIrcrr(bdirTESTFN_UNICODErwr	unicodefnrGcreate_empty_filerDrFrZraddshutilr)r4rrrs   @rrfzPep383Tests.setUpw	sG'' 33DH

&
& 00DH ''DHKK)			Y--.''556$$223MMBC
		
'++BGGLLB,GH[[_'$%9::""2&
'	MM$((#s
2B
G"G"cBtj|jyr()rrr2res rrzPep383Tests.tearDown	s

dhhrc|j}ttj|j}|j||tj}	tjtj|jttjttjtjtj|y#tj|wxYwr()	rrrrr2rCr0rHrE)r4rSfoundcurrent_directorys    rtest_listdirzPep383Tests.test_listdir	s>>BJJtxx())IIK	(HHRVVS.BJJrvv4F0GHHH&'BHH&'s
A:C,,Dc|jD]F}ttjj	|j
|d}|j
HyNr)rr rrDrFr2rj)r4rros   r	test_openzPep383Tests.test_open	s=..	BRWW\\$((B/6A
GGI	rrZroc|jD]A}tjj|j|}tj
|Cyr()rrrDrFr2rZ)r4rfullnames   rtest_statvfszPep383Tests.test_statvfs	s;..	!Bww||DHHb1HJJx 	!rc|jD]?}tjtjj	|j
|Ayr()rrrrDrFr2)r4rs  r	test_statzPep383Tests.test_stat	s4..	0BGGBGGLL2./	0rN)
r\r]r^rfrrrrrrrrrr+rrrru	sI#J 
(
XY//1!1!0rrceZdZdZdZdZejeduddZ	ejdejdZ
ejd	Zy)
Win32KillTestscddl}ddlm}ddl}|jjj
}|j|_|j|j|j|j|j|j|j|j|j|jf|_d}tjtj ddj#|gtj$tj$tj$}|j'|j(j*|j'|j,j*|j'|j.j*d\}}	||	kr|j1|j3t5|}
||j7|j(j9|
|j;|
ddd}|j=|dd|
j>r+|jA||
j>jCnAtEjFd	|d
z
}||	kr|j1|jIdtKjL|jN||jA|jQ|y)Nrwintypesrunningrz<import sys;sys.stdout.write('{}');sys.stdout.flush();input())rUstderrstdinrrzPeekNamedPipe failed皙?rrz1Did not receive communication from the subprocess))rrmsvcrtrr
PeekNamedPipeBOOLrestypeHANDLEPOINTERc_charDWORDargtypesrPopenr=rrr[rrUrjrrpollcreate_string_bufferr?
get_osfhandlersizeofrrlrCrMrsleepr;rkillpidwait)r4sigrrrrrr^rmaxrrslts            r_killzWin32KillTests._kill	s
	#

..<<
 (


"*//"(.."?"*.."(.."@"(.."@"(.."@"B
"+,26#;	!8
(2'1&0oo7	
))*))*

(()
sckdiik1--c#h7C!!5!5dkk6H6H6J!K!$fmmC&8$dLDa)?@yy  cii&6&6&89JJsOQJEckdiik1
IIIJ
#c*rcB|jtjyr()rsignalSIGTERMres rtest_kill_sigtermz Win32KillTests.test_kill_sigterm	s

6>>"rc&|jdy)Nr)rres r
test_kill_intzWin32KillTests.test_kill_int	s


3rNz
requires mmapcdtjz}tjdd|}d|d<tjt
jtjjtjjtd|gtj}d\}}||krI|j9|ddk(rnotjd|dz
}||kr|j9tj |j"t$j&|j)d	tj |j"|tjd
|jsOtj |j"t$j&|j)dj+|yy)Nz
test_os_%srrrrzwin_console_handler.pyrrrz'Subprocess didn't finish initializationg?zsubprocess did not stop on {})uuiduuid1mmaprrr=rrrDrFrQrCREATE_NEW_PROCESS_GROUPrrrrrrSIGINTr;r)r4eventrtagnamemr^rrs        r_kill_with_eventzWin32KillTests._kill_with_event	sM-IIb!W%!77<< 9 8:;B!D",!D!DF

sckdiik1tqyJJsOQJE	ckdiik1
GGDHHfmm,II?@
% 	

3yy{GGDHHfmm,II5<<TBCrz.subprocesses aren't inheriting Ctrl+C propertycdddlm}ddl}|j|j}|jj
j}|j|j|jf|_|j|_	||d|jtjdy)NrrCTRL_C_EVENT)
rrrc_intrrSetConsoleCtrlHandlerrrrrrr)r4rrNULLrs     rtest_CTRL_C_EVENTz Win32KillTests.test_CTRL_C_EVENT
s	$,v~~fll+- &

 6 6 L L*0..*F*2--*9&(0

%
	dA&f11>BrcD|jtjdy)NCTRL_BREAK_EVENT)rrrres rtest_CTRL_BREAK_EVENTz$Win32KillTests.test_CTRL_BREAK_EVENT/
sf557IJr)r\r]r^rrrrrrrskiprrrrr+rrrr	s4+l#X__TT\?3D4D:X]]CD W  "C#EC$!W  "K#Krrc(eZdZdZdZdZdZdZy)Win32ListdirTestszTest listdir on Windows.cg|_tdD]}d|z}tjj	t
j|}d|z}tjj	t
j|}tj|t|dd5}|jd|zddd|jj||g|jjy#1swYCxYw)NrtzSUB%dzFILE%dryrrz'I'm %s and proud of it. Blame test_os.
)
created_pathsrrrDrFrrcrr r!rr)r4rdir_namedir_path	file_name	file_pathros       rrfzWin32ListdirTests.setUp8
sq	=A{Hww||I$4$4h?H 1IY%5%5yAIKK!iw7
P1BYNO
P%%x&;<	=	
!
P
PsC66C?	cJtjtjyr()rrrrcres rrzWin32ListdirTests.tearDownE
s

i&&'rc	|jttjtj
|j|jttjtjtj
|jDcgc]}tj|c}ycc}w)z-Test when the path is not an "extended" path.N)rCrrrrrcrr(rVs  rtest_listdir_no_extended_pathz/Win32ListdirTests.test_listdir_no_extended_pathH
s	
rzz)"2"234""	$
	
rzz"++i.>.>"?@A/3/A/ABtT"B	DBsC
c	dtjjtjz}|jt
tj||jdtjtjjtjz}|jt
tj||jDcgc]}tj|c}ycc}w)z&Test when the path starts with '\\?\'.\\?\\\?\N)
rrDrrrcrCrrrr(rVs  rtest_listdir_extended_pathz,Win32ListdirTests.test_listdir_extended_pathT
s277??9+;+;<<rzz$'(""	$
BKK	8H8H(IJJrzz$'(/3/A/ABtT"B	DBs"D
N)r\r]r^rrfrrrr+rrrr4
s""(
D
Drrr>zNT specific testsc(eZdZdZdZdZdZdZy)Win32ListdriveTestsz5Test listdrive, listmounts and listvolume on Windows.c	tjgdtjj	tj
ddddd}|j
}|Dchc]}|jds|c}|_|Dchc]
}|d	dd
k(s|c}|_	|Dchc]
}|d	dd
k(s|c}|_
ycc}wcc}wcc}w)N)z
fsutil.exevolumer
SystemRootz\WindowsSystem32mbcsignore)r5rrrrrz:\r)rcheck_outputrrDrFgetenvr
startswith
known_volumesknown_drivesknown_mounts)r4rlinesls    rrfzWin32ListdriveTests.setUph
s%%,RYY|[A:N	
 ).JA!,,y2IaJ(-@112%Q@(-A11Q5QAK@As$"C9C	
CC'
C5Cctj}|j|t|j	|j
|j
t
|zyr()r
listdrivesr1rassertSetEqualrr)r4drivess  rtest_listdrivesz#Win32ListdriveTests.test_listdrivesu
sFfd+F+	
rctj}|j|t|j	|j
|j
t
|zyr()rlistvolumesr1rrrr)r4volumess  rtest_listvolumesz$Win32ListdriveTests.test_listvolumes}
sG.."gt,W-	
rcXtjD]_}	tj|}|j|t|jt
||jt
|zay#t$r(}tjrtd|d|Yd}~d}~wwxYw)NSkippingz
because of)rr
listmountsr1rrrrrJrrMrN)r4rmountsexs    rtest_listmountsz#Win32ListdriveTests.test_listmounts
snn&	F

v.
%%fd3##K%%F3	
@??*flB?
@sA88	B)B$$B)N)r\r]r^rrfrr
rr+rrrrd
s?B

rrreadlinkzneeds os.readlink()ceZdZdZej
j
eZejeZ
ejeZdZdZ
dZdZej"dZej"dZej"dZy	)

ReadlinkTestsreadlinktestctjj|}tjj|}tjdk(rd}||r|dd}||r|dd}|j||y)NrcP|jt|trdSdS)Nrr)rrirY)rWs rrz/ReadlinkTests.assertPathEqual.<locals>.<lambda>
s'1<<(E2
$C8A$Crr)rrDnormcaser=r>rC)r4leftright
has_prefixs    rassertPathEqualzReadlinkTests.assertPathEqual
stww%  '<<7"CJ$ABx% ab	u%rc|jtjj|j|jtjj|j
|j
tjj|j|j
tjj|jyr()	rkrrDr~filelink_targetfilelinkb_targetrfilelink	filelinkbres rrfzReadlinkTests.setUp
s~t';';<=t'<'<=>

6778rct|j}|jttj
|j|jttj
|yr()rrryrJrr)r4rs  rtest_not_symlinkzReadlinkTests.test_not_symlink
sD"4#7#78'2;;0D0DE'2;;@rc|jttjd|jttjt	dy)Nzmissing-link)ryrIrrrres rtest_missing_linkzReadlinkTests.test_missing_link
s8+R[[.I+R[[">2	4rc4tj|j|j|j	t
j|jt|j}|jtj||jyr()
rrrrrrrdrrr)r4rs  r
test_pathlikezReadlinkTests.test_pathlike
s_


4''7	(($--8DMM*R[[2D4H4HIrc`tj|j|j|j	t
j|jtjt|j}|j||j|j|tyr()rrrr rrrdrrrr1rYrVs  rtest_pathlike_bytesz!ReadlinkTests.test_pathlike_bytes
so


4(($..9	(($..9{{8DNN34T4#8#89dE*rcNtj|j|j|j	t
j|jtj|j}|j||j|j|tyr()rrrr rrrdrrr1rYrVs  r
test_byteszReadlinkTests.test_bytes
sj


4(($..9	(($..9{{4>>*T4#8#89dE*rN)r\r]r^rrrDrrrr(r rrrfr"r$rskip_unless_symlinkr&r(r*r+rrrr
sHggooh/OH%I"r{{?3&9A
4
""J#J""+#+""+#+rrcjeZdZdZej
j
eZdZ	ej
jeZdZdZ
dZdZdZdZd	Zd
ZdZdZd
Zej0ej
j3dxrej
j5dddZdZdZy)Win32SymlinkTestsfilelinktestdirlinktestzmissing linkctjj|jsJtjj|jsJtjj|j
rJtjj|jrJtjj|jrJyr()rrDr~dirlink_targetrdirlinkrmissing_linkres rrfzWin32SymlinkTests.setUp
s~ww~~d1122ww~~d223377>>$,,//77>>$--0077>>$"3"3444rctjj|jrtj|jtjj|j
rtj|j
tjj|jr tj|jyyr()	rrDr~rrr2rrbr3res rrzWin32SymlinkTests.tearDown
sw
77>>$--(IIdmm$
77>>$,,'HHT\\"
77??4,,-IId''(.rctj|j|j|j	tj
j
|j|j	tj
j|j|j	tj
j|j|j|j|jyr()
rrr1r2rkrDr~r@islink
check_statres rtest_directory_linkz%Win32SymlinkTests.test_directory_link
s


4&&5t||45

dll34t||45d&9&9:rctj|j|j|j	tj
j
|j|j	tj
j|j|j	tj
j|j|j|j|jyr()
rrrrrkrDr~rr6r7res rtest_file_linkz Win32SymlinkTests.test_file_link
s


4''7t}}56t}}56t}}56

t';';<rc|j}tjj|rtj|d}tjj|rJd}tj|||y)z2Create a "directory" link to a non-existent targetz"c:\\target does not exist.29r3c740TN)r3rrDrbrr~r)r4linknamer
target_is_dirs    r_create_missing_dir_linkz*Win32SymlinkTests._create_missing_dir_link
sV$$
77??8$IIh677>>&))



68]3rcb|jtj|jyr()r>rrr3res r,test_remove_directory_link_to_missing_targetz>Win32SymlinkTests.test_remove_directory_link_to_missing_targets"%%'			$##$rc|j|jtjj	|j
yr()r>rrrDr@r3res r.test_isdir_on_directory_link_to_missing_targetz@Win32SymlinkTests.test_isdir_on_directory_link_to_missing_targets/%%'t'8'89:rcb|jtj|jyr()r>rrr3res r.test_rmdir_on_directory_link_to_missing_targetz@Win32SymlinkTests.test_rmdir_on_directory_link_to_missing_targets %%'
""#rc|jtj|tj||jtj|tj|tj
|}|jtj|tj||jtj|tj|yr()rCrrrrNr()r4rr
bytes_links    rr7zWin32SymlinkTests.check_stats8BHHTNBGGDM:[[&
,bggfo>BHHZ0"''*2EFrc
tjjtj}tjj|d}tjj|d}|j
tj|tj|tj|tj|tjjtjj|d}t|tj}	tj|tjj|d}tjtjj|d|jdtjtj|j!tj"|tj"dtj||j!tj"|tj"tjj|tj||j!tj"|tj"tjj|tj|y#tj|wxYw)Nlevel2level3r[r)rrDrrrcrFrrrGr%r0rHrrelpathrrrCr)r4level1rHrIr[orig_dirrs       r
test_12084zWin32SymlinkTests.test_12084s!1!12fh/fh/	((&1


VW =>E99;	HHV77<</DJJrwwu-v6MM&"**RYY["9:
RWWU^RWWV_=
HHVRWWU^WWRWW__T%:;
=
HHVRWWU^WWRWW__T%:;
=
HHXBHHXs
*F+K++LC:\Users\All UsersC:\ProgramDatazTest directories not foundctjd}|jtjj	|dy)NrNrO)rrrkrDsamefile)r4rs  r
test_29248zWin32SymlinkTests.test_29248;s123((1BCDrcd}tjj|gdz}d|z|f||f|dd|ddfg}|D]\}}	tj||	tj|	tjtj|tj|	tj|y#t
$rYawxYw#t$rYpwxYw#t
$rYwxYw#t$rYwxYw)NXXXXXXXXXXXXXXXXXXXXXXXXXXXrsr)rrDrFrrrJrIr()r4segmentrD
test_casesrdests      rtest_buffer_overflowz&Win32SymlinkTests.test_buffer_overflowJsww||gY^,D['"
dO
$3Zds$


$	IC


3%IIdO


2;;s+R[[->?IIdO#	%

%

sHCC-<C/*C 	C
C	CC 	C,+C,/	C;:C;cRtjjd}tjj|s|j	dtjtj|dDcgc]"}tjj||$}}|D]}tjrttd|tj|}|j|tj||jtj |j"|j|j$tj&|j)tjj+|y|j	dycc}w)Nz$%LOCALAPPDATA%\Microsoft\WindowsAppsz%test requires a WindowsApps directoryz*.exezTesting withz$test requires an app execution alias)rrD
expandvarsr@rwfnmatchfilterrrFrrMrNrNrCrrS_ISLNKr=st_reparse_tagIO_REPARSE_TAG_APPEXECLINKrkr)r4rr<aliasesaliasrs      rtest_appexeclinkz"Win32SymlinkTests.test_appexeclinkms/ww!!"IJww}}T"MMAB$NN2::d+;WEG77<<a(GG	BEne,%BR0T\\"**56R..0O0OPOOBGGNN512	B
MM@AGs;'F$N)r\r]r^rrrDrrrr2rQr1r3rfrr8r:r>r@rBrDr7rMrrrbr~rRrYrcr+rrr-r-
sHggooh/OGWW___5N!L5);=4%;$G!FX)>?B "/@ A8:
E:
E!FBrr-ceZdZdZej
j
ej
jeZ	dZ
dZdZdZ
y)Win32JunctionTestsjunctiontestctjj|jsJtjj	|j
rJyr()rrDr~junction_targetrbjunctionres rrfzWin32JunctionTests.setUps5ww~~d223377??4==111rctjj|jr tj|jyyr()rrDrbrirdres rrzWin32JunctionTests.tearDowns+
77??4==)IIdmm$*rc4tj|j|j|j	t
jj|j|j	t
jj|j|j	t
jj|j|jtj|jtj|j|jtj|jtj|j|jt
jj|j|jt
jj!d|jzt
jj!tj"|jy)Nr)_winapiCreateJunctionrhrirkrrDrbr~r@rrrNrCrr6rrres rtest_create_junctionz'Win32JunctionTests.test_create_junctions4t33T]]C

67t}}56

dmm45BGGDMM2BHHT]]4KL/9M9M1NO	


67)))d6J6J*JK))"++dmm*DE	Grctj|j|j|j	t
jj|j|j	t
jj|jtj|j|jt
jj|jyr()rlrmrhrirkrrDr~rbrdrres rtest_unlink_removes_junctionz/Win32JunctionTests.test_unlink_removes_junctionst33T]]Ct}}56

67
		$-- 

67rN)r\r]r^rirrDrQrrrhrfrrnrpr+rrreres;Hggoobggooh&?@O2%G8rrec@eZdZdZej
dZy)Win32NtTestsctjd}tjd}ddl}|jdd}|jj
|j_|jj|j_|jj
|jjf|j_|j
}|jj}|j||j|}|jd||j}dd	d
t g}t#dD]1}	|D]*}
	|j%|
	t)j*|
,3|j||j|}|jd||j|z
}|jd|y#t&$rYzwxYw#t&$rYwxYw)Nr>rrzKernel32.dllT)use_last_errorrrz\\?\C:z\\?\NULz	\\?\CONINrs)r
import_modulectypes.wintypesWinDLLrrGetCurrentProcessrrGetProcessHandleCountLPDWORDrrbyrefrCrlrr_getfinalpathname	Exceptionrr)r4r>rkernelhprochandle_countrbefore_count	filenamesrrhandle_deltas            rtest_getfinalpathname_handlesz*Win32NtTests.test_getfinalpathname_handless

(
(
.,,X6~dC+1??+A+A  (/5/C/C$$,171G1G171H1H1J$$-((*,,.

)
)%l1K
LB#))
	
	r
	A!	
((.GGDM	

	
)
)%l1K
LB#))L8L)!
!s$G G	GG	G)(G)c	tj}|jtj|t	jdz}tjd}tjtjd||t|g5}t	j|kr.	tj|t	j|kr.	|j!ddddy#t$r}|jdk(sJYd}~Rd}~wwxYw#tj"$r|j%YUwxYw#1swYyxYw)Nra            import os
            import sys
            import time

            filename = sys.argv[1]
            deadline = float(sys.argv[2])

            while time.time() < deadline:
                try:
                    with open(filename, "w") as f:
                        pass
                except OSError:
                    pass
                try:
                    os.remove(filename)
                except OSError:
                    pass
            rrtrr)rrcrrdrtextwrapdedentrrr=rr2rrrIrrTimeoutExpired	terminate)r4r"deadlinecommandr^rs      rtest_stat_unlink_racez"Win32NtTests.test_stat_unlink_races$$	(((399;?//#(

s~~tWhH
V
W		![_))+(+GGH%))+(

!		!		!		!)+::?*?+,,
! 
!		!		!sTD?'C/<D?D/	D8D	D?DD?#D<9D?;D<<D??EN)r\r]r^rrrrr+rrrrrrs'.*`!W  "'!#'!rrrceZdZdZdZdZy)NonLocalSymlinkTestsc.tjdy)zM
        Create this structure:

        base
         \___ some_dir
        z
base/some_dirN)rrres rrfzNonLocalSymlinkTests.setUps	O$rc.tjdy)Nr)rrres rrzNonLocalSymlinkTests.tearDowns

frctjjdd}tjd|tjj	|sJy)a
        The symlink target should resolve relative to the link, not relative
        to the current directory.

        Then, link base/some_link -> base/some_dir and ensure that some_link
        is resolved as a directory.

        In issue13772, it was discovered that directory detection failed if
        the symlink target was not specified relative to the current
        directory, which was a defect in the implementation.
        r	some_linksome_dirN)rrDrFrr@)r4rs  rtest_directory_link_nonlocalz1NonLocalSymlinkTests.test_directory_link_nonlocals<ggll6;/


:s#ww}}S!!!rN)r\r]r^rfrrr+rrrrs%"rrceZdZdZdZy)FSEncodingTestsc|jtjdd|jtjddy)NsabcuabcŁ)rCrr(rZres rtest_nopzFSEncodingTests.test_nop#s4Z0*=[1;?rcdD]=}	tj|}|jtj||?y#t$rYLwxYw)N)u	unicodeŁulatinéascii)rr(rMrCrZ)r4rrs   r
test_identityzFSEncodingTests.test_identity'sR9	7B
++b/
R[[126	7&

sA	AAN)r\r]r^rrr+rrrr"s
@7rrceZdZdZej
ejdxr;exr1e	jjdxsee
dxr	ee
ddejej ddZy	)
DeviceEncodingTestscL|jtjdy)Ni@)rgrdevice_encodingres rtest_bad_fdzDeviceEncodingTests.test_bad_fd4s",,V45rrwinnl_langinfoCODESETz>test requires a tty and either Windows or nl_langinfo(CODESET)z*Cannot get encoding of stdin on Emscriptenctjd}|j||jt	j
|yr)rrassertIsNotNonerkcodecslookup)r4rs  rtest_device_encodingz(DeviceEncodingTests.test_device_encoding8s7%%a(X&

h/0rN)r\r]r^rrrrr!r	r=r>rrlocalerrrrr+rrrr2s6X1Mln*<M#,,BYBYZ_B`CL
V]
+
J	0JLNX__K1N1rrc8eZdZejeedddZddZdZ	dZ
ejejdk(d	d
Z
ejejdk(d	dZejeedd
dZy)PidTestsgetppidztest needs os.getppidc2tjtjddgtjtj}|j\}}|j
|d|j
t|tjy)Nrzimport os; print(os.getppid()))rUrr)
rrr=_base_executabler[communicaterCrrgetpid)r4rWrUerrors    rtest_getppidzPidTests.test_getppidFsnc22D>@$.OO$.OO
5


$Vbiik2rNctjdk(rdtjddd|dg}ntjd|g}tjtj
tj|}|||tj|d\}}|jtj|||j||y)Nr"rr)	r=r>rrspawnvP_NOWAITwaitpidrCwaitstatus_to_exitcode)r4rexitcodecallbackrrpid2statuss        r
check_waitpidzPidTests.check_waitpidQs<<7"'q)41TF!=DNND$/DiiS^^T:SMzz#q)f226:HEs#rc*|jddy)Nrr)rrrres rtest_waitpidzPidTests.test_waitpidcs3rcd}d|d}|j|||jt5tjddddy#1swYyxYw)Nzimport sys; sys.exit()rg)rryrrr)r4rrs   rtest_waitstatus_to_exitcodez$PidTests.test_waitstatus_to_exitcodefsY&xj24(3


y
)	+%%c*	+	+	+sAArwin32-specific testc:d}d|d}|j||y)Nl:z$import _winapi; _winapi.ExitProcess(rrr)r4STATUS_CONTROL_C_EXITrs   rtest_waitpid_windowszPidTests.test_waitpid_windowsns.!+56K5LAN4*?@rcvd}ddd|fD]*}|jtj|dz|,|jt5tj|dzdzddd|jt
5tjddddy#1swY=xYw#1swYyxYw)Nr~rrrrr*r)rCrrryrrs)r4max_exitcoders   r#test_waitstatus_to_exitcode_windowsz,PidTests.test_waitstatus_to_exitcode_windowsvs"Aq,/	'HR66x1}E%
'	'


z
*	?%%|a'7A&=>	?


}
-	*%%b)	*	*	?	?	*	*sB#B/#B,/B8SIGKILLzneed signal.SIGKILLcdtjd}tjfd}|j	||y)Nzimport time; time.sleep(rc2tj|yr()rr)rsignums rkill_processz?PidTests.test_waitstatus_to_exitcode_kill.<locals>.kill_processsGGC r)rr)rLONG_TIMEOUTrrr)r4rrrs   @r test_waitstatus_to_exitcode_killz)PidTests.test_waitstatus_to_exitcode_kills?)'*>*>)?qA	!	
46'LIrr()r\r]r^rrrrrrrrr=r>rrrrr+rrrrDsXY/1HI3J3$$4+X02GHAIAX02GH
*I
*X35JKJLJrrceZdZedZddddZeddZeddZed	d
Z	eddZ
ed
dZeddZeddZ
eddZed
dZeddZeddZeddZed
dZeddZdZeddZeddZy)
SpawnTestsctjdk7r|S|Dcgc]}d|jvrd|dn|c}Scc}w)Nr> r)rrr)rrs  r
quote_argszSpawnTests.quote_argssB77d?KEIJccSYY[0!C5
c9JJJs!>Fwith_env	use_bytescd|_tj}|jtj||sd|jz}nttj|_ttj|_|j|j|j<d|jd|jd}t|dd5}|j|dddtj }|j#||g}|rt
j$|}|Dcgc]}t
j$|}}|jj'D	
cic].\}	}
t
j$|	t
j$|
0c}
}	|_||fS#1swYxYwcc}wcc}
}	w)	Nzimport sys; sys.exit(%s)z#import sys, os; magic = os.environ[z]; sys.exit(rryrr)rrrcrrdrrrr1r2ruuid4r
r r!r=rrr(r)r4rrr"rr$rrr<kvs           rcreate_argszSpawnTests.create_argssT
##	(((3-

=DBJJ'DH4::<(DH!%DHHTXXxx0D(C'
2	bHHTN	..23kk'*G,01qBKKN1D1$(HHNN$46 AqAA66DH}		26sF+0F7+3F<+F4spawnlc|j\}}tjtj|g|}|j	||j
yr()rrrP_WAITrCrr4rrrs    rtest_spawnlzSpawnTests.test_spawnlsA((*
99RYY7$74==1rspawnlec|jd\}}tjtj|g||j}|j||jyNT)r)rrrrr1rCrrs    rtest_spawnlezSpawnTests.test_spawnlesO(($(7
::biiB4BB4==1rspawnlpc|j\}}tjtj|g|}|j	||j
yr()rrrrrCrrs    rtest_spawnlpzSpawnTests.test_spawnlpsA((*
::bii8484==1rspawnlpec|jd\}}tjtj|g||j}|j||jyr)rrrrr1rCrrs    r
test_spawnlpezSpawnTests.test_spawnlpesO(($(7
;;ryy'CDC$((C4==1rrc@|j\}}tjtj||}|j	||j
tjtjt
||}|j	||j
yr()rrrrrCrrrs    rtest_spawnvzSpawnTests.test_spawnvso((*
99RYY64==199RYY(94@4==1rspawnvec|jd\}}tjtj|||j}|j||jyrrrrrr1rCrrs    rtest_spawnvezSpawnTests.test_spawnvesI(($(7
::bii$A4==1rspawnvpc|j\}}tjtj||}|j	||j
yr()rrrrrCrrs    rtest_spawnvpzSpawnTests.test_spawnvps>((*
::bii$74==1rspawnvpec|jd\}}tjtj|||j}|j||jyr)rrrrr1rCrrs    r
test_spawnvpezSpawnTests.test_spawnvpesI(($(7
;;ryy'4B4==1rc|j\}}tjtj||}t	j
||jy)Nr)rrrrrwait_processr)r4rrrs    rtest_nowaitzSpawnTests.test_nowaits>((*
iiWd3S4==9rc|jdd\}}tjtj|||j}|j||jy)NTrrrs    rtest_spawnve_byteszSpawnTests.test_spawnve_bytessM(($$(G
::bii$A4==1rc|j\}}|jttjtj
||jttjtj
|dyNr)rryrrrrr4r__s   rtest_spawnl_noargszSpawnTests.test_spawnl_noargssN&&(*biigF*biigrJrc|j\}}|jttjtj
|i|jttjtj
|diyr)rryrrrrrs   rtest_spawnle_noargszSpawnTests.test_spawnle_noargssR&&(*bjj"++wK*bjj"++wBOrc|j\}}|jttjtj
|d|jttjtj
|g|jttjtj
|d|jttjtj
|dgyNr+r7r)rryrrrrrs   rtest_spawnv_noargszSpawnTests.test_spawnv_noargs
s&&(*biigrJ*biigrJ*biiguM*biigtLrc|j\}}|jttjtj
|di|jttjtj
|gi|jttjtj
|di|jttjtj
|dgiyr
)rryrrrrrs   rtest_spawnve_noargszSpawnTests.test_spawnve_noargs
s&&(*bjj"++wBO*bjj"++wBO*bjj"++wrR*bjj"++wbQrctj}|j|ddg}tjj}d|d<	|tj|||}|j|dtjj}d|d<	|tj|||}|j|dtjj}d|d	<	|tj|||}|j|dtj}|jtj|t|d
d5}|jd
ddd|j||g}tjj}d|d<|tj|||}|j|dy#t$rYdwxYw#t$rY%wxYw#t$rYwxYw#1swYxYw)NrrrrrrrrryrrzPimport sys, os
if os.getenv("FRUIT") != "orange=lemon":
    raise AssertionErrorzorange=lemonr)r=rrrrrrrCrrrcrrdr r!)r4spawnrrrrr"r$s        r_test_invalid_envzSpawnTests._test_invalid_env
s..v67"%.!"	,RYYv>H
Xs+"5w	,RYYv>H
Xs+"!(~	,RYYv>H
Xs+##	(((3
(C'
2	1bHH0
1	1
23"(wGT6:1%K							1	1sB	GG'G,G;	GG	G)(G),	G87G8;HcB|jtjyr()rrrres rtest_spawnve_invalid_envz#SpawnTests.test_spawnve_invalid_envD
srzz*rcB|jtjyr()rrrres rtest_spawnvpe_invalid_envz$SpawnTests.test_spawnvpe_invalid_envH
sr{{+rN)r\r]r^rrrrrrrrrrrrrrrrrr
rrrr+rrrrsKK',u<h2 2
i 2!2
i 2!2
j!2"2
h2 2i 2!2
i 2!2
j!2"2
h: :
i 2!2hK K
i P!P
hM Mi R!R.&`i +!+j!,",rrz>Skip due to platform/environment differences on *NIX buildbotsgetloginztest needs os.getloginceZdZdZy)
LoginTestscbtj}|jt|dyr)rrrr?)r4	user_names  r
test_getloginzLoginTests.test_getloginR
s!KKM	C	NA.rN)r\r]r^rr+rrrrO
s/rrgetprioritysetpriorityz'needs os.getpriority and os.setpriorityceZdZdZdZy)ProgramPriorityTestsz0Tests for os.getpriority() and os.setpriority().c|tjtjtj}tjtjtj|dz	tjtjtj}|dk\r|dkrtjd|z|j||dz		tjtjtj|y#t$r(}|jtjk7rYd}~yd}~wwxYw#	tjtjtj|w#t$r(}|jtjk7rYd}~wd}~wwxYwxYw)Nrrz?unable to reliably test setpriority at current nice level of %s)rrPRIO_PROCESSrrrrOrCrJrKEACCES)r4rnew_priors    rtest_set_get_priorityz*ProgramPriorityTests.test_set_get_priority\
s.~~booryy{;
r		TAX>	~~booryy{CHrzh"n'')FHL)MNN  4!84
r		TB
99,-

r		TB
99,-
sO2A-E
!7D	E
"EE

F;7FF;	F8F3.F;3F88F;N)r\r]r^rr%r+rrrrW
s;rrsendfileztest needs os.sendfile()cJeZdZddzZej
j
dxr:ej
j
dxrej
j
dZejedZ
ejejdkdZe
d	Ze
d
ZedZdZd
ZdZedZedZdZdZdZdZdZe
dZe
dZe
edZe
edZe
eje e!dddZ"y)TestSendfiles12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcdeilinuxsolarissunosz%requires headers and trailers supportrnz(test is only meaningful on 32-bit buildscLttj|jyr()r%rrcDATArZs rr\zTestSendfile.setUpClass{
sI$$chh/rcJtjtjyr()rrdrcrZs rrzzTestSendfile.tearDownClass
s))*rcK|js-|jd{|js,yy7wr()at_eofr)readers rchunkszTestSendfile.chunks
s,--/
%%--/%s$AAAAcKdj|j|2cgc3d{}|76ncc}wc}|_|j|jjyw)Nr)rFr2
server_bufferrjserver)r4r1writerr s    rhandle_new_clientzTestSendfile.handle_new_client
sN XXF8K&L&L1q&L&L&LMs&A/31
/1
31
3=A/ctKd|_tj|jtj
d{|_|jjdj}tj|_
|jjdtjj|j|d{|jj|_t!t"j$d|_|j&j|_y77dw)NrrFr)r4r)start_serverr7rHOSTv4r5socketsgetsocknamesocketclientsetblockingget_running_loopsock_connectrsocknor rrcr^)r4server_names  r
asyncSetUpzTestSendfile.asyncSetUp
s #001G1G1>1E1EGGkk))!,88:mmo&&&(55dkk;OOOkk((*))40	ii&&(G
	Ps#9D8D4BD8D6A#D86D8cK|jj|jj|jj	d{y7wr()r^rjr>r5wait_closedres r
asyncTearDownzTestSendfile.asyncTearDown
s:		kk%%'''sAAAAclKtjtjg|i|d{S7wr()r)	to_threadrr&)rrs  rasync_sendfilezTestSendfile.async_sendfile
s+&&r{{DTDVDDDDs+424cK		tj|i|d{S7#t$rU}|jtjk(r|jtj
tjfvrYd}~yd}~wwxYww)zfA higher level wrapper representing how an application is
        supposed to use sendfile().
        N)r(rJrJrK
ECONNRESETEAGAINEBUSY)rrrs   rsendfile_wrapperzTestSendfile.sendfile_wrapper
so


)88$I&IIII
99 0 00YY5<<"==
s=B$"$B$	BA
A=7B<A==BBc Kd}d}d}|t|jkr|j|j|j||d{}|dk(rnI||z
}||z
}|j||k|j
|||t|jkr|j
|t|j|jjtj|jj|jjd{|j
t|jt|j|j
|j|jy7=7fw)Nr)r?r-rOrBrrkrCr>shutdownr=	SHUT_RDWRrjr5rFr4)r4
total_sentoffsetnbytessents     rtest_send_whole_filez!TestSendfile.test_send_whole_file
s:
3tyy>)..t{{DKK/5v??DqydNF$JOODFN+VZ03tyy>)	
S^4V--.kk%%'''T//0#dii.A++TYY7?	(s-A
FF	
AF BF%F&A$FFcKd}t|jdz}t|j|z
}d}||krZ|j|j|j||d{}|dk(rn$||z
}||z
}|j||k||krZ|jjtj|jj|jjd{|jt|jdzd}|j|t||jt|jt||j|j|y77w)NrrtrQ)r?r-rOrBrrkr>rRr=rSrjr5rFrCr4)r4rTrU	must_sendrVrWrSs       rtest_send_at_certain_offsetz(TestSendfile.test_send_at_certain_offset
sK
TYY1$		NV+	9$..t{{DKK/5v??DqydNF$JOODFN+9$	
V--.kk%%'''99S^q012S]3T//0#h-@++X6?	(s,A%F'F(-FA F6F	7BF	Fc4Kt|jdz}	|j|j|j|dd{}|j|d|jjtj|jj|jjd{|j|j dy7#t$r(}|jtjk7rYd}~d}~wwxYw7Ww)NrQrr)r?r-rJrBrrCrJrKEINVALr>rRr=rSrjr5rFr4)r4rUrWrs    rtest_offset_overflowz!TestSendfile.test_offset_overflow
sTYY$&	&,,T[[$++-3T;;D
T1%V--.kk%%'''++S1;	ww%,,&'		(sMD+C"C C"A2D>D?!D C""	D+D	DDDc,K|jt5}|j|j|jddd{ddd|jjjtjy7A#1swY@xYww)NrrQ)	ryrJrJrBrrCrwrKr]r4rls  rtest_invalid_offsetz TestSendfile.test_invalid_offset
su


w
'	J2%%dkk4;;DIII	J++U\\:
J	J	Js.B,BBB	=BBB
Bc	K|j|j|jddd{|jr5|j|j|jdddddd{yy7F7w)NrrQ)rrrUrr+)rrrUrheaderstrailersr)rJrBrSUPPORT_HEADERS_TRAILERSres r
test_keywordszTestSendfile.test_keywords
s!!DKK)*$"8	8	8((%%T[[-.d.02Q&H
H
H)	8
Hs!-A:A6?A:/A80A:8A:cKd}d|jddz}|j|j|jddddgd{}|j	|d||z
}d}|t|kryt
t||z
d}|j|j|j||d{}|dk(rn+|j	||||z
}||z
}|t|kry|j|t||jj|jjd{|jt|jt|y7+778w)	NrsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyrrQsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyrci)r-rJrBrassertLessEqualr?minrOrCr>rjr5rFhashr4)r4rT
expected_datarWrUrVs      rtest_headerszTestSendfile.test_headerssg
/$))CR.@
((dkk1d2<j1I)KKT#34d
3}--]+j8$?F..t{{DKK/5v??Dqy  v.$JdNF3}--	
S%78kk%%'''d0014
3FG%K?	(s>AE8E1A.E85E464E8+AE8=E6>4E84E86E8c	Ktjdz}d}|jtj|t	||t|d5}|j
|j|jddddgd{|jj|jjd{|j|jd	dddy7e7+#1swYyxYww)
Nrsabcdefrrrs123456s789rdsabcde123456789)rrcrrdr%r rJrBrr>rjr5rFrCr4)r4r	file_dataros    r
test_trailerszTestSendfile.test_trailerss""S(		(('2GY'
'4
 	DA%%dkk188:q!096/B&D
D
DKK++))+++T//1BC	D	D
D
,		D	DsBAC:4C.C*;C.C, C.!	C:*C.,C..C73C:c	tKd|jj_|jt5}|j|j|jddddzgdzd{ddd|jjjtjy7A#1swY@xYww)NFrxrarhr5handler_instance
accumulateryrJrJrBrrCrwrKr]r`s  rtest_headers_overflow_32bitsz)TestSendfile.test_headers_overflow_32bits*s38$$/


w
'	F2%%dkk4;;1/3e|nu.D&F
F
F	F	
++U\\:
F	F	F.1B85B,(B*)B,-=B8*B,,B51B8c	tKd|jj_|jt5}|j|j|jddddzgdzd{ddd|jjjtjy7A#1swY@xYww)NFrrsrtrarorur`s  rtest_trailers_overflow_32bitsz*TestSendfile.test_trailers_overflow_32bits3s38$$/


w
'	G2%%dkk4;;104u~/E&G
G
G	G	
++U\\:
G	G	GrySF_NODISKIOztest needs os.SF_NODISKIOcK	|j|j|jddtjd{y7#t
$r7}|jtjtjfvrYd}~yd}~wwxYww)NrrQ)r)	rJrBrrr|rJrKrNrM)r4rs  r
test_flagszTestSendfile.test_flags<so	%%dkk4;;4,.NN&<
<
<	yyell ;;<	s?B
;AAAB
A	B-B=B
BB
N)#r\r]r^r-r=r>rrerrrequires_headers_trailersmaxsizerequires_32br{r\rzrr2r7rDrGrJrOrXr[r^rarfrmrqrxr{rrr~r+rrr(r(o
s$D#&<<#:#:7#CC D#&<<#:#:9#EE D#&<<#:#:7#CC!4 3 34L3!5&8&&s{{U':68L00++&&

)(EE"8,7.2";
HHH.DD;;;;X]3466rr(cttdsy	ttjdd5}	tj
|j
dd	dddtjtjy#t$r.YdddtjtjywxYw#1swYgxYw#tjtjwxYw)NsetxattrFrr	user.testrT)	rrr rrcrrrJrd)r$s rsupports_extended_attributesrHs2z"+
)""D!
,	
BIIKs;		))*
			))*
			))*sECB<%BC	B9B<C8B99B<<CC%C-z(no non-broken extended attribute supportrtr'c*eZdZdZdZdZdZdZy)ExtendedAttributeTestscbtj}|jtj|t	||jt5}|||dfi|ddd|jjjtj||}	|j|	t|||ddfi|t|	}
|
jd|jt|||
|j||dfi|d|||ddtj fi||j||dfi|d|jt5}|||ddtj"fi|ddd|j|jjtj$|jt5}|||ddtj fi|ddd|j|jjtj|||ddtj"fi||
jd|jt|||
|||dfi||jt5}|||dfi|ddd|j|jjtj|
j'd|jt|||
|j|||dfi|d|||ddfi||j|||dfi|d|||dfi|t)d	t+d
D}|D]
}|||dfi||jt||t|	t|zy#1swYxYw#1swYxxYw#1swYxYw#1swY\xYw)N	user.testrrrsbyez
user.test2sfoosaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac3>K|]}dj|yw)zuser.test{}N)r)r.rs  rr/z;ExtendedAttributeTests._check_xattrs_str.<locals>.<genexpr>sB!m**1-Bsrrs)rrcrrdr%ryrJrCrwrKENODATAr1rrrr
XATTR_REPLACEXATTR_CREATEEEXISTrrr)
r4rgetxattrrremovexattr	listxattrrrrl
init_xattrxattrmanythings
             r_check_xattrs_strz(ExtendedAttributeTests._check_xattrs_str^s


	(("-B


w
'	32R;262	3++U]];r]
j$/Q{^S3F3J
		+Yr]+U3"l=f=sCQ{^Xr/?/?J6J"l=f=xH


w
'	L2R;KFK	L++U\\:


w
'	N2R<&"2B2BMfM	N++U]];Q|_fbooHH
		,Yr]+U3B+1&1


w
'	32R;262	3++U]];
[!Yr]+U3"ao@@&IQ{^Y9&9"an??KB+1&1BuSzBB	0ER//	0Yr]+S_s4y-HIS	3	3	L	L	N	N	3	3s0O=3!P
%!P9P$=P
PP!$P.c|jtg|i|tjtj|jt
jg|i|tjtjyr()rr2rrdrcrr(rs   r
_check_xattrsz$ExtendedAttributeTests._check_xattrssbs4T4V4))*r{{<T<V<))*rc|jtjtjtjtj
yr(rrrrrrres rtest_simplez"ExtendedAttributeTests.test_simples)2;;R^^<<	)rc|jtjtjtjtj
dy)NFrrres r
test_lpathz!ExtendedAttributeTests.test_lpaths12;;R^^<<		@rcDd}d}d}d}|j||||y)Nct|d5}tj|jg|cdddS#1swYyxYwr)r rrrrDrr$s   rrz1ExtendedAttributeTests.test_fds.<locals>.getxattrs:dD!
7R{{299;66
7
7
7	$;Act|dd5}tj|jg|dddy#1swYyxYwNrr)r rrrrs   rrz1ExtendedAttributeTests.test_fds.<locals>.setxattrs<dD!$
0BIIK/$/
0
0
0	%<Act|dd5}tj|jg|dddy#1swYyxYwr)r rrrrs   rrz4ExtendedAttributeTests.test_fds.<locals>.removexattrs<dD!$
3ryy{2T2
3
3
3rct|d5}tj|jg|cdddS#1swYyxYwr)r rrrrs   rrz2ExtendedAttributeTests.test_fds.<locals>.listxattrs:dD!
8R||BIIK7$7
8
8
8r)r)r4rrrrs     rtest_fdszExtendedAttributeTests.test_fdss,	7	0	3	8	
8X{IFrN)r\r]r^rrrrrr+rrrrXs.J`+)@
Grrget_terminal_sizezrequires os.get_terminal_sizecdeZdZdZdZejejdk(ddZ	y)
TermsizeTestscb	tj}|j|jd|j|jdy#t$rV}tjdk(s,|j
t
jt
jfvr|jdd}~wwxYw)zCheck if get_terminal_size() returns a meaningful value.

        There's no easy portable way to actually check the size of the
        terminal, so let's check if it returns something sensible instead.
        rfailed to query terminal sizeNr)rrrJr=r>rKr]ENOTTYrwassertGreaterEqualcolumnsr)r4rrs   rtest_does_not_crashz!TermsizeTests.test_does_not_crashs	'')D	
a0

A.	||w&!''ellELL5Q*Q

=>	sA	B.AB))B.c`	tjddgtjdj}tdt|df}	tjtjj}|j'||y
#ttj
tf$r|jdYwxYw#t$rV}tjdk(s,|j t j"t j$fvr|jd	d
}~wwxYw)zCheck if stty returns the same results

        stty actually tests stdin, so get_terminal_size is invoked on
        stdin explicitly. If stty succeeded, then get_terminal_size()
        should work too.
        sttyrT)rrVzstty invocation failedrrrrrN)rrDEVNULLr6rICalledProcessErrorrrwrrrr=	__stdin__rrJr>rKr]rrC)r4rrSrrs     rtest_stty_matchzTermsizeTests.test_stty_matchs	4''V$Z-?-?d%'
QL#d1g,/	))#--*>*>*@AF	
6*":#@#@!	4MM23	4	||w&!''ellELL5Q*Q

=>	s*6B1C/C
C	D-AD((D-rzWindows specific testcB	tdd}5tj|j}ddd|j
jd|j
|jdy#t$r|jdYwxYw#1swYbxYw)zBCheck if get_terminal_size() returns a meaningful value in Windowszconout$ryzfailed to open conout$Nr)	r rJrwrrrrrr)r4conoutrs   rtest_windows_fdzTermsizeTests.test_windows_fds	4)S)F	9''

8D	9	
a0

A.
	4MM23	4	9	9sA5$B5BBBN)
r\r]r^rrrrr=r>rr+rrrrs:/$+8X02IJ
/K
/rrmemfd_createzrequires os.memfd_createrrceZdZdZy)MemfdCreateTestscRtjdtj}|j|d|j	tj
||j
tj|t|dd5}|jd|j|jddddtjd}|j	tj
||j
tj|y#1swYcxYw)NHirrF)closefdsmemfd_creater-)rrMFD_CLOEXECrrrjrrNr r!rCtell)r4rror+s    rtest_memfd_createz"MemfdCreateTests.test_memfd_creates
__T2>>
2B#"%++B/0
"dE
*	+a
GGO$QVVXr*	+ood##&++C01
	+	+s	2DD&N)r\r]r^rr+rrrrs2rreventfdzrequires os.eventfdrceZdZdZdZdZy)EventfdTestscJd}d}d}tj|}|j|d|jtj||jtj|tj||}|j|||tj||dtj||}|j||dtj||dtj||dtj||}|j||dtj|dtj|d	tj|}|j|dy)
Nc.tjd|S)z$Pack as native uint64_t
            z@Q)structpack)rls rrz/EventfdTests.test_eventfd_initval.<locals>.packs;;tU++rr*rrr(rtr(r)rrrrrjrrNrrCr!
eventfd_writeeventfd_read)r4rrinitvalrress      rtest_eventfd_initvalz!EventfdTests.test_eventfd_initvals@	,
ZZ
 B#"%++B/0ggb$d7m,
T"Xggb$d2h'
T"X
T!Wggb$d2h'	R 
Qoob!b!rcd}tjtjztjz}tj||}|j|d|j
tj|tj|}|j|dtj|}|j|d|jt5tj|ddd|jt5tj|ddddtj|dtj|}|j|d|jt5tj|dddy#1swYxYw#1swYxYw#1swYyxYw)Nrtrrrr*)rEFD_CLOEXEC
EFD_SEMAPHOREEFD_NONBLOCKrrrrjrrCryrrr)r4rrrrs     rtest_eventfd_semaphorez#EventfdTests.test_eventfd_semaphoresW!1!11BOOC
ZZ
'B#"%oob!a oob!a 



/	 OOB	 



/	GGBN		Qoob!a 



/	 OOB	 	 	 	 			 	 s$ F#F/F;#F,/F8;Gctjtjz}tjd|}|j	|d|jtj|tj|g|g|gd\}}}|j|||fg|ggftj|dtj|g|g|gd\}}}|j|||f|g|ggf|jtj|dtj|dtj|g|g|gd\}}}|j|||f|gggftj|y)Nrrrl)rrrrrrrjselectrCrr)r4rrrfdwfdxfds      rtest_eventfd_selectz EventfdTests.test_eventfd_select8sN0
ZZ5
!B#"%

rdRD2$:
S##sC2tR.9	R 

rdRD2$:
S##sCB4"r*:;,b1	[)

rdRD2$:
S##sCB4R.9
rN)r\r]r^rrrr+rrrrs"> 4rrceZdZdZdZy)OSErrorTestscGddt}g|_g|_tjtj}ntj
}|jj
||jj
||tjtj}n#tjtj
}|jj
||j|jz|_
y)NceZdZy)OSErrorTests.setUp.<locals>.StrNr\r]r^r+rrStrrQrr)r2bytes_filenamesunicode_filenamesrrrcrTESTFN_UNDECODABLErr(r)r4rdecodedencodeds    rrfzOSErrorTests.setUpPs	#	 "!#''322G&&G%%g.%%c'l3''322Gkk)"2"23G##G,--0F0FFrc|jtjf|jtjf|jtjtj
f|jtjf|jtjf|jtjf|jtjf|jtjdf|jtjdfg	}tjr,|j|jtjdft!tdr-|j|jtj"ddft!tdr-|j|jtj$ddft!tdr,|j|jtj&dft!tdr,|j|jtj(dft!tdr,|j|jtj*dft!td	r+|j|jtj,ft!td
r,|j|jtj.dft!tdr|j1|jtj2f|jtj4df|jtj6dd
f|jtj8dfft!tdr,|j|jtj:dft!tdr+|j|jtj<f|D]*^}}}|D] }	||g||j?d|",y#t@$r0}|jC|jD|tG|Yd}~Zd}~wtH$rYhwxYw)Nrrrfrlchownr<chflagslchflagschrootrrrsuserlchmodrzNo exception thrown by )%rrrHrNr rrrrdrrrr	can_chmodrrrrfrr<rrrrrrrrrrrr;rJrir"r2UnicodeDecodeError)r4funcsrfunc	func_argsrrs       rtest_oserror_filenamez"OSErrorTests.test_oserror_filenameds	
^^RXX'
^^RXX'
^^RWWbkk2
^^RXX'
^^RWW&
^^RYY(
^^RZZ)
^^RYY.
^^RZZ/

 LL$.."((E:;2wLL$.."((Aq9:2x LL$.."))Q:;2z"LL$.."++q9:2y!LL$.."**a892z"LL$.."++q9:2x LL$.."))562vLL$.."''59:2{#LL/k:k7C=	
2x LL$.."))U;<2z"LL$.."++78+0		@'Iti!
@@*	*II 7v>?
@		@AMM#,,c$i@@)s	P$$	Q'-&QQ'&Q'N)r\r]r^rfrr+rrrrOsG(1@rrceZdZdZy)
CPUCountTestsctj}|)|j|t|j	|dy|jdy)Nrz&Could not determine the number of CPUs)r	cpu_countr1r
assertGreaterrw)r4cpuss  rtest_cpu_countzCPUCountTests.test_cpu_counts@||~!!$,tQ'MMBCrN)r\r]r^rr+rrrrsDrrceZdZdZej
eduddZej
eduddZeje
edddZd	Z
d
Zeje
eddd
ZdZdZejej&dk(ddZeje
edddZeje
edddZy)FDInheritanceTestscTtjttj}|j	tj
||j
tj|dtj|d|j
tj|dyNFT)	rr rrrrjrCrNrOrs  rtest_get_set_inheritablez+FDInheritanceTests.test_get_set_inheritablesn
WWXr{{
+"%++B/7
2t$++B/6rNz
need fcntlctjttj}|j	tj
||j
tj|dtj|tj}|tjz}tj|tj||j
tj|dyr)rr rrrrjrCrNfcntlF_GETFD
FD_CLOEXECF_SETFD)r4rrs   rtest_get_inheritable_cloexecz/FDInheritanceTests.test_get_inheritable_cloexecs
WWXr{{
+"%++B/7B

.
%""""
B

u-++B/6rctjttj}|j	tj
||j
tj|tjtjztjtj|d|j
tj|tjtjzdy)NTr)rr rrrrjrCrrrrOrs  rtest_set_inheritable_cloexecz/FDInheritanceTests.test_set_inheritable_cloexecs
WWXr{{
+"%R7%:J:JJ))	+	2t$R7%:J:JJ	rO_PATHzneed os.O_PATHctjttj}|j	tj
||j
tj|dtj|d|j
tj|dtj|d|j
tj|dyr)	rr rr	rrjrCrNrOrs  rtest_get_set_inheritable_o_pathz2FDInheritanceTests.test_get_set_inheritable_o_paths
WWXryy
)"%++B/7
2t$++B/6
2u%++B/7rctj}|jt5}t	j
|ddd|j
jjtj|jt5}t	j|dddd|j
|jjtj|jt5}t	j|dddd|j
|jjtjy#1swYxYw#1swYxYw#1swYWxYwNTF)rrryrJrrNrCrwrKrxrO)r4rrzs   rtest_get_set_inheritable_badfz0FDInheritanceTests.test_get_set_inheritable_badfs

"
"
$


w
'	#3r"	#,,ekk:


w
'	)3r4(	),,ekk:


w
'	*3r5)	*,,ekk:	#	#	)	)	*	*s#E
E9E&
EE#&E/ctjttj}|j	tj
||j
tj|dyr#)rr rrrrjrCrNrs  rrzFDInheritanceTests.test_opensC
WWXr{{
+"%++B/7rrzneed os.pipe()cFtj\}}|jtj||jtj||j	tj
|d|j	tj
|dyr#)rrrrjrCrN)r4rrs   r	test_pipezFDInheritanceTests.test_pipesk779S#&#&++C0%8++C0%8rcHtjttj}|j	tj
|tj|}|j	tj
||jtj|dyr#)	rr rrrrjrvrCrNr4fd1r+s   rtest_dupzFDInheritanceTests.test_dupsbggh,#&ffSk#&++C0%8rctjd}|jtj||j	|dyNrrr)rrvrrjrrs  rtest_dup_standard_streamz+FDInheritanceTests.test_dup_standard_streams1
VVAY"%2q!rrrc>tjdtj}|jtj|tj
|}|jtj||j
tj|y)NNUL)rr rrrjrvrrNrs   rtest_dup_nulzFDInheritanceTests.test_dup_nulsbggeR[[)#&ffSk#&++C01rr&zneed os.dup2()ctjttj}|j	tj
|tjttj}|j	tj
||j
tj||||jtj|tjttj}|j	tj
||j
tj||d||jtj|y)NF)inheritable)rr rrrrjrCr&rkrNr)r4rr+fd3s    rr)zFDInheritanceTests.test_dup2s
WWXr{{
+"%ggh,#&S)3/**3/0ggh,#&Se<cB++C01ropenptyzneed os.openpty()cFtj\}}|jtj||jtj||j	tj
|d|j	tj
|dyr#)rrrrjrCrN)r4	master_fdslave_fds   rtest_openptyzFDInheritanceTests.test_openptysl jjl	8),(+++I6>++H5u=r)r\r]r^rrrrrrrrrrrrrrrr=r>rr)r#r+rrrrsC7X__Ud]L1
72
7X__Ud]L12XX.0@A	8B	8
;8
XV,.>?9@99"
X02GH2I2XV,.>?2@2 XY/1DE>F>rrc
teZdZddddejfdfddddej
feed	dfgZd
ZdZ	y)PathTConverterTests)rTr+N)rNFr+NrlFN)rFrN)rFr&Nr rjc	Ntj}tjdk(rdx}}n.tjtj}t|}tjt|tjtjz}|jtjtj|jtj|t|}t|}|jD]\}}}	}
|j|5	tt|}||||fD]4}||j||5||g|	}
|
|
|
ddd6|j!t"d5||g|	ddd|r||g|	}
|
1|
|
n(|j!t"d5||g|	ddddddy#t$rYdddwxYw#1swYxYw#1swYuxYw#1swYCxYw#1swYxYw)Nr>r)rrDzto return str or byteszos.PathLike)rrcrrr(rr rrhrrdrj	functionsrRr5r:assertRaisesRegexr)r4str_filenamebytes_fspathbytes_filenamer
int_fspath
str_fspathrallow_fd
extra_args
cleanup_fnrrDrAs              rtest_path_t_converterz)PathTConverterTests.test_path_t_converter(s ''
77d?,00L>[[)9)9:N#N3L
WWXl+R[[-C
D	(()*:*:;"%b\
l+
6:nn	,2D(J
4(
, T*B*>:)+/D| 4d;/!#D!6:!6%1&v.//	/++!#;=0z/J/00Z0F!-"6*//%)+,2+
+,1
,
,	,&	
,
,//
00,,1
,
,sxH!G1HG6	$ H
H4H
HH	G3(H2G33H6G?
;HHHHHH$	cd}|jt|dz5tjt	dddd|jt|dz5tjt	dddd|jt|dz5tjt	tdddy#1swYxYw#1swY^xYw#1swYyxYw)Nz-__fspath__\(\) to return str or bytes, not %srrtfloatgQ@object)r)rrrrr5)r4rs  r&test_path_t_converter_and_custom_classz:PathTConverterTests.test_path_t_converter_and_custom_classTs>

#
#IsV|
<	!GGHQK 	!

#
#IsX~
>	$GGHTN#	$

#
#IsY
?	(GGHVX&'	(	(		!	!	$	$	(	(s#CC'C$CC!$C-)
r\r]r^rF_OKrr5r(r2r6r+rrr%r%sO	!"	5277*d+&'	GT(BC
I*,X(rr%rQrRzCannot unset blocking flagz'Windows only supports blocking on pipesceZdZdZy)
BlockingTestsctjttj}|j	tj
||j
tj|dtj|d|j
tj|dtj|d|j
tj|dyr
)	rr rrrrjrCrQrTrs  rrUzBlockingTests.test_blockingcs
WWXr{{
+"%,d3
E",e4
D!,d3rN)r\r]r^rUr+rrr9r9^s
	4rr9ceZdZdZy)ExportsTestsc|jdtj|jdtjy)Nr r)rr__all__res rtest_os_allzExportsTests.test_os_allqs&

fbjj)

fbjj)rN)r\r]r^r?r+rrr<r<ps*rr<ceZdZdZdZdZy)TestDirEntryctjjtj|_|jtj|jtj|jyr()rrDrealpathrrcrrrGres rrfzTestDirEntry.setUpwsFGG$$Y%5%56		(($))4
rcL|jttjyr()ryrrDirEntryres rtest_uninstantiablez TestDirEntry.test_uninstantiable|s)R[[1rcttjj|jdd}tj|jDcgc]}|c}j}|j
|tj|j|jdddl
}|jt|j||ycc}w)Nrpythonr)r%rrDrFscandirrXr1rErCrrPryrrS)r4r"entryrPs    rtest_unpickablezTestDirEntry.test_unpickablesrww||DIIzBIN$&JJtyy$9:5:>>@eR[[1Z0)V\\5(C	;s	CN)r\r]r^rfrFrKr+rrrArAvs
2DrrAceZdZejZdZd#dZdZdZdZ	dZ
dZdZe
jej d	k7d
dZdZd#d
ZdZdZdZdZdZdZdZdZdZe
j:ej>ej@vddZ!e
je"jFddZ$dZ%dZ&dZ'dZ(dZ)d Z*d!Z+y")$TestScandircBtjjtj|_tj
|j|_|jtj|jtj|jyr()
rrDrCrrcr(
bytes_pathrrrGres rrfzTestScandir.setUpsZGG$$Y%5%56	++dii0	(($))4
rct|tr|jn|j}tjj||}t
|d|S)NrH)rirYrOrDrrFr%)r4rrDr"s    rr%zTestScandir.create_files=",T5"9ttyy77<<d+Hi(rctdtj|jD}|j	t|j
||S)Nc38K|]}|j|fywr(rr.rJs  rr/z*TestScandir.get_entries.<locals>.<genexpr>s!; 

E*;)rrrIrDrCrkeys)r4namesentriess   rget_entrieszTestScandir.get_entriessF;$&JJtyy$9;;/7rc|rRt|D]C}|jds|dvr|jt||t|||||fEy|j||y)Nst_)st_devst_inost_nlinkrst_ctime_ns)r2rrCr5)r4stat1stat2skip_fieldsrCs     rassert_stat_equalzTestScandir.assert_stat_equalstE

7u-++  !5!(!5"'!57

7
UE*rctj|j}|jtt||j
yr()rrIrDryrrrj)r4scandir_iters  rrFzTestScandir.test_uninstantiables5zz$)),)T,%78rc|jd}tj|j}ddl}|jt|j|||jy)Nrr)	r%rrIrDrPryrrSrj)r4r"rdrPs    rrKzTestScandir.test_unpickablesK##J/zz$)),)V\\<Jrc|j|tj|j|j||j|j
tj
j
|j
||j|jtj|j
djtj|j
}|j|jtj|j|j|jtj|j|j|jtj
j!|j
tj|j
d}|j|jdtj|j|j|jdtj|j|j|j#tj
j%|j
|j'|j|tjdk(xr||j'|jd|tjdk(y)NFrr>)r1rrErCrrDrFinoderr\is_dirS_ISDIRr=is_fileS_ISREG
is_symlinkr6is_junction
isjunctionrb)r4rJrrhrjrl
entry_statentry_lstats        rcheck_entryzTestScandir.check_entryseR[[1T*RWW\\$))T%BCUCJJ	LWWUZZ(
j&8&89	;j&8&89	;))+

3	5ggejj%@e<k&9&9:	<u=k&9&9:	<	
**,bgg.@.@.LMuzz|)!ww$Az>	C	
uzz%z@*!ww$	0rcHttd}tj}tjj|jd}tj||jd}|r?	tj|tjj|jd|r~tj|tjj|jddtj|tjj|jd	ddg}|r|jd|r|jd
|j|}|d}|j|dddd|d}|j|dddd|r|d}|j|dddd|r5|d}|j|dddd|d	}|j|d	dddyy#t$r}|jd|zYd}~fd}~wwxYw)Nrr2rz
link_file.txtr`symlink_dirT)rsymlink_file.txt)rsrtF)rrrrrDrFrGr%rrrwrrrrXrq)	r4rrrQr"rrVrWrJs	         rtest_attributeszTestScandir.test_attributessr6"'')'',,tyy%0
##J/
3"'',,tyy/"JKJJwTYY
 F+/
1JJxdii9K!LM
#LL)LL<=""5)tUE:
#
E4?O,EUOUD%HM*EUM4E./EU$6tTJ1#
3

o122
3s8>G99	H!HH!rz/Can only test junctions with creation on win32.ctjj|jd}tj|ddl}	|j
|tjj|jd|jddg}|j|djd|j|djdy#t$rtjdwxYw)Ntgtdirrsrcjuncz!creating the test junction failedTF)rrDrFrGrlrmrJrrOrXrCrm)r4rQrlrWs    rtest_attributes_junctionsz%TestScandir.test_attributes_junctionss'',,tyy(3
	I"G""7BGGLLI,NO""Ix#89+7794@*668%@	I##$GHH	Is;CC9c
t|tr|jn|j}t	tj|}|jt|d|d}|j|j||Sr)
rirYrOrDrrrIrCr?r)r4rrDrWrJs     r	get_entryzTestScandir.get_entry
sc",T5"9ttyyrzz$'(Wq)
T*rc|j|}|jtjj	|S)Nr)r%r{rrDbasename)r4rr"s   rcreate_file_entryzTestScandir.create_file_entrys3###.~~bgg..x899rc|j}tj}	tj|jtdtjD}|jt|jtjj|gtj|y#tj|wxYw)Nc38K|]}|j|fywr(rrSs  rr/z5TestScandir.test_current_directory.<locals>.<genexpr>"sI5EJJ.IrT)r%rr0rHrDrrIrCrrUr})r4r"old_dirrWs    rtest_current_directoryz"TestScandir.test_current_directorys##%))+		HHTYYIBJJLIIGVGLLN3 gg..x89
;
HHWBHHWsB
CCcZ|j}|jt|dy)Nz<DirEntry 'file.txt'>)r~rCr0r4rJs  r	test_reprzTestScandir.test_repr(s%&&(e&=>rc|j}|jtj|tjj|jdyNr)r~rCrfspathrDrFrs  rtest_fspath_protocolz TestScandir.test_fspath_protocol,s<&&(5)277<<		:+NOrcBtjd}|j|}tj|}|j	|t
|j
|tjjtj|j|y)Nz
bytesfile.txtr)	rr(r~rr1rYrCrDrF)r4r,bytes_entryrs    rtest_fspath_protocol_bytesz&TestScandir.test_fspath_protocol_bytes0sq_5,,.,A;'fe,bkk$))&<^L	Nrctjj|jd}tj||j	d}tj
|tjdk(r|j|j|j|j|j|jtjdk(rC|jt|j|j|jdy|j!|jd|jt|j|jt|jdy)Nr2r>Frr)rrDrFrGr{rrrkrhrrjrlryrIrgrr)r4rDrJs   rtest_removed_dirzTestScandir.test_removed_dir8sww||DIIu-
u%
77d?OOELLN+)))+,
77d?/=JJLJJuJ-u{{}a0/</USrc|j}tj|j|j	|jtjdk(r|j|j|j	|jtjdk(rC|jt|j|j|jdy|j|jd|jt|j|jt|jdy)Nr>Frr)r~rrdrDrrhrrkrjrlryrIrgrrrs  rtest_removed_filezTestScandir.test_removed_fileNs&&(
		%**(
77d?OOEMMO,))+,
77d?/=JJLJJuJ-u{{}a0/</USrc(tjs|jdS|jd}t	j
|tjj|jd|jddg}|d}t	j||j|jd|j|j|j|j|j|jd|j|jd|j|j!|j#t$|j&|j'dy)Nzcannot create symbolic linkrzsymlink.txtrFr)rrrwr%rrrDrFrXrdrrgrrhrjrkrlryrIr)r4r"rWrJs    rtest_broken_symlinkzTestScandir.test_broken_symlinkas%$$&==!>??##J/


877<<		=9	;""J
#>?
&
		(5;;=!,()e<=u=>((*++UZZ8

5
)rc	|jdtj|j}t	tj
|}|j
t|d||d}|j
|jd|j
|jtjtjj|jdy)Nrrrrsfile.txt)
r%rr(rDrrIrCr?rrF)r4
path_bytesrWrJs    rr*zTestScandir.test_bytesvs$[[+
rzz*-.Wq'2
[1RWW\\$))Z%HI	Krc|jdttfD]Z}|tj|j
}|j
t5tj|ddd\y#1swYgxYwr)	r%rrrr(rDryrrI)r4r[rs   rtest_bytes_likezTestScandir.test_bytes_likeso$j(	'CR[[34J""9-
'

:&
'
'	'
'
'sA<<B	z.fd support for listdir required for this test.cB|jtjtj|j	ddg}tjrOtjdtjj|jd|jdtj|j5}tj|5}t|}dddDcgc]}|j}}|jt|||j|tj ||D]+}|j|j|j|jtj"||j|j|j%|jdk(tj&tj(vstj&|j|}|j|j'|tj&|j|d}|j|j'd|.	dddy#1swYxYwcc}w#1swYyxYw)NrrrF)rrr)rrrIrr%rrrrDrFrrrrrCrrrrlrr)r4expected_namesrr$rWrJrVrs        rtest_fdzTestScandir.test_fds	


bjj"..1$$  "JJz277<<		6#BC!!&)

"
"499
-	LB
#2r(
#-45EUZZ5E5VE]N;UBJJrN3 
L  UZZ8  5!15::>  !1!1!3UZZ65IJ77b000B7B$$UZZ\26BNB$$UZZZ%FK
L
	L	L
#
#5	L	Ls8JJ'J3JC*J1BJJ
	
JJzWASI maps '' to cwdcN|jttjdyr)ryrIrrIres rtest_empty_pathzTestScandir.test_empty_paths+RZZ<rc|jdtj|j}t	|}|jt
|d|t	|}|jt
|d|y)Nrrrr)r%rrIrDrrCr?)r4rrrWentries2s    rtest_consume_iterator_twicez'TestScandir.test_consume_iterator_twicesb$::dii(x.Wq'2>X84rcbdigfD]'}|jttj|)y)NgX9v?)ryrrrI)r4objs  rtest_bad_path_typezTestScandir.test_bad_path_types-2r?	:CiS9	:rc(|jd|jdtj|j}t	||j|j|j
5~dddy#1swYyxYwNr	file2.txt)r%rrIrDr"rjcheck_no_resource_warningr4rrs  r
test_closezTestScandir.test_closeso$%::dii(X

+
+
-				s=BBc|jd|jdtj|j5}t	|ddd|j5~dddy#1swY$xYw#1swYyxYwr)r%rrIrDr"rrs  rtest_context_managerz TestScandir.test_context_managersu$%
ZZ		
"	hN	

+
+
-							sA1&A=1A:=Bc|jd|jdtj|j5}t	||jdddy#1swYyxYwr)r%rrIrDr"rjrs  rtest_context_manager_closez&TestScandir.test_context_manager_closesV$%
ZZ		
"	hNNN			sA''A0cp|jd|jd|jt5tj|j
5}t
|ddzdddddd|j5~dddy#1swY,xYw#1swY0xYw#1swYyxYw)Nrrrrr)r%ryZeroDivisionErrorrrIrDr"rrs  rtest_context_manager_exceptionz*TestScandir.test_context_manager_exceptions$%


0
1	DII&
(X!
	
+
+
-			

				s/ B B)B 	B,B	B  B),B5c|jd|jdtj|j}t	||jt5~tjdddtj|j}t||j5~dddy#1swYNxYw#1swYyxYwr)r%rrIrDr"assertWarnsResourceWarningr
gc_collectrrrs  rtest_resource_warningz!TestScandir.test_resource_warnings$%::dii(X


o
.	! 	!::dii(X

+
+
-			
	!	!		s"C:CCCN)r),r\r]r^rrrfr%rXrbrFrKrqrurrr=r>ryr{r~rrrrrrrr*rrrrrrrrrrrrrrrrr+rrrMrMs" / I I+
0<'KRX__S\\W,._`AaA:?PNT,T&**
K'Xr~~5IKLKL0X__W__&;<===	5:	rrMcfeZdZeej
ZdZdZdZdZ	dZ
dZdZdZ
d	Zy
)
TestPEP519cTdD]#}|j||j|%y)N)rsgoodbyessome/path/and/filerCr)r4bs  rtest_return_byteszTestPEP519.test_return_bytess)<	0AQA/	0rcTdD]#}|j||j|%y)N)hellogoodbyezsome/path/and/filer)r4rs  rtest_return_stringzTestPEP519.test_return_strings)9	0AQA/	0rcdD]x}t|}|j||j||jdtj||jdtj
|zy)N)path/like/objectpath/like/objectrr)rrCrrr(rZ)r4rWpathlikes   rtest_fsencode_fsdecodez!TestPEP519.test_fsencode_fsdecodesi8	HA{HQH 560"++h2GH/X1FG	Hrc|jd|jtd|jt	tt
j|jttdt
jy)Nz#feelthegilr )rCrrrk
issubclassrPathLikerires rr&zTestPEP519.test_pathlikesRH]4K(LM
8R[[9:
8C="++>?rctddi}ttt|fD]#}|jt|j
|%y)Nblahr+)rrrryrr)r4vaporos   rtest_garbage_in_exception_outz(TestPEP519.test_garbage_in_exception_outs@VR$dB'	9Aia8	9rcD|jt|jyr()ryrrres rtest_argument_requiredz!TestPEP519.test_argument_required
s)T[[1rc0|jt|jtdt	ddi}d|_|jt|j||jt|jtt
y)Nrfoor+rr)ryrrrr
__fspath__r)r4cs  rtest_bad_pathlikezTestPEP519.test_bad_pathlike
sl)T[[(2,?B)T[[!#6+T[["#4#67	9rcGddtj}|jtt||jtttjy)NceZdZy)0TestPEP519.test_pathlike_subclasshook.<locals>.ANrr+rrArrrr)rrrrrrk)r4rs  rtest_pathlike_subclasshookz%TestPEP519.test_pathlike_subclasshooks>		Ha01
8R[[9:rcn|jtjttj
yr()r1rrrYtypesGenericAliasres rtest_pathlike_class_getitemz&TestPEP519.test_pathlike_class_getitem s!bkk%0%2D2DErN)r\r]r^rrrrrrr&rrrrrr+rrrrsB"))
$F00H@
9
2	9;FrrceZdZdZy)
TimesTestsctj}|j|tjdD]$}t	||}|j|t
&tjdk(rU|j|jd|j|jd|j|jdyy)N)usersystem
children_userchildren_systemelapsedr>r)rrr1times_resultr5r4rrCrrr)r4rfieldrls    r
test_timeszTimesTests.test_times%s
eR__5!	0EE5)E!!%/	0
77d?U00!4U22A6U]]A.rN)r\r]r^rr+rrrr$s/rrcbeZdZdZej
ejdvddZdZ	y)	ForkTestsc<d}td|td|dy)Nzif 1:
            import os
            from test import support
            pid = os.fork()
            if pid != 0:
                support.wait_process(pid, exitcode=0)
        rmalloc_debug)PYTHONMALLOCrrs  r	test_forkzForkTests.test_fork6s!	t$t.Ar)r)darwinz'Only Linux and macOS detect this today.cd}td|d\}}}|j|jdd|j|jddy)Naif 1:
            import os, threading, warnings
            from _testcapi import _spawn_pthread_waiter, _end_spawned_pthread
            _spawn_pthread_waiter()
            try:
                with warnings.catch_warnings(record=True) as ws:
                    warnings.filterwarnings(
                            "always", category=DeprecationWarning)
                    if os.fork() == 0:
                        assert not ws, f"unexpected warnings in child: {ws}"
                        os._exit(0)  # child
                    else:
                        assert ws[0].category == DeprecationWarning, ws[0]
                        assert 'fork' in str(ws[0].message), ws[0]
                        # Waiting allows an error in the child to hit stderr.
                        exitcode = os.wait()[1]
                        assert exitcode == 0, f"child exited {exitcode}"
                assert threading.active_count() == 1, threading.enumerate()
            finally:
                _end_spawned_pthread()
        r0)PYTHONOPTIMIZErr)r
rCrMr4rrrrs     r-test_fork_warns_when_non_python_thread_existsz7ForkTests.test_fork_warns_when_non_python_thread_existsCsQ*'tT#F3G,b1G,b1rcpd}td|\}}}|jd||jd|y)Nzif 1:
            import atexit
            import os

            def exit_handler():
                pid = os.fork()
                if pid != 0:
                    print("shouldn't be printed")

            atexit.register(exit_handler)
        rrs"can't fork at interpreter shutdown)r
rCrrs     rtest_fork_at_exitzForkTests.test_fork_at_exit_s<
'tT23c"

;SArN)
r\r]r^rrrr=r>rrr+rrrr4s@BX)<<BD2D24Brr_fspathc4eZdZdZeejZy)TestPEP519PurePythonz>Explicitly test the pure Python implementation of os.fspath().N)r\r]r^rrrrrr+rrrrssLbjj)rr__main__)scontentr()r)r
contextlibrbrKr\rdrrrrPrrrr=rrrr=	sysconfigr@rrrrrr@testrtest.supportrrrrrr>r	rImportErrorrrlpwdgetpwallpw_uidrsr:	_testcapir
rrrtest.support.script_helperr
rtest.support.os_helperrr|rrrversionrrgetgidrxrr%rrr,TestCaser.r`rrrBasicTestMappingProtocolrrrrr%r.r2skip_unless_working_chmodrXr~rrrrget_config_varOS_URANDOM_DONT_USE_FDrcontextmanagerrrrrrYrmrrrrrrr+r-rerrrrrrrrrrrIsolatedAsyncioTestCaser(rrequires_linux_versionrrrrrrrr%rr9r<rArMrr
requires_forkrrr\main)us0r<module>rs<


	






&"&,(!#/3<<>2a2I+18#+

2yRZZ\Q&M3
3??#:#:00;;NK<<**95J)"))+:JK'xs||'>'>u'E'NP(A8!!A8JZ8!!Z8|
l7**l7^XA""XAvkJ=99kJ\	k(!!k(\WR)+BCI+I+DI+X6Y6WR)+BC	6j	6D	6g8$$gT$$8#X&&8#%8#v&:h''&:R"9:,8$$,;,*8$$*>WR-/DE'*X&&'*F'*ZI./14?y 01Q6?y 89Q>
'=?*79J'X&&J'9?J'Z""@WR)&(e+!!e+(e+PS\\W,.DE Bh'' BF BF"EF}*H%%}*G}*@WR(*<=#0!!#0>#0J(*@ADAx((DABDAL(*@AE0(##E0BE0NS\\W,.DEsKX&&sKFsKlS\\W,.DE,D)),DF,D^RWW_&9:,(++,;,^WR,.CD9+H%%9+E9+xS\\W,.DE
nB))nBFnB`S\\W,.DE8**8F8BS\\W,.DEY!8$$Y!FY!x"8,,"">7h''7 1(++1$GJx  GJGJTz,""z,z,~OPWR,.FG/""/HQ/WR/NGB
4N>@8,,@,WR,.HIU833UJUp
 13?A 1b)NGX..NG*ANGbWR!457VW:/H%%:/X:/zWR02LM2&2x((2'N2WR+-BC1b)N8$$N*DNbF@8$$F@PDH%%Dv>**v>v>r?((++?(DWR0DF&&(DE(*ST
4H%%
4UFF
4*8$$*D8$$D$_(##_D7F""7Ft
/""
/ 8B!!8B8Bz2y*z*zHMMOaRHEG3^$I+"{{*Gn+
Ds~k!k/"k='l>lll l:!k,+k,/k:9k:=lll	ll l76l7:mm