python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_shutil.cpython-311.opt-2.pyc

eddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZmZmZmZmZmZmZmZmZmZmZmZddlZddlZ	ddlZn
#e$rdZYnwxYwddl m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl"m'Z'e%dzZ(e%dzZ)e%d	zZ*ej+,d
Z-ej+,dZ.ej+ddd
kZ/	ddl0Z0ddl1Z1dZ2n
#e$rdZ2YnwxYw	ddl3Z3n
#e$rdZ3YnwxYwej45de6dZ7dZ8dZ9d>dZ:dZ;d>dZ<dZ=dZ>e>Z?dZ@GddZAGddeAejBZCGdd eAejBZDGd!d"eAejBZEGd#d$eAejBZFGd%d&eAejBZGGd'd(eAejBZHGd)d*eHZIGd+d,eAejBZJGd-d.ejBZKGd/d0ejBZLGd1d2eMZNejOe?d3Gd4d5eNejBZPejOe-d6Gd7d8eNejBZQGd9d:ejBZRGd;d<ejBZSeTd=krejUdSdS)?N)make_archiveregister_archive_formatunregister_archive_formatget_archive_formatsErrorunpack_archiveregister_unpack_format
RegistryErrorunregister_unpack_formatget_unpack_formats
SameFileError_GiveupOnFastCopy)support)	os_helper)TESTFNFakePath)warnings_helper2_SRC_DSTdarwinsunosaixTFzos.chdirzshouldn't call os.chdir()side_effectcJtttddd)NEXDEVzInvalid cross-device link)OSErrorgetattrerrno)argskwargss  D/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_shutil.py_fake_renamer&:s
'%"--/J
K
KKcFtjfd}|S)Nc	tj}tt_|i||t_S#|t_wxYwN)osrenamer&)r#r$builtin_renamefuncs   r%wrapzmock_rename.<locals>.wrap?sD	'YN$BI4(((&BIIBI&&&&s	$4A)	functoolswraps)r.r/s` r%mock_renamer2>s8_T'''''Kr'c	t|trtjj|}|rdnd}|rdnd}t|||5}||ddddS#1swxYwYdS)Nwbwutf-8encoding)
isinstancetupler+pathjoinopenwrite)r;contentbinarymoder8fps      r%
write_filerCIs$#w|T""44sD*tt7H	
dD8	,	,	,
sA++A/2A/c"	d}t|d}ddt|D}t|d5}|||D]}||	ddddS#1swxYwYdS)Nc3DK||kr|V||z}||k|r|VdSdSr*)totalsteps  r%chunkszwrite_test_file.<locals>.chunksYsMdllJJJTMEdll	KKKKK		r'i r'cng|]2}tjtj3SrF)randomchoicestring
ascii_lettersencode).0is  r%
<listcomp>z#write_test_file.<locals>.<listcomp>bsA///mF$899@@BB///r'r4)minr<ranger=r>)r;sizerIbufsizechunkfcsizes       r%write_test_filerZWsL$ooGHH//$W~~///
0
0E	
dD		QVD'**		E
GGENNNN	s%BBBc	t|trtjj|}|rdnd}|rdnd}t|||5}|cdddS#1swxYwYdS)Nrbrr6r7)r9r:r+r;r<r=read)r;r@rAr8rBs     r%	read_filer_is$#w|T""44sD*tt7H	
dD8	,	,	,wwyysA))A-0A-cg}ttj|D]}tj||}tj|retj|sF||dzt|D]}||dz|z|||S)N/)	sortedr+listdirr;r<isdirislinkappendrlistdir)r;resnamepns     r%rgrgws
Crz$''((GLLt$$
7==	BGNN1$5$5	JJtcz"""a[[
+
+

4#:>****
+
JJtJr'c6ttdsdSd}d}	tjdtjd5}|j}|ddddn#1swxYwYt|d5}tjdtjd5}|j}|}|}	tj	||dd	dddddd|tj||tj|d	Sd	S#t$rHYdddddd|tj||tj|dSdSwxYw#1swxYwY	dddn#1swxYwY|tj||tj|dSdS#|tj||tj|wwxYw)
NsendfileFr4dirdeletes
0123456789r\rT)
hasattrr+tempfileNamedTemporaryFilegetcwdrir>r=filenormrunlinkr )srcnamedstnamerXsrcdstinfdoutfds       r%supports_file2file_sendfiler~s82z""uGG&

(29;;u
M
M
M	#QRfG
GGM"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#'4
 
 
	 C,Try{{5QQQ	
 UX(zz||

 KtQ222 	
 	
 	
 	
 	
 	
 
	 
	 
	 
	 
	 
	 W%%%W%%%%%!!! 	
 	
 	
 	
 	
 	
 
	 
	 
	 
	 
	 
	 W%%%W%%%%%!
	
 	
 	
 	
 	
 	
 	
 	
 	
 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 W%%%W%%%%%W%%%W%%%%s(G)A."G).A22G)5A26G)	)F.20F#E:F;F.G)
FFF.G)FFF	F.F	F."G).F22G)5F26G))/Hctrxtjdkrhtjdtjz}|ddd}t|ddkSdS)	Niz/usr/bin/dump -o %s
i T)AIXsysmaxsize
subprocess	getoutput
executablesplitint)hdrsmaxdatas  r%
_maxdataOKrsm
s{j((

!"7#."H
I
I

4  $**,,Q/72*,,tr'ceZdZddZdS)BaseTestNc	tj|tj}|t
j||S)N)prefixro)rsmkdtempr+ru
addCleanuprrmtree)selfrds   r%rzBaseTest.mkdtemps@	
F	<<<	(!,,,r'r*)__name__
__module____qualname__rrFr'r%rrs(r'rc4eZdZdZejdZejdZej	e
ddZej	e
ddZdZ
ejejdd	d
kdejejdZd
ZdZdZej	ejddZejejddZdZejdZej	e
ddZdS)
TestRmTreecx|}tj|d}tj|ttj|ddtj|}||ttj
|dS)Nkillmesomefilefoo)rr+r;r<mkdirrCfsencodeassertIsInstancebytesshutilr)rtmpvictims   r%test_rmtree_works_on_bytesz%TestRmTree.test_rmtree_works_on_bytessllnnc8,,
27<<
33U;;;V$$fe,,,
fr'c|}tj|d}tj|tj|d}tj|||ttj	||
tj||
tj|gfd}tj	|||
td|ddtjj|
dd||dddtdS)Nrolinkc2|dSr*rfr#errorss r%onerrorz8TestRmTree.test_rmtree_fails_on_symlink.<locals>.onerrorMM$r'rrrrq)rr+r;r<rsymlinkassertRaisesr rr
assertTrueexistslexistsassertEquallenassertIsrerrrdir_rrrs     @r%test_rmtree_fails_on_symlinkz'TestRmTree.test_rmtree_fails_on_symlinkshllnnw||C''
w||C((

4'6=$777t,,-----...	 	 	 	 	 
dG,,,,Va(((

fQilBGN3331t,,,fQil1ow77777r'c|}tj|d}tj|d}tj|d}|||fD]}tj|tj|d}t|dtj|d}tj||tj|d}tj||tj|d}	tj||	tj||	tj
||tj
||tj
|dS	Ndir1dir2dir3file1rlink1link2link3)rr+r;r<rrCrrrassertFalserr
rrrrrrrrrrs
          r%test_rmtree_works_on_symlinksz(TestRmTree.test_rmtree_works_on_symlinkssllnnw||C((w||D&))w||C((tT!		AHQKKKKS'**5%   T7++

4T7++

4T7++

5%   
d--...t,,---u--.....r'zonly relevant on Windowsc|}tj|d}tj|tj|d}tj|||tj	||
ttj
||tj||tj|gfd}tj
|||t%d|ddtjj|dd||dddtdS)Nrorc2|dSr*rrs r%rz:TestRmTree.test_rmtree_fails_on_junctions.<locals>.onerrorrr'rrrrq)rr+r;r<r_winapiCreateJunctionrrrwrr rrrrrrrrrerrs     @r%test_rmtree_fails_on_junctionsz)TestRmTree.test_rmtree_fails_on_junctionssllnnw||C''
w||C((tT***	($///'6=$777t,,-----...	 	 	 	 	 
dG,,,,Va(((

fQilBGN3331t,,,fQil1ow77777r'c|}tj|d}tj|d}tj|d}|||fD]}tj|tj|d}t|dtj|d}t
j||tj|d}t
j||tj|d}	t
j||	tj	||
tj||tj||tj|dSr)
rr+r;r<rrCrrrrrrrrs
          r%test_rmtree_works_on_junctionsz)TestRmTree.test_rmtree_works_on_junctionssllnnw||C((w||D&))w||C((tT!		AHQKKKKS'**5%   T7++tU+++T7++tU+++T7++ue,,,
d--...t,,---u--.....r'c:tj|}|tt
j|tj|d|}t|dfdtj	
|d}|t5}tj|dddn#1swxYwY||j
j||tj	|tj|d|tj	|gfd}tj|||t#d|d	d	tj|d	d
||d	dd
t|d	dd
j||d
d	tj|d
d
||d
dd
t|d
dd
j|dS)NroT
ignore_errorststfilec2|dSr*rrs r%rz.TestRmTree.test_rmtree_errors.<locals>.onerror,rr'rrqrr)rsmktemprrFileNotFoundErrorrrrCr+r;r<NotADirectoryErrorr	exceptionfilenamerrrrscandirrrmdir)rrtmpdircmrrs     @r%test_rmtree_errorszTestRmTree.test_rmtree_errorss?t||~~666+V]HEEE
hd3333FI&+++7<<	22


1
2
2	$bM(###	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$.999x00111
hd3333x00111	 	 	 	 	 
h0000Va(((

fQilBJ///1x000fQil1o/ABBB1a18<<<

fQilBH---1x000fQil1o/ABBB1a18<<<<<sC&&C*-C*Ncygwinz2This test can't be run on Cygwin (issue #1071513).czd|_tjt|t
jttjtd|_	tjtd|_
tj|j	tj|j
tj
tj}tj
|j	j}tj
|j
j}tjtjz}tj|j	|tj|j
|tjt||tjt||tj|j	||tj|j
|tjt|j||jdddS)Nrabrrz1Expected call to onerror function did not happen.)
errorStater+rrrrrr;r<child_file_pathchild_dir_pathrcreate_empty_filestatst_modeS_IREADS_IEXECchmodcheck_args_to_onerrorr)rold_dir_modeold_child_file_modeold_child_dir_modenew_modes     r%
test_on_errorzTestRmTree.test_on_error:s


v...!w||FC88 gll6377#D$8999
$%%%wv. gd&:;;CWT%899A<,
%x000
$h///
"""&,777$"68KLLL$"57IJJJ
fd&@AAAA!L	N	N	N	N	Nr'c|jdkr|tjur|||jnl|tjur|||jnB||tj|	|t|jg|t|dt|xjdz
c_dS||tj||t|t|dtd|_dS)Nrqrrr)rr+rwrrrrrrcassertInrr
issubclassr )rr.argexcs    r%rz TestRmTree.check_args_to_onerrorYs"?Qry    d&:;;;;!!  d&9::::

dBJ///

cFD,?#@AAAOOJs1vw77888OOq OOOOT28,,,S&)))OOJs1vw77888DOOOr'c	tjfd}|t_tjtt	tdfdtjtt_dS#t_wxYw)NcL|tkrt|Sr*)rr )fnr#r$
orig_lstats   r%raiserzFTestRmTree.test_rmtree_does_not_choke_on_failing_lstat.<locals>.raiserws#<<!))O%:b>>)r'r)r+lstatrrrCrr)rrrs  @r%+test_rmtree_does_not_choke_on_failing_lstatz6TestRmTree.test_rmtree_does_not_choke_on_failing_lstatts
	"J
*
*
*
*
*
BHHV...M&!!!!BHHHzBH!!!!sA&A77Bcbtjtjtjtjhtjko/tjtjvotjtjv}|r|	tj|	tjj
|}tj|d}tj|	tj}Gddt&fd}|t_|tj||t_dS#|t_wxYw|tj|tjj
dS)NrceZdZdS)HTestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>.CalledN)rrrrFr'r%Calledrsr'rcr*rF)r#r$rs  r%_raiserzITestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>._raisers Lr')r+r=rrwrsupports_dir_fdrcsupports_fdsupports_follow_symlinksrr_use_fd_functionsravoids_symlink_attacksrr;r<r_rmtree_safe_fd	Exceptionrr)rr
tmp_dirrreal_rmtreerrs      @r%-test_rmtree_uses_safe_fd_version_if_availablez8TestRmTree.test_rmtree_uses_safe_fd_version_if_availablesn grw	28D/0DZ2>9D W(CC		COOF4555OOFM@AAAllnnGWc**AHQKKK
5$4-----Y---!!!!!)0&!!&&-;;;)4&&&&4444V5666V]ABBBBBs
<AEE)zdir_fd is not supportedc|}d}tj||}tj|tj}|tj|tj|tjtj|dttj|ddd|
tj|tj
|||tj|dS)Nrsubdirrrdir_fd)rr+r;r<r=O_RDONLYrcloserrCrrrrr)rrrfullnamers     r%test_rmtree_with_dir_fdz"TestRmTree.test_rmtree_with_dir_fds,,..7<<00"+..&)))

h1122227<<(J??GGGx00111
fV,,,,1122222r'zdir_fd is supportedc"|}|t5tj|ddddn#1swxYwY|tj|dS)Nrr)	rrNotImplementedErrorrrrr+r;r)rrs  r%#test_rmtree_with_dir_fd_unsupportedz.TestRmTree.test_rmtree_with_dir_fd_unsupporteds,,..


2
3
3	-	-M'!,,,,	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-w//00000sAAActj|\}}tj||ttj|tj	|dSNr)
rsmkstemprr+rrrrrremove)rhandler;s   r%test_rmtree_dont_delete_filez'TestRmTree.test_rmtree_dont_delete_files]'DLLNN;;;
,fmTBBB
	$r'ctjt	tjtd}tjtd}tj|tj|||ttj	|tj	|dtj	tddS#tj	tdwxYw)NcheeseshopTr)
r+rrr;r<rrr rrrrzr{s   r%test_rmtree_on_symlinkz!TestRmTree.test_rmtree_on_symlinks		6',,vx00C',,vv..CHSMMMJsC   gv}c:::M#T2222M&555555FM&55555sB/C''Dctjt	tjtd}tjtd}tj|ttj|ddtj|||	ttj|tj|dtjtddS#tjtdwxYw)Nr#r$spamr4Tr)
r+rrr;r<r=rrrrr rrr%s   r%test_rmtree_on_junctionz"TestRmTree.test_rmtree_on_junctions
		6',,vx00C',,vv..CHSMMMc6**D1177999"3,,,gv}c:::M#T2222M&555555FM&55555sC/D''E)rrrrrskip_unless_symlinkrrunittest
skipUnlessrrrrskipIfrplatformskip_if_dac_overrideskip_unless_working_chmodrrrrrr
rrr!r&r)rFr'r%rrs"88#"8$"//#"/*X"<==88>=8&X"<==//>=/*===BX_S\"1"%1IKK#(NN)($#KKN6   6""" CCC0X13LMM33NM3X_V-/DEE11FE1"66#"6X"<==66>=666r'rceZdZdZdZejdZdZdZ	dZ
ej
ddZd	Zejeed
dejejejdkd
dZdZejdZejdZdZdZdS)TestCopyTreec	|}tj|d}|t
j||t
jtj|t|dfdtj	tj|dt|ddfdtj
|||tjtj|d|tj
tj|d|tjtj|ddt|df}||dt|ddf}||ddS)Ndestinationtest.txt123test_dir456)rr+r;r<rrrdirnamerCrcopytreerisfilerdr_rrsrc_dirdst_diractuals    r%test_copytree_simplez!TestCopyTree.test_copytree_simples,,..',,t||~~}==
w///
rww'?'?@@@GZ(%000
gz22333GZ4e<<<)))rw||GZ'H'HIIJJJ

bgll7J&G&GHHIIIrw||GZ4>(@(@AA	B	B	BGZ011'''GZ<=='''''r'c	P|}|}|tj||tj|t	|dfdtjt
j|dtjt
j|dt	|ddfdt	|ddfdtj	||d|
t
jt
j|d|
t
jt
j|d|
t
jt
j|ddt|df}||dt|ddf}||d|t 5tj	||d	ddddS#1swxYwYdS)
Nznonexisting.txtr6existing_dirzexisting.txtzwill be replacedzhas been replacedT)
dirs_exist_okF)rrrrrCr+rr;r<r:rr;rdr_rrFileExistsErrorr<s    r%test_copytree_dirs_exist_okz(TestCopyTree.test_copytree_dirs_exist_oks,,..,,..
w///
w///G./777
g~66777
g~66777G^^<>PQQQG^^<>QRRR====rw||G=N'O'OPPQQQ

bgll7N&K&KLLMMMrw||G^4B(D(DEE	F	F	FG%6788'''G^^DEE!4555



/
/	C	COGWEBBBB	C	C	C	C	C	C	C	C	C	C	C	C	C	C	C	C	C	Cs6JJ"Jc	|}tj|d}tj|d}tj|d}tj|tj|t|dfdtj|d}tj|d}tjtj|d|ttdr,tj|tj
tjzttd	r4ttd
rtj|tj
tj|}tj||d|tjtj|ddtjtj|dd}tjd
kr|dr
|dd}||tj|dtj|}	ttdr ||	j|jttd	r"||	j|jdSdS)Nrzr{subzfile.txtrrzsub/linklchmodlchflags	UF_NODUMPTsymlinksntz\\?\)rr+r;r<rrCrrrrHrS_IRWXUS_IRWXOrIrJrrr:rrereadlinkri
startswithrrst_flags)
rrr=r>sub_dirsrc_linkdst_linksrc_statr?dst_stats
          r%test_copytree_symlinksz#TestCopyTree.test_copytree_symlinkss,,..',,w..',,w..',,w..

GZ(%0007<<007<<44

27<<44			2x  	=Iht| ;<<<2z""	2wt['A'A	2K$.1118H%%48888rw||GUF'K'KLLMMMRW\\'5&AABB7d??v00;;?ABBZFgz!B!BCCC8H%%2x  	AX-x/?@@@2z""	CX.0ABBBBB	C	Cr'c
0tjj}tjj}|}	||d}t|dfdt|dfdtj||dt|ddfdtj||dt|ddfdtj||ddtj||dd	t|dddfdt|dd	d
fd	tjdd}tj	||||
|||d||||d||||dtj|n#tj|wxYw	tjdd
}tj	|||||||d||||dd	||||ddtj|n#tj|wxYw	d}tj	|||||||dd	d
||||ddtj|n#tj|wxYw	tj|tjtj
|dS#tj|tjtj
|wxYw)Nr4r5r6ztest.tmpr7r8	test_dir2rsubdir2ztest.pyz*.tmpignorezsubdir*crg}|D]}tj||}tj|r4|ddkr||utj|ddvr|||S)Nrrz.py)r+r;r<rdrrfsplitext)rznamesrhrir;s     r%_filterz8TestCopyTree.test_copytree_with_exclude.<locals>._filterKsC %--!w||C66GMM$//- JJLL,88JJt,,,,W--d33B7EBBJJt,,,Jr')r+r;r<rrrCrrignore_patternsr:rrrr9)rr<rr=r>patternsrbs       r%test_copytree_with_excludez'TestCopyTree.test_copytree_with_exclude#sw|,,..:	4d4<<>>=99G,e444,e444HTT':..///Z8%@@@HTT';//000j95AAAHTT';99:::HTT';	::;;;h
CUKKKiCUKKK
'!1';GGBBBBttGZ'@'@ A ABBB  Wj(A(A!B!BCCC  Wk(B(B!C!CDDD
g&&&&
g&&&&
'!1'9EEBBBB  Wj(A(A!B!BCCC  Wk9(M(M!N!NOOO  Wk8(L(L!M!MNNN
g&&&&
g&&&&
'


AAAA  Wk9-6)8)8"9"9:::  Wk8(L(L!M!MNNN
g&&&&
g&&&&&M'"""M"'//'2233333
M'"""M"'//'223333sXD
OB$G<'O<HOB&K<OK''O+A-M-O-NOAPc
tjj}tjj}}||d}tj||tj||dtjtj|ddt
|dddfdgfd}|d}tj|||	|||ddd|d}tjtj|||	|||ddd|d}ttj
|d	}|tjtj|||	|||dddt#d
dS)Nsourcer7rr5r8cX||t|tt|tt
||D]}|tgSr*)rfrstrlistrrset)rzrariinvokationsrs   r%_ignorez?TestCopyTree.test_copytree_arg_types_of_ignore.<locals>._ignorerss###!!#s+++!!%...SZZSZZ999
1
1%%dC0000Ir'r4r]r	)r+r;r<rrrrCrr:rpathlibPathrjrrDirEntryrr)	rr<rrr=rmr>
src_dir_entryrls	`       @r%!test_copytree_arg_types_of_ignorez.TestCopyTree.test_copytree_arg_types_of_ignoredsqw|,,..$w))
g
gz**+++
gz8<<===GZ:>FFF						$t||~~}559999ttGZ$. 0 011	2	2	2$t||~~}55W--wwGGGGttGZ$. 0 011	2	2	2$t||~~}55RZ0011!4
mR[999
ww????ttGZ$. 0 011	2	2	2	
[))1-----r'c	|}tj|d}tj|tj|d}|tj|tj|dt|dfdtjtj|ddt|dfdtjtj|ddtj|	}|tj|tj|dt
j|||
tj|jtj|j|
tjtj|djtjtj|dj|
tjtj|djtjtj|djtj|tj|d
}|
tj|jtj|jdS)Nrgr4izpermissive.txtr6zrestrictive.txtr8irr)rr+r;r<rrrrrrCrsrr:rrrr)rrr=r>restrictive_subdirrestrictive_subdir_dsts      r%!test_copytree_retains_permissionsz.TestCopyTree.test_copytree_retains_permissionss,,..',,w11
',,w
66
w///
%   G-.666
g'788%@@@G./777
g'8995AAA%-':::	(*<===
#U+++)))))12773C3C3KLLLg7G!H!HIIQ'"',,w8H"I"IJJR	T	T	Tg7H!I!IJJR'"',,w8I"J"JKKS	U	U	U!#g.0gmm<N.O.OPQ.R"T"T!344<'"899A	C	C	C	C	Cr'zos.chmodc|}tj|d}|t
j||t
jtj|td|_	|
t
j5tj||ddddS#1swxYwYdS)Nr4zka-boom)
rr+r;r<rrrr9PermissionErrorrrrr:)r
mock_patchr=r>s    r%test_copytree_winerrorz#TestCopyTree.test_copytree_winerrors
,,..',,t||~~}==
w///
rww'?'?@@@!0!;!;



v|
,
,	.	.OGW---	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.sC::C>C>cfd}gtjttjddd5}|dddn#1swxYwYtj	|
tddS)	Ncnd|t|t|tjd|tjddSNr)rfrrirr+r;r<)rrr{flagrrzs  r%custom_cpfunzETestCopyTree.test_copytree_custom_copy_function.<locals>.custom_cpfunsKK!!!S)))!!!S)))QS% 8 8999QS% 8 899999r'rrr5r6r7
copy_functionr)rrsrr=r+r;r<rrr:rr)rrrXr{rrzs`  @@@r%"test_copytree_custom_copy_functionz/TestCopyTree.test_copytree_custom_copy_functions	:	:	:	:	:	:	:	:llnno$,,..111
"',,sE**C'
B
B
B	a
GGIII															S====TA&&&&&s:BB"Bmkfiforequires os.mkfifo()vxworks%fifo requires special path on VxWorksctjt	tjtd}tj|tj|d}	tj|n/#t$r"}|d|zYd}~nd}~wwxYw	tj	tt|dnq#tj$r_}|j
d}|t|d|d\}}}|d|z|Yd}~nd}~wwxYwtjtd	tjtd	dS#tjtd	tjtd	wxYw)
Nrmypipeos.mkfifo(): %sz$shutil.Error should have been raisedrrz`%s` is a named pipeTr)r+rrr;r<rryskipTestrr:TESTFN2failrr#rrr)rrpipeerrzr{	error_msgs        r%test_copytree_named_pipez%TestCopyTree.test_copytree_named_pipes
		7W\\&(33FHV7<<11D
5	$"
5
5
5

/!344444444
5
B000		@AAAA
<
K
K
K  Va000&,Qi#S)  !7$!>	JJJJJJJJ	
K
M&5555M'666666
M&5555M'66666saAF5B
	F

B6B1,F1B66F:C/F/E>AEFEF8Gc|}tj|d}t	|dfdtjtj|dt	|ddfdgfd}t
j||||tddS)	Nr4r5r6r7r8c6||fdSr*r)rzr{copieds  r%_copyz6TestCopyTree.test_copytree_special_func.<locals>._copysMM3*%%%%%r'rrq)
rr+r;r<rCrrr:rr)rr=r>rrs    @r%test_copytree_special_funcz'TestCopyTree.test_copytree_special_funcs,,..',,t||~~}==GZ(%000
gz22333GZ4e<<<	&	&	&	&	&	>>>>Va(((((r'c|}tj|d}t	|dtj|d}tj|||fD]h}tjdtj|dtj|tj|ditj|d}|ttj
||tj|d}tj
||d	
tj|D]2\}}}|d||
d|3tj|d}tj
||d	|
dtj|dS)
Nr5abcdir_a
IDONTEXISTbrokenvalidr4destination2T)ignore_dangling_symlinksdestination3rK)rr+r;r<rCrrrrrr:walkassertNotInrrc)	rr=
valid_filerrr>rootdirsfiless	         r%test_copytree_dangling_symlinksz,TestCopyTree.test_copytree_dangling_symlinkss,,..W\\':66
:u%%%Wg..
%	=	=AJ|RW\\!X%>%>???Jz27<<7#;#;<<<<',,t||~~}==%'7CCC',,t||~~~>>4HHHH!#!1!1	*	*D$Xu---MM'5))))',,t||~~~>>48888

j"*W"5"566666r'c	D|}tj|d}tjtj|dttj|ddd5	dddn#1swxYwYtjtj|dtj|ddtj||d	|	tj
tj|d|dtjtj|dtj|d
}tj||d	|
tj
tj|d|dtjtj|ddS)Nr4real_dirr5r4link_to_dirT)target_is_directoryFrKr)rr+r;r<rr=rrr:rrerrcr)rr=r>s   r%test_copytree_symlink_dirz&TestCopyTree.test_copytree_symlink_dir
s,,..',,t||~~}==
gz22333
"',,w
J??
F
F																	

27<<447<<77'+	-	-	-	-	59999Wm(L(LMMNNN

j"*RW\\'=-Q-Q"R"RSSS',,t||~~~>>48888rw||G]'K'KLLMMM

j"*RW\\'=-Q-Q"R"RSSSSSs(B66B:=B:cV|}|dz}|tj|dtj|d}t|dtj||}|	dgt	j
|dS)NdestTr)rrrrr+r;r<rCr:rrc)rr=r>rzrvs     r%test_copytree_return_valuez'TestCopyTree.test_copytree_return_value!s,,..F"
w555gll7E**3
_Wg
.
.%"*R..11111r'c|}|tj|dtj|dd}tj|dd}t	j|tj|d}t|dtj	||}|
dgt	j|dS)NTrtpg
somevendorz1.0pol)rrrrr+r;r<makedirsrCr:rrc)rbase_dirr=r>rzrs      r%test_copytree_subdirectoryz'TestCopyTree.test_copytree_subdirectory+s<<>>
xtDDD',,xd33',,we<<
Ggll7E**3
_Wg
.
.%"*R..11111r'N)rrrr@rErr*rYrersrwr+mockpatchr{rr,rrr+r-rr.rrrrrrrFr'r%r2r2s(((&CCC2"CC#"C>?4?4?4B(.(.(.TCCC6]$$..%$.'''$XX..0FGG"X_S\Y.;==77==#"HG7.)))"77#"74"TT#"T&222
2
2
2
2
2r'r2cVeZdZejdZejee	ddejdZ
ejee	ddejdZejdZ
ejee	doeed	oeed
ddZejd
ZejejejdZdZdZejdZejee	dddZejdZejdZdZdZdZdZejdZejee	dddZejdZ ejee	d d!eje!j"d"kd#d$Z#d%Z$d&Z%eje&pe'pe(d'eje)d(d)Z*d*Z+d+S),TestCopyc|}tj|d}tj|d}tj|d}tj|d}t	|dt	|dtj||tj||tj|tjtj	ztj|tj
|tj|jtj|jtj|||tj|jtj|jtjdkrjtj|tj
tj|||tj|jtj|jtj|tj
tj|||tj|jtj|jtj|tj
tj|||tj|jtj|jdSdS)NrbarbazquuxrM)rr+r;r<rCrrrrOS_IRWXGrPassertNotEqualrrcopymoderrirrrzr{rUrVs      r%test_copymode_follow_symlinksz&TestCopy.test_copymode_follow_symlinks;sN,,..gll7E**gll7E**7<<//7<<0033

3!!!

3!!!
dl4</000
dl###BGCLL0"'#,,2FGGGS!!!-rws||/CDDD
7d??HS$,'''OHc***RWS\\1273<<3GHHHHS$,'''OC***RWS\\1273<<3GHHHHS$,'''OHh///RWS\\1273<<3GHHHHH?r'rHzrequires os.lchmodc|}tj|d}tj|d}tj|d}tj|d}t	|dt	|dtj||tj||tj|tjtj	ztj|tjtj
|tjtj	ztj
|tjtj
||d|tj|jtj|j|tj|jtj|jtj
|tjtj
||d|tj|jtj|jtj
|tjtj
||d|tj|jtj|jdSNrrrrFfollow_symlinks)rr+r;r<rCrrrrOrrHrPrrrrrrrs      r% test_copymode_symlink_to_symlinkz)TestCopy.test_copymode_symlink_to_symlink[s5,,..gll7E**gll7E**7<<//7<<0033

3!!!

3!!!
dl4</000
dl###
	(DL5666
	(DL)))(EBBBB(++3(++3	5	5	5BGCLL0"'#,,2FGGG
	(DL)))#u====-rws||/CDDD
	(DL)))Xu====-rws||/CDDDDDr'z requires os.lchmod to be missingc|}tj|d}tj|d}tj|d}tj|d}t	|dt	|dtj||tj||t
j||ddSr)rr+r;r<rCrrrrs      r%*test_copymode_symlink_to_symlink_wo_lchmodz3TestCopy.test_copymode_symlink_to_symlink_wo_lchmodys,,..gll7E**gll7E**7<<//7<<0033

3!!!

3!!!(EBBBBBBr'cb|}tj|d}tj|d}tj|d}tj|d}t	|dtj|}tj||j|jdz
ft	|d|	tj|jtj|jtj
||tj
||ttdrtj|t
j
ttdr4tt
drtj|t
jtj|}ttdrIt#j||d	
|	|jtj|jt#j||d
tj|}tjtjvr:dD]7}	|t-||	t-||	d
z8ttdr ||j|jttdr0t|dr ||j|jt#j||d
|t5tj|jtj|jz
dkdS)NrrrquxgE@rHrIrJTrFst_atimest_mtimerrSg?)rr+r;r<rCrutimerrrrrrrHrPrIrJrrcopystatrr	assertLessEqualr!rrSrabs)
rrrzr{rUrVrW
src_link_stat
dst_link_statattrs
          r%test_copystat_symlinkszTestCopy.test_copystat_symlinkss,,..gll7E**gll7E**7<<//7<<//373<<
x((4/1	2	2	23BGCLL1273<<3HIII

3!!!

3!!!2x  	.Ih---2z""	2wt['A'A	2K$.111**
2x  	MOHhEEEE
 5rws||7KLLL(EBBBB**

8r222.
G
G$$W]D%A%A%,]D%A%AA%EGGGG2x  	K]2M4IJJJ2z""	Mw}j'I'I	M]3]5KLLL#u====BGCLL1BGCLL4IIJJ 	!	!	!	!	!r'chflags
EOPNOTSUPPENOTSUPz)requires os.chflags, EOPNOTSUPP & ENOTSUPcx|}tj|d}tj|d}t	|dt	|dd}tj}	tjtjfD],}||t_tj
||-|tjtjzt_|ttj
|||t_dS#|t_wxYw)Nrfile2xxxc8tddfd
}|S)NTrc_r*)r")r;flagsrerrexs   r%_chflags_raiserzlTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser.<locals>._chflags_raisersr'r )rrrs` @r%make_chflags_raiserzSTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raisers@B@D







#"r')
rr+r;r<rCrr"rrrrrr )rrrrrold_chflagsrs       r%-test_copystat_handles_harmless_chflags_errorsz6TestCopy.test_copystat_handles_harmless_chflags_errorss
VW--VW--5%   5%   	#	#	#j	%'6
.
.0055
u----,,U-=
-MNNBJgvuEEE$BJJJBJ$$$$s
BD++D9c	
|}tj|d
t	
dtj|d}t	|dtj
|tj
ddtj
ddtj
||ttj

ttj
||tj
dtj|dtj|t	|dttjd		fd}	tj|t_tj
||dtj
|t_n#t_wxYwd	d

fd
}	tj
|t_
tj
|t_
n#t_
wxYwtj|d
tj|d
}t	

t	||tj
ddtj|ddtj|dtj|d}tj|d}t	||t	||tj
|tj|||tj|dd|tj|dddS)Nrruser.foo42zuser.bar43EPERMc.|dkr|||fi|dS)NrrF)fnamervalr$
orig_setxattros_errors    r%_raise_on_user_fooz3TestCopy.test_copyxattr.<locals>._raise_on_user_foos5z!!
eT399&99999r'Trc^|krttjd||S)NzOperation not supportedr)r r"r)rrorig_listxattrrzs  r%
_raise_on_srcz.TestCopy.test_copyxattr.<locals>._raise_on_srcs4||em-FGGG!>%IIIIr'the_originalthe_original_rozuser.the_valuesfiddlyi$the_copythe_copy_ro)rr+r;r<rCr
_copyxattrsetxattrrrb	listxattrgetxattrrr r"rrrr)rrr{rrsrcrodstrorrrrzs       @@@@r%test_copyxattrzTestCopy.test_copyxattrs,,..gll7E**3gll7E**3	#s###
CU+++
CU+++#s###S 1 122F2<;L;L4M4MNNNC,,C,,	.	.	.		#35;00	:	:	:	:	:	:
	(KM,BKc3'''MM*bl3&7&7888'BKK-BK''''48	J	J	J	J	J	J	J	J	*\N(BLc3''')BLL>BL))))gll7N33W&78835%   
C)9555
E+Y777
gll7J//Wm4435%   S!!!u%%%S*:;;YGGGU,<==yIIIIIs$AHH!-II)cp|}tj|d}tj|d}t	|dtj||tj|ddtj|dddtj|d}tj|d	}t	|dtj||tj||d|	tj
|ddd|ttj
|dtj||d|	tj
|dddS)
Nrrztrusted.foorrFrrr)
rr+r;r<rCrrrrrrrr )rrrzrUr{rVs      r%test_copyxattr_symlinksz TestCopy.test_copyxattr_symlinkssr,,..gll7E**7<<//3

3!!!
C...
HmUEJJJJgll7E**7<<//3

3!!!(HeDDDDX}eTTTV[\\\'2;]CCC(C????S-88%@@@@@r'cd}|}t||fdtj||}|}|||tj||}||fS)Nr5r)rrCr+r;r<)rmethodrrrtmpdir2rs       r%
_copy_filezTestCopy._copy_file+s{FE?E***VU++,,..ugWe,,u~r'c6|tj\}}|tj||t	j|j	t	j|j	dSr*)
rrcopyrr+r;rrrr)rrrs   r%	test_copyzTestCopy.test_copy5skv{33uu--.../1GHHHHHr'c|}tj|d}tj|d}tj|d}t	|dtj||t
tdr,tj|tj	tj
ztj||d|
tj||t!|t!|tj|tj||d|tj||tj|tj|t
tdrF|tj|jtj|jdSdS)NrrrrHTrF)rr+r;r<rCrrrrHrrOrPrr	rrerr_rrrQrr)rrrzr{rUs     r%test_copy_symlinkszTestCopy.test_copy_symlinks;s,,..gll7E**gll7E**7<<//3

3!!!2x  	=Iht| ;<<<Hc48888,,---33888
	#Hc59999s++,,,S))2;x+@+@AAA2x  	4RXh//7Xc]]2
4
4
4
4
4	4	4r'rzrequires os.utimech|tj\}}|tj|t	j|}t	j|}||j	|j	dD]7}|
t||t||dz8ttdrDt|dr6|t|dt|ddSdSdS)NrrrrS)
rrcopy2rr+r;rrrrrr!rr)rrr
file1_stat
file2_statrs      r%
test_copy2zTestCopy.test_copy2Ts3v|44uu--...WU^^
WU^^
+Z-?@@@*	@	@D  T!:!:!(T!:!:Q!>
@
@
@
@2y!!	>gj*&E&E	>WZ<<$Z<<
>
>
>
>
>	>	>	>	>r'c|}tj|d}tj|d}tj|d}t	|dtj||t
tdr,tj|tj	tj
zt
tdr4t
tdrtj|tjtj|}tj
|}tj||d|tj||t'|t'|tj|tj||d	|tj||tj|tj|tj
|}tjtjvr:d
D]7}|t5||t5||dz8t
tdr@||j|j||j|jt
tdr2t
|dr$||j|jdSdSdS)
NrrrrHrIrJTrFrrrS)rr+r;r<rCrrrrHrrOrPrIrJrrrrrerr_rrrQrr	rr!rrrS)	rrrzr{rUrWrrXrs	         r%test_copy2_symlinkszTestCopy.test_copy2_symlinkses,,..gll7E**gll7E**7<<//3

3!!!2x  	=Iht| ;<<<2z""	2wt['A'A	2K$.11173<<**
XsD9999,,---33888
	#XsE::::s++,,,S))2;x+@+@AAA8C==
8r222.
B
B$$W]D%A%A%,Xt%<%<q%@BBBB2x  	D]2H4DEEE 0(2BCCC2z""	Hw}j'I'I	H]3X5FGGGGG	H	H	H	Hr'c|}tj|d}tj|d}t	|dtj|ddt
j|||tj	|dtj	|dtj
|dS)Nrrrr)rr+r;r<rCrrrrrr)rrrzr{s    r%test_copy2_xattrzTestCopy.test_copy2_xattrs,,..gll7E**gll7E**3
CU+++S#C,,C,,	.	.	.		#r'c(tjtjfD]}|}|}tj|d}t|d|||}||tj|d||tj|d}||tj|ddS)Nrr)	rr	rrr+r;r<rCr)rrr=r>rzrs      r%test_copy_return_valuezTestCopy.test_copy_return_values;-	?	?BllnnGllnnG',,w..CsE"""C!!BRgu!=!=>>>Cgu5566BRgu!=!=>>>>	?	?r'cD|tjdSr*)_test_copy_dirrr	rs r%
test_copy_dirzTestCopy.test_copy_dirsFK(((((r'cD|tjdSr*)rrrrs r%test_copy2_dirzTestCopy.test_copy2_dirsFL)))))r'c|}tj|d}|}tj|d}t	|dt
jdkrt}nt}|	|||||	|||||||dSNrdoes_not_exist/win32)
rr+r;r<rCrr.ryIsADirectoryErrorr)r	copy_funcr=src_filerr{rs       r%rzTestCopy._test_copy_dirs,,..7<<//||~~gll7$5668U###<7""!CC#C#y$888	
#y$444	(D!!!!!r'c|}tj|d}tj|d}tj|d}tj|d}t	|dtj||t
j||d|tj	||
tj|tj|t
j|||tj	|dS)Nrzr{rVrrFr)
rr+r;r<rCrrcopyfilerrerrQr)rrrzr{rVrs      r%test_copyfile_symlinkszTestCopy.test_copyfile_symlinkss ,,..gll7E**gll7E**7<<44w||GV,,3

3h>>>>x00111T**BK,A,ABBBc""",,-----r'rzrequires os.linkcrtjttjtd}tjtd}	t|dd5}|ddddn#1swxYwY	tj||n/#t$r"}|	d|zYd}~nd}~wwxYw|
tjtj
||t|dd5}||ddddn#1swxYwYtj|tjtd	
dS#tjtd	
wxYw)Nr#r$r5r6r7cheddarz
os.link(): %sr]Tr)r+rrr;r<r=r>rryrrrr
r&rr^rr)rrzr{rXrs     r%'test_dont_copy_file_onto_link_to_itselfz0TestCopy.test_dont_copy_file_onto_link_to_itselfs	gll68,,gll66**	6c3111
#Q	"""
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
3S!!!!"
3
3
3

o122222222
3f2FOS#NNNc3111
6Q  9555
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6IcNNNM&555555FM&55555s%F7B
FBF B!F%B;:F;
C'C"F"C''AF()EFE!!F$E!%FF6ctjttjtd}tjtd}	t|dd5}|ddddn#1swxYwYtjd||tj
tj||t|dd5}||
ddddn#1swxYwYtj|tjtd	dS#tjtd	wxYw)
Nr#r$r5r6r7r)r]Tr)r+rrr;r<r=r>rrrr
r&rr^rr)rrzr{rXs    r%*test_dont_copy_file_onto_symlink_to_itselfz3TestCopy.test_dont_copy_file_onto_symlink_to_itselfs	gll68,,gll66**	6c3111
#Q	"""
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

Jx%%%f2FOS#NNNc3111
6Q  9555
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6IcNNNM&555555FM&55555sU%E(7B
E(BE( B!AE(7)D, E(,D00E(3D04E((Frrrrc	tjtn/#t$r"}|d|zYd}~nd}~wwxYw	|tjtjtt|tjtjtttjtdS#tjtwxYw)Nr)r+rrryrrrSpecialFileErrorr&r__file__r)rrs  r%test_copyfile_named_pipez!TestCopy.test_copyfile_named_pipes	1If	1	1	1MM+a/00000000	1	f5 &
B
B
Bf5 &6
C
C
C
IfBIfs!
AAAA,CC.c|}|}tj|d}tj|d}t	|dtj||}|tj||	t|t|dS)Nrr)rr+r;r<rCrr&rrrr_)rr=r>dst_filer$rs      r%test_copyfile_return_valuez#TestCopy.test_copyfile_return_values,,..,,..7<<//7<<//8U###
_Xx
0
0r**+++8,,i.A.ABBBBBr'cp|}tj|d}t	|d|ttj|||ttj|||
t|ddSr~)rr+r;r<rCrr
rr&rrr_)rr=r$s   r%test_copyfile_same_filez TestCopy.test_copyfile_same_files,,..7<<//8U###-(HMMM%(HEEE8,,e44444r'zMOn MACOS, Solaris and Windows the errors are not confusing (though different)zNot valid on AIX, see gh-92670c|}tj|d}tj|d}t	|d|ttj||dS)Nrr )	rr+r;r<rCrrrr&)rr=r$r{s    r%test_copyfile_nonexistent_dirz&TestCopy.test_copyfile_nonexistent_dirso,,..7<<//gll7$5668U###+V_hLLLLLr'c|}tj|d}|}tj|d}t	|dt
jdkrt}nt}|	|tj|||	|tj|||	|tj||dSr)rr+r;r<rCrr.ryr"rrr&)rr=r$rr{rs      r%test_copyfile_copy_dirzTestCopy.test_copyfile_copy_dir's,,..7<<//||~~gll7$5668U###<7""!CC#C#v===#v'BBB#vg>>>>>r'N),rrrrr*rr+r,rrr+rr-rrr"rskip_unless_xattrrskip_unless_dac_overriderrr
rrrrrrrrr'r*r,rr.r0r3r5MACOSSOLARISrrr7r9rFr'r%rr7s"II#"I>XX..0DEE"EE#"FEE8X_WWR**,NOO"
C
C#"PO
C"&!&!#"&!PXY//3 553 	22DFF%%	FF%6 =J=J! =J~" 'AA('! #"A.III"44#"40XW--/BCC>>DC> " H H#" HD 

! 

?
?
?)))***"""$"..#". XV,,.@AA66BA6&"66#"6(XX..0FGGX_S\Y.;====HG	C	C	C
5
5
5X_U0g03BCCX_S:;;MM<;	CC
M?????r'rceZdZejdZdZd$dZejej	e
jdddZejdZ
ejej	e
jd	d
dZejej	e
jdd
dZdZejdZejej	eddZdZdZejdZdZdZejdZdZdZdZdZejdZejdZ ej!ej"e#o
e$dd Z%ejd!Z&d"Z'd#S)%TestArchivesc|d\}}|}tj|tj|}tjtj|d}tj	|5t5tj|}t|d|d}dddn#1swxYwYdddn#1swxYwY|
||dz|tj||t!j|t!j|d5}||gddddn#1swxYwYtj	|5t5t|d|d}dddn#1swxYwYdddn#1swxYwY|
||d	z|tj||t!j|t!j|d
5}||gdddddS#1swxYwYdS)Nrarchivegztar..tar.gzzr:gz)rCz./subz./sub2z./file1z./file2z./sub/file3tar.tarr])
_create_filesrr+rr;r9r<basenamer
change_cwdno_chdirabspathrrrr;tarfile
is_tarfiler=assertCountEqualgetnames)	rroot_dirrrwork_dir
rel_base_name	base_nametarballtfs	         r%test_make_tarballzTestArchives.test_make_tarball>s"//33(,,..
7??7++RW%5%5g%>%>	JJ


!(
+
+	J	JX	J	J
66I"='8SIIG	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J	J
	
)i"7888w//000*733444
\'6
*
*	Ib!!"++--#H#H#H
I
I
I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I
!(
+
+	H	HX	H	H"=%3GGG	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H)f"4555w//000*733444
\'3
'
'	H2!!"++--#G#G#G
H
H
H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	Hs1D92C7+D7C;	;D>C;	?DDD +GGG6H4>HH4H!	!H4$H!	%H44H8;H8+K>>LLctj|5}|}|t	|cdddS#1swxYwYdSr*)rLr=rOsortr:)rr;rEras    r%_tarinfozTestArchives._tarinfobs
\$

	 3LLNNEJJLLL<<	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 s7AA Adistc|}tj||}tj|dt|dfdt|dfdtjtj|dt|ddfdtjtj|d|rt|d	fd||fS)
NT)exist_okrrrrGfile3sub2outer)rr+r;r<rrCr)rrrPrZs    r%rGzTestArchives._create_fileshs<<>>w||Hh//
D4((((D'?E***D'?E***
dE**+++D%)5111
dF++,,,	3'*E222!!r'rEzNeed the tar command to runc|\}}tj|d}t
5t
|d||}dddn#1swxYwY|||dz|tj	|tj|d}ddd|g}tj||tj|tj	|||
||
|t
5t
|d||}dddn#1swxYwY|||dz|tj	|t
5t
|d||d	
}dddn#1swxYwY|||dz|tj	|dS)NrArBrDzarchive2.tarrEz-cfcwdstdoutrFTdry_run)rGr+r;r<rrJrrrr;r
check_callDEVNULLrY)rrPrrSrTtarball2tar_cmds       r%test_tarfile_vs_tarz TestArchives.test_tarfile_vs_tarvs"//11(GLL;;	
	K	K"9gxJJG	K	K	K	K	K	K	K	K	K	K	K	K	K	K	K	
)i"7888w//0007<<.99%:g8%/%7	9	9	9	9	
x00111w//x1H1HIII	I	I"9eXxHHG	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I)f"4555w//000	1	1"9eXx+/111G	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	
)f"4555w//00000s6A00A47A4F!!F%(F%>HH#&H#cL|\}}|}tj|tj|}tjtj|d}tj	|5t5tj|}t|d|}dddn#1swxYwYdddn#1swxYwY|
||dz|tj||t!j|t!j|5}||gddddn#1swxYwYtj	|5t5tj|}t|d||}dddn#1swxYwYdddn#1swxYwY|
||dz|tj||t!j|t!j|5}||gdddddS#1swxYwYdS)NrAzip.zip)dist/	dist/sub/
dist/sub2/
dist/file1
dist/file2dist/sub/file3r_)rnrorprqrrrs)rGrr+rr;r9r<rHrrIrJrKrrrr;zipfile
is_zipfileZipFilerNnamelist)	rrPrrrQrRrSrhzfs	         r%test_make_zipfilezTestArchives.test_make_zipfiles_"//11(,,..
7??7++RW%5%5g%>%>	JJ


!(
+
+	?	?X	?	?
66I}eX>>C	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	
i&0111s++,,,*3//000
_S
!
!	R!!"++--


															
!(
+
+	I	IX	I	I
66I}eXxHHC	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	
i&0111s++,,,*3//000
_S
!
!	DR!!"++--CCC
D
D
D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	Ds0D81C5)D5C9	9D<C9	=DDD+GGG3I;2H9-I9H=	=IH=	III!+LL LrlzNeed the zip command to runc|\}}tj|d}t
5t
|d||}dddn#1swxYwY|||dz|tj	|tj|d}dddd|g}tj||tj|tj	|tj|5}|}dddn#1swxYwYtj|5}|}	dddn#1swxYwY|t!|t!|	dS)NrArlrmzarchive2.zipz-qz-rra)rGr+r;r<rrJrrrr;rrfrgrtrvrwrb)
rrPrrSrAarchive2zip_cmdrxranames2s
          r%test_zipfile_vs_zipz TestArchives.test_zipfile_vs_zipsf"//11(GLL;;	
	I	I"9eXxHHG	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	
)f"4555w//0007<<.99$nh?g8%/%7	9	9	9	9	
x00111
_W
%
%	"KKMME	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
_X
&
&	#"[[]]F	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#v77777s6A00A47A4E55E9<E9F55F9<F9unzipzNeed the unzip command to runc.|\}}tj|d}t
5t
|d||}dddn#1swxYwY|||dz|tj	|dd|g}tj|5	tj
|tjn{#tj$ri}|jd}d	|vr|d
d}||||Yd}~nd}~wwxYwddddS#1swxYwYdS)NrArlrmrz-t)stderrreplace)rzunrecognized option: tzunzip doesn't support -tz{}

**Unzip Output**
{})rGr+r;r<rrJrrrr;rrIrcheck_outputSTDOUTCalledProcessErroroutputdecoderrformat)	rrPrrSrAr|rdetailsmsgs	         r%test_unzip_zipfilezTestArchives.test_unzip_zipfiles#"//11(GLL;;	
	I	I"9eXxHHG	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I	
)f"4555w//000D'*

!(
+
+	4	4
4'
8IJJJJJ0
4
4
4*++9+==+w66MM"<===2		#**S'2233333333
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4sOA00A47A4F
! DF
E:AE50F
5E::F

FFc|}tj|d}|t
t|ddS)NrAr)rr+r;r<r
ValueErrorr)rrrSs   r%test_make_archivezTestArchives.test_make_archivesDGLL33	*lIuEEEEEr'cJtr5tjdd}tjdd}ndx}}|\}}tj|	d}t|d||||}|tj|t|d||}|tj|t|d||||}|tj|t|d||dd}|tj|dS)	NrrrArlownergrouprE	kjhkjhkjgoihohoh)
UID_GID_SUPPORTgrpgetgrgidpwdgetpwuidrGr+r;r<rrrr;)rrrrPrrSrhs       r%test_make_archive_owner_groupz*TestArchives.test_make_archive_owner_groupsk	#LOOA&ELOOA&EE""EE!//11(GLL;;	9eXxu!&(((s++,,,9eXx@@s++,,,9eXx!&e555s++,,,9eXx!,I???s++,,,,,r'Requires grp and pwd supportc
D|\}}tj|d}tjdd}tjdd}tj
|5t5t|d|d||}dddn#1swxYwYdddn#1swxYwY|
tj|tj|}	|D]8}||jd||jd9	|dS#|wxYw)NrArrBrZr)rGr+r;r<rrrrrrrIrJrrr;rLr=
getmembersruidgidr)	rrPrrSrrarchive_namerAmembers	         r%test_tarfile_root_ownerz$TestArchives.test_tarfile_root_owners"//11(GLL;;	Q"Q"

!(
+
+	B	BX	B	B'	7Hf.35BBBL	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B	B
	
|44555,|,,	!,,..
0
0  Q///  Q////
0
MMOOOOOGMMOOOOsCCB<0C<C	CC	CCC%A
F		Fctj}|}d}gfd}td|gd	t	jtd|5	t
dd|n#t$rYnwxYwdddn#1swxYwY|tj||||gtddS#tdwxYw)Nctr*)RuntimeError)r#kws  r%_breaksz3TestArchives.test_make_archive_cwd.<locals>._breaks.s.. r'cH||dSr*r)r;r
orig_chdirs r%_chdirz2TestArchives.test_make_archive_cwd.<locals>._chdir1s+KKJtr'rxxx filechdir)rP)
r+rurrr	swap_attrrr
rr)rcurrent_dirrPrrrrs     @@r%test_make_archive_cwdz"TestArchives.test_make_archive_cwd+soikk<<>>	!	!	!							 wJ???		-"2w77
: AAAAA D
















RY[[+666THk#:;;;%e,,,,,%e,,,,sUC/#B%A87B8
BBBBC/BC/BAC//Dcr|}tj|5t5|tddd|tj	ddddn#1swxYwYddddS#1swxYwYdS)NtestrEztest.tar
rrrIrJrrrr+r;r;rrPs  r%test_make_tarfile_in_curdirz(TestArchives.test_make_tarfile_in_curdirAs<<>>

!(
+
+	8	8X	8	8\&%88*EEEOOBGNN:66777	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	85B,ABB,B	B,B	B,,B03B0cr|}tj|5t5|tddd|tj	ddddn#1swxYwYddddS#1swxYwYdS)Nrrlztest.ziprrs  r%test_make_zipfile_in_curdirz(TestArchives.test_make_zipfile_in_curdirHs <<>>

!(
+
+	8	8X	8	8\&%88*EEEOOBGNN:66777	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8rc|ttdd|ttddd|ttddddgtdddgdd	tD}|d|tdd
tD}|d|dS)NrrctSr*xrFr'r%<lambda>z;TestArchives.test_register_archive_format.<locals>.<lambda>SQr'ctSr*rrFr'r%rz;TestArchives.test_register_archive_format.<locals>.<lambda>Urr')rrq)rrqrctSr*rrFr'r%rz;TestArchives.test_register_archive_format.<locals>.<lambda>Xsqr'rcg|]\}}|SrFrFrPriparamss   r%rRz=TestArchives.test_register_archive_format.<locals>.<listcomp>YBBBLD&4BBBr'cg|]\}}|SrFrFrs   r%rRz=TestArchives.test_register_archive_format.<locals>.<listcomp>]rr')r	TypeErrorrrrrr)rformatss  r%test_register_archive_formatz)TestArchives.test_register_archive_formatPs)%<eQGGG)%<eYY			)%<eYY!9-	/	/	/	 yy6(JGGGBB,?,A,ABBB

eW%%%!%(((BB,?,A,ABBB(((((r'c	|tjtddD]-}||5|}tj|d}|	t5}ttd||dddn#1swxYwY||j
jtj||j
j||tjtdt'j|\}}t
j||	t,5}ttd||dddn#1swxYwY||j
jtj||j
j||tjtddddn#1swxYwY/dS)NrFFTrdnonexistingrErrrrwrsubTestrr+r;r<rrrrrr"ENOENTrrrrsrrrENOTDIRrrernonexisting_filertmp_fdtmp_files       r%test_make_tarfile_rootdir_nodirz,TestArchives.test_make_tarfile_rootdir_nodir`s	(V///:::$	B	BGg..
B
B,,..#%7<<#G#G &&'899SR 0@'RRRRSSSSSSSSSSSSSSS  !3U\BBB  !68HIII  6!@!@AAA#+#3#@#@#@    &&'9::Kb 'JJJJKKKKKKKKKKKKKKK  !3U]CCC  !6AAA  6!@!@AAA
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B	B	B]AI
B8,I
8B<<I
?B<C
I

F2&I
2F66I
9F6:BI

I	I	c	|tjtddD]-}||5|}tj|d}|	t5}ttd||dddn#1swxYwY||j
jtj||j
j||tjtdt'j|\}}t
j||	t,5}ttd||dddn#1swxYwY||j
jtj||j
j||tjtddddn#1swxYwY/dS)Nrmrrdrrlrrrs       r%test_make_zipfile_rootdir_nodirz,TestArchives.test_make_zipfile_rootdir_nodirus	
	(V///:::$	B	BGg..
B
B,,..#%7<<#G#G &&'899SR 0@'RRRRSSSSSSSSSSSSSSS  !3U\BBB  !68HIII  6!@!@AAA#+#3#@#@#@    &&'9::Kb 'JJJJKKKKKKKKKKKKKKK  !3U]CCC  !6AAA  6!@!@AAA
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B	B	Brc|j|dfi||j|tjfi||j|tfi|dS)Nc|Sr*rFr;s r%rz3TestArchives.check_unpack_archive.<locals>.<lambda>sr')#check_unpack_archive_with_converterrorpr)rrr$s   r%check_unpack_archivez!TestArchives.check_unpack_archives}00%%	1	1)/	1	1	100GL	,	,$*	,	,	,00LLVLLLLLr'c|\}}t|}|dtj|d}t||||}|}	t||||	fi||	t|	||}
t||||
fd|i||	t|
||
tj5t|tfi|dddn#1swxYwY|
t5t|tfddi|ddddS#1swxYwYdS)Nr_rArr)rGrgrr+r;r<rrrrrr	ReadErrorrr)rr	converterr$rPrexpectedrSrrtmpdir3s           r%rz0TestArchives.check_unpack_archive_with_convertersh!//11(H%%   GLL;;		68XFF,,..yy**IIg,>,>II&III'**H555,,..yy**IIg,>,>	!	!v	!	!	!	!'**H555


v/
0
0	8	899V,,77777	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8


z
*
*	F	F99V,,EEUEfEEE	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	Fs$E77E;>E;GGGc||d||dtj|5||ddddS#1swxYwYdS)N
fully_trustedfilterdata)rrcheck_no_warnings)rrs  r%check_unpack_tarballz!TestArchives.check_unpack_tarballs!!&!AAA!!&!888

.t
4
4	.	.%%f---	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.sA&&A*-A*c0|ddS)NrErrs r%test_unpack_archive_tarz$TestArchives.test_unpack_archive_tars!!%(((((r'c0|ddS)NrBrrs r%test_unpack_archive_gztarz&TestArchives.test_unpack_archive_gztar!!'*****r'c0|ddS)Nbztarrrs r%test_unpack_archive_bztarz&TestArchives.test_unpack_archive_bztarrr'z(AIX MAXDATA must be 0x20000000 or largerc0|ddS)Nxztarrrs r%test_unpack_archive_xztarz&TestArchives.test_unpack_archive_xztars	
!!'*****r'c|d|t5|ddddddS#1swxYwYdS)Nrlrr)rrrrs r%test_unpack_archive_zipz$TestArchives.test_unpack_archive_zips!!%(((


y
)
)	<	<%%eF%;;;	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<sAAAct}fd}tdddg|dgtddttddg|tdtddg|ddgd	ftddgd	fttdt|dS)
Nc|d|d|ddS)Nr	stuff.booxx)r)rextract_dirextrars   r%_booz/TestArchives.test_unpack_registry.<locals>._boosKUA&&&X{333[$/////r'Booz.booz.b2)rrrrBoo2r)	rr	rrr
rrrr)rrrs`  r%test_unpack_registryz!TestArchives.test_unpack_registrys$&&	0	0	0	0	0
	uvuotl^LLL{D)))	
-)?!(D	*	*	*	!'''vx666

vx,.@.B.BCCC%&2.0B0D0DEEE	!(((+--w77777r'N)rZ)(rrrr
requires_zlibrVrYrGr+r,rwhichrjryr~rrrrrrrrrrrrrrrrrequires_bz2r
requires_lzmar-rrrrrrFr'r%r?r?:sW!H!H!HF   """"WXe,,68811881BW"D"D"DHWXe,,688888880WXg..8::44::4,FFF
W---6WX*HIIJI*---,888W888))) BBB*WBBB.MMMFFF0...)))W+++W+++WX_S--/YZZ++[Z+W<<<
88888r'r?ceZdZejeedddZejedejee	dddZ
dS)	TestMisc
disk_usagez)disk_usage not available on this platformc"tjtjt
}dD]+}|t||t,|	|j
d|	|jd||j
d||j
|j|	|j
|j
tjt
dS)N)rGusedfreer)rrr+r;r9r/rr!r
assertGreaterrGrassertGreaterEqualr	)rusagers   r%test_disk_usagezTestMisc.test_disk_usages!"'//(";";<<-	=	=D!!'%"6"6<<<<5;***5:q)))
A...UZ8885;
333	(#####r'rchownzrequires os.chownc}tj|tdt
5t
jdddn#1swxYwYt5t
jddddn#1swxYwYt5t
jddddn#1swxYwYt5t
jddddn#1swxYwYt5t
jddddn#1swxYwYtj}tj}dfd		}t
j|||||t
j|||t
j|||t
j|||
t
j|||||||t
j|||||t
j|||||t
j|||||
	tj|d}tj|d}t
j|||||t
j|||||||dS#t"$rYdSwxYw)
Nrztesting chown functionznon-existing username)userznon-existing groupname)rspamgQ	@ctj}|||j|||jdSdSr*)r+rrst_uidst_gid)r;rrsrrs    r%check_chownz(TestMisc.test_chown.<locals>.check_chown
sY!!A  ah///  ah/////r')rr)NN)rrsrrCrrrrLookupErrorrr+getuidgetgidrrrrKeyError)rr9rrrrrrs`      @r%
test_chownzTestMisc.test_chowns,,..?w///85666


z
*
*	#	#L"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#

{
+
+	A	AL(?@@@@	A	A	A	A	A	A	A	A	A	A	A	A	A	A	A

{
+
+	C	CL)ABBBB	C	C	C	C	C	C	C	C	C	C	C	C	C	C	C

y
)
)	,	,L7+++	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,

y
)
)	)	)L4(((	)	)	)	)	)	)	)	)	)	)	)	)	)	)	)ikkikk	0	0	0	0	0	0	0	XsC(((Hc3'''Xs###Hc"""XC((((Hc"""XS))))H#&&&&Wc3'''GS#&&&Wc"""GS!!!W3''''GS!!!WC((((G%%%%
	+<$$Q'DL%%a(E

L4///K#s+++L$...Kc*****			DD	slA77A;>A;B??CC$DDD,EEE3FFF 4M
M*)M*N)rrrr+r,rrrr
rr+rrFr'r%rrsX66DFF$$FF$X*HIIXW--/BCC:+:+DCJI:+:+:+r'rcNeZdZdZdZdZdZdZej	dZ
dZdZe
jejd	kd
dZdZd
ZdZdZdZdZe
jejd	kddZe
jejd	kddZdS)	TestWhichc|d|_tj|jdd|_tj|jjtj	|
|jjt
j
|jj\|_|_|j|_t
j|_d|_dS)NTmp)rz.Exerorsuffixz.EXE)rtemp_dirrsrt	temp_filer+rrirS_IXUSRrrr;rrofileenv_pathcurdirextrs r%setUpzTestWhich.setUp5sE22
"4<A<BDDD	$dl333,--- gmmDN,?@@$)
ir'ctj|j|j}|||jjdSNr)rrr%rorr#rirrs  r%
test_basiczTestWhich.test_basicCs;
\$)$(
3
3
3T^011111r'ctj|jj|j}|||jjdSr+)rrr#rir"rr,s  r%test_absolute_cmdzTestWhich.test_absolute_cmdHs@\$.-DM
B
B
BT^011111r'ctj|j\}}tj||j}t
j|5tj	||j
}|||dddn#1swxYwYt
j|j5tj	||}||ddddS#1swxYwYdSr+)
r+r;rror<r%rrIrrr"rassertIsNone)rrtail_dirrelpathrs     r%test_relative_cmdzTestWhich.test_relative_cmdNsn W]]4844(',,x33

!x
0
0
0	*	*gDM:::BR)))	*	*	*	*	*	*	*	*	*	*	*	*	*	*	*
!tx
0
0
0	"	"gH555Bb!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"s$"2B  B$'B$,C>>DDctj|j}t	j|j5t
j|j|}tj
dkr?||tj|j
|jn||ddddS#1swxYwYdS)Nrr!)r+r;r9rorrIrrr%rr.rr<r'r1)rrrs   r%test_cwdzTestWhich.test_cwd[s7??48,,

!tx
0
0
0	&	&dih777B|w&&  RW\\$+ty%I%IJJJJ!!"%%%	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&sBCCCcTtj|jjtjtj|jjtjr|dtj
|j|jtj}|
|dS)Nzcan't set the file read-only)r;rA)r+rr#rirraccessW_OKrrrr%ror1r,s  r%test_non_matching_modez TestWhich.test_non_matching_modegs	$dl333
9T^("'22	:MM8999
\$)$(
A
A
A"r'cXtj|j\}}t	j|5t
j|j|}|	|tj
||jddddS#1swxYwYdSr+)r+r;rrorrIrrr%rr<)rrr2rs    r%test_relative_pathzTestWhich.test_relative_pathpsW]]4844(

!x
0
0
0	D	Ddih777BRh	!B!BCCC	D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	D	DsABB#&B#cftjd|j}||dS)Nzfoo.exer)rrror1r,s  r%test_nonexistent_filezTestWhich.test_nonexistent_filevs2
\)$(
3
3
3"r'r!zpathext check is Windows-onlyctj|jdd|j}|||jjdd|jzdS)Nr)rrr%rorr#rir(r,s  r%test_pathext_checkingzTestWhich.test_pathext_checking{sU
\$)CRC.tx
8
8
8T^0"5@AAAAAr'ctj5}|j|d<tj|j}|||jjddddS#1swxYwYdSNPATH)	rEnvironmentVarGuardr&rrr%rr#rirenvrs   r%test_environ_pathzTestWhich.test_environ_paths

*
,
,	6-CKdi((BR!4555	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6sAA%%A),A)c	tj5}d|d<tjd|jd5t
jtd|j5tj	|j5tj|j}|
|dddn#1swxYwYdddn#1swxYwYdddn#1swxYwYddddS#1swxYwYdS)NrrD
os.confstrTreturn_valuecreatedefpath)rrEr+rrrorrr+rIrrr%r1rFs   r%test_environ_path_emptyz!TestWhich.test_environ_path_emptys

*
,
,	&CK$$\,0%22
&
&"2y$(;;
&
&%dh//
&
&\$),,!!"%%%
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&	&s}-C=!C%"C</B7	+C7B;
;C>B;
?CC%CC%CC%C=%C)	)C=,C)	-C==DDc	tj|jj}t
jdkrUtj}t|trtj
|}tj||}tj
5}tj|d<tjd|jd5t'jtd|j5t+j|j}||tj|j5t+j|j}|||dddn#1swxYwYdddn#1swxYwYdddn#1swxYwYddddS#1swxYwYdS)Nr!rDrJTrKrN)r+r;rHr#rirr.r'r9rrr<rrEpathsepr+rrrorrrrr%r1rIr)rexpected_cwdr'rGrs     r%test_environ_path_cwdzTestWhich.test_environ_path_cwdsw''(;<<<7""YF,..
-V,,7<<==L
*
,
,	7*CK$$\,0%22	
7	
7"2y$(;;	
7	
7\$),,!!"%%%)$(3377di00B$$R666777777777777777	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	
7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7s"7G!F,:AF0E>	2F>F
FF
F	F,FF,FF, G,F0	0G3F0	4GGGc@tj5}|ddtjdtd5tjtd|j
5tj|j
}dddn#1swxYwYdddn#1swxYwY|||jjtjd|j
d5tjtdd5tj|j
}dddn#1swxYwYdddn#1swxYwY|||jjddddS#1swxYwYdS)NrDrJT)rrMrNrKr)rrEpopr+rrrrrr+rorrr%rr#rirFs   r%test_environ_path_missingz#TestWhich.test_environ_path_missings

*
,
,	6GGFD!!!$$\z,0%22
-
-"2y$(;;
-
-\$),,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
R!4555$$\,0%22
-
-"2y"55
-
-\$),,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
R!4555	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6s>F!B03B
B0BB0 B!B0$F0B4	4F7B4	8A
FEE8EEEEEFE	F"E	##FFFc~tj|j}t	j|j5t	j5}|j|d<tj	|j
d}||dddn#1swxYwYddddS#1swxYwYdS)NrrDr)r+r;r9rorrIrEr&rrr%r1)rrrGrs    r%test_empty_pathzTestWhich.test_empty_paths(7??48,,

!tx
0
0
0	"	"

*
,
,	"03-CKdib111Bb!!!		"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"s5B2;BB2B	B2!B	"B22B69B6ctj5}|ddtj|j}||ddddS#1swxYwYdSrC)rrErUrrr%r1rFs   r%test_empty_path_no_PATHz!TestWhich.test_empty_path_no_PATHs

*
,
,	"GGFD!!!di((Bb!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"sAA&&A*-A*ztest specific to Windowscd}tj|jd|}tj|jtj||j	tj
|j}tj
|d}tj5}||d<tj||j}|||jddddS#1swxYwYdS)N.xyzTmp2r rPATHEXTr)rsrtr"r+rrirr$rrr;rHr`rrErrrrr(temp_filexyzprogramrGrs      r%test_pathextzTestWhich.test_pathexts22t}:@NNN
"DL111*+++'""<#455'""7++A.

*
,
,	4 C	NgDM:::BR!2333	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4s9<DD	Dcd}tj|jd|}||jt
j|j}t
j	|d}tj5}|d|d<tj
||j}|||jddddS#1swxYwYdS)Nr\r]r r;r^r)rsrtr"rrr+r;rHrir`rrErrrr_s      r%test_pathext_with_empty_strz%TestWhich.test_pathext_with_empty_strs!2t}:@NNN*+++'""<#455'""7++A.

*
,
,	4 #YYYC	NgDM:::BR!2333	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4s?C!!C%(C%N)rrrr)r-r/r4r6rr/r:r<r>r+r,rr.rArHrOrSrVrXrZrbrerFr'r%rr3s222
222"""
&
&
&#$#DDD
X08::BB::B666	&	&	&777,666$""""""X02LMM44NM4"X02LMM
4
4NM
4
4
4r'rceZdZdZdS)TestWhichBytesczt|tj|j|_tj|j|_tj|jj|j_tj|j|_tj|j	|_	dSr*)
rr)r+rror%r#rir'r(rs r%r)zTestWhichBytes.setUps};tx((K	**	 k$.*=>>k$+..;tx((r'N)rrrr)rFr'r%rgrgs#)))))r'rgceZdZdZdZdZdZdZdZdZ	e
dZe
d	Zd
Z
e
dZdZe
d
ZdZejejjddZdZdZdZdZeje
dZeje
dZeje
dZ eje
dZ!dZ"dZ#e
dZ$e
dZ%dZ&ej'eje(edoe(e)doe(e)d d!d"Z*d#S)$TestMovecd}||_||_tj|j||_tj|j||_t|jd5}|	dddddS#1swxYwYdS)Nrr4r)
rr=r>r+r;r<r$r2r=r>)rrrXs   r%r)zTestMove.setUps||~~||~~T\8<<
T\8<<

$-
&
&	!
GGG																		sCCCct|d5}|}dddn#1swxYwYtj||t|d5}|||dddn#1swxYwY|tj|dSNr\)	r=r^rmoverrr+r;r)rrzr{real_dstrXcontentss      r%_check_move_filezTestMove._check_move_files)
#t__	 vvxxH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 C
(D
!
!	1QXqvvxx000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1,,-----s266")BBBc@ttj|}tj||||ttj||tj|dSr*)	rbr+rcrrnrrr;r)rrzr{rorps     r%_check_move_dirzTestMove._check_move_dir
sy"*S//**C6"*X*>*>#?#?@@@,,-----r'cR||j|j|jdSr*)rqr$r2rs r%test_move_filezTestMove.test_move_files&dmT]DMJJJJJr'cR||j|j|jdSr*)rqr$r>r2rs r%test_move_file_to_dirzTestMove.test_move_file_to_dirs&dmT\4=IIIIIr'cztj|j}|||j|jdSr*)rorpr$rqr>r2)rrzs  r%"test_move_file_to_dir_pathlike_srcz+TestMove.test_move_file_to_dir_pathlike_srcs5l4=))c4<?????r'cztj|j}||j||jdSr*)rorpr>rqr$r2rr{s  r%"test_move_file_to_dir_pathlike_dstz+TestMove.test_move_file_to_dir_pathlike_dsts5l4<((dmS$-@@@@@r'c.|dSr*)rurs r%test_move_file_other_fsz TestMove.test_move_file_other_fs"s	
r'c.|dSr*)rwrs r%test_move_file_to_dir_other_fsz'TestMove.test_move_file_to_dir_other_fs's	
""$$$$$r'ctj|}	||j||tj|dS#tj|wxYwr)rsrrrsr=rrrr>s  r%
test_move_dirzTestMove.test_move_dir,si/dllnn555	&  w@@@W%%%%%IW%%%%sAA1c.|dSr*)rrs r%test_move_dir_other_fszTestMove.test_move_dir_other_fs4s	
r'c
||j|jtj|jtj|jdSr*)rsr=r>r+r;r<rHrs r%test_move_dir_to_dirzTestMove.test_move_dir_to_dir9sXT\4<GLLrw'7'7'E'EFF	H	H	H	H	Hr'c.|dSr*)rrs r%test_move_dir_to_dir_other_fsz&TestMove.test_move_dir_to_dir_other_fs>s	
!!#####r'c
||jtjjz|jtj|jtj|jdSr*)rsr=r+r;sepr>r<rHrs r%test_move_dir_sep_to_dirz!TestMove.test_move_dir_sep_to_dirCsaT\BGK7GLLrw'7'7'E'EFF	H	H	H	H	Hr'zrequires os.path.altsepc
||jtjjz|jtj|jtj|jdSr*)rsr=r+r;altsepr>r<rHrs r%test_move_dir_altsep_to_dirz$TestMove.test_move_dir_altsep_to_dirGsaT\BGN:DLGLLrw'7'7'E'EFF	H	H	H	H	Hr'ct|jd5	dddn#1swxYwY|tjtj|j|jdS)Nr4)r=r2rrrrnr$r>rs r%"test_existing_file_inside_dest_dirz+TestMove.test_existing_file_inside_dest_dirLs
$-
&
&																	&,T]DLQQQQQs$((ctj|jd}|t
jt
j|j|dSNr)r+r;r<r=rrrrnr{s  r%test_dont_move_dir_in_itselfz%TestMove.test_dont_move_dir_in_itselfRs?gll4<//&,T\3GGGGGr'c	tjt	dD]\}}tjt|}tjt|}|t
j||d|d|d	tj	tdS#tj	twxYw)N))srcdirzsrcdir/dest)_destinsrc() wrongly concluded that dst (z) is not in src ()r)
r+rrr;r<rr
_destinsrcrrr%s   r%test_destinsrc_false_negativez&TestMove.test_destinsrc_false_negativeWs
	%7
I
ISgll63//gll63// 1#s ; ; ;>Acc333"H IIII
I
V$$$$$IV$$$$BB::Cc	tjt	dD]\}}tjt|}tjt|}|t
j||d|d|d	tj	tdS#tj	twxYw)N))rzsrc/dest)rz
srcdir.newrz
) is in src (rr)
r+rrr;r<rrrrrr%s   r%test_destinsrc_false_positivez&TestMove.test_destinsrc_false_positivecs
	%N
D
DSgll63//gll63//  !23!<!<!<9<ccc!C!DDDD
D
V$$$$$IV$$$$rctj|jd}tj|j|t
j||j|	tj
|j|	tj|j|jdSr)r+r;r<r=rr$rrnr2rresamefiler{s  r%test_move_file_symlinkzTestMove.test_move_file_symlinkosgll4<//

4=#&&&C'''t}55666((
FFGGGGGr'cd}tj|j|}tj|j|t
j||jtj|j|}|	tj
||	tj|j|dSr)r+r;r<r=rr$rrnr>rrer)rrr{
final_links    r%test_move_file_symlink_to_dirz&TestMove.test_move_file_symlink_to_dirxsgll4<22

4=#&&&C&&&W\\$,99
z22333((
CCDDDDDr'c<tj|jd}tj|jd}tj||tj|jd}t
j|||tj	||
tj|tj|dSNrrr)r+r;r<r=rr>rrnrrerrealpathrrzr{rVs    r%test_move_dangling_symlinkz#TestMove.test_move_dangling_symlinksgll4<//gll4<//

37<<f55C"""x00111))#..0@0@0J0JKKKKKr'c*tj|jd}tj|jd}tj|tj||tj|jd}tj|||	tj
||	tj||dSr)r+r;r<r=rrr>rrnrrerrs    r%test_move_dir_symlinkzTestMove.test_move_dir_symlinksgll4<//gll4<//





37<<f55C"""x00111((h7788888r'c	tj|j|j}||t
j|jt
j|jdSr*)	rrnr$r>rr+r;r<rHr,s  r%test_move_return_valuezTestMove.test_move_return_valuesg
[
5
5T\27+;+;DM+J+JKK	M	M	M	M	Mr'ctj|jtj|jd}||tj|jddSr)rrnr$r+r;r<r>rr,s  r% test_move_as_rename_return_valuez)TestMove.test_move_as_rename_return_valuesU
[T\5(I(I
J
JRW\\$,>>?????r'cgfd}tj|j|j||tddS)Nc6||fdSr*rrzr{moveds  r%rz7TestMove.test_move_file_special_function.<locals>._copyLL#s$$$$$r'rr)rrnr$r>rrrrrs  @r%test_move_file_special_functionz(TestMove.test_move_file_special_functions^	%	%	%	%	%DM4<uEEEEUQ'''''r'czgfd}tjtj|jdtjtj|jdt
j|j|j||	tddS)Nc6||fdSr*rrs  r%rz6TestMove.test_move_dir_special_function.<locals>._copyrr'childchild1rr)rrr+r;r<r=rrnr>rrrs  @r%test_move_dir_special_functionz'TestMove.test_move_dir_special_functions	%	%	%	%	%#BGLLw$G$GHHH#BGLLx$H$HIIIDL$,eDDDDUQ'''''r'cN||_tjtj|jtj|j}||j|	tj
|j||tj|tj
|dS#tj
|wxYwr*)rr=r+r;r<r9rHupperrrrnrrdrrs  r%test_move_dir_caseinsensitivez&TestMove.test_move_dir_caseinsensitives||~~',,--  ..446688	
DL'222	Kg...OOBGMM'22333HWBHWs
,ADD$rISF_IMMUTABLE	UF_OPAQUEzrequires lchflagsc	tjttjttj|ttj	tt|ttjvtjttj
tjtjtdtjttj|ttj	tt|ttjvtjtr=tjttj
tjttjtr?tjttj
tjtdSdS#tjtr=tjttj
tjttjtr>tjttj
tjtwwxYw)Nr)r+r
TESTFN_SRCrIrrrryrrn
TESTFN_DSTrrcrrrr;r<rrrs r%test_move_dir_permission_deniedz(TestMove.test_move_dir_permission_denieds	-HZ   K
D$5666
ov{J
SSSZ2:<<7888
K
DN333'Z(I(IJJJK
D$5666
ov{J
SSSZ2:<<7888w~~j))
-J777 ,,,w~~j))
-J777 ,,,,,
-
-w~~j))
-J777 ,,,w~~j))
-J777 ,,,,
-s
E8ICLN)+rrrr)rqrsrurwryr|r2r~rrrrrrr+r,r+r;rrrrrrrr*rrrrrrrrrr;rrrrrFr'r%rjrjs(......KKKJJJ@@@
AAA
[%%[%&&&[HHH
$$[$HHHX)BCCHHDCHRRRHHH

%
%
%
%
%
%"HH[#"H"EE[#"E"LL[#"L"99[#"9MMM
@@@(([((([("'XZ008$WT>::8$WT;77,..--	..('
---r'rjceZdZGddeZdZejeddZ	ejeddZ
ejeddZdS)	TestCopyFilec4eZdZdZdZdZddZdZdZdZ	dS)	TestCopyFile.FauxFNTc"||_||_dSr*)_raise_in_exit_suppress_at_exit)r
raise_in_exitsuppress_at_exits   r%__init__zTestCopyFile.Faux.__init__s"/D%5D"""r'cdS)NrrF)rr#s  r%r^zTestCopyFile.Faux.reads2r'cd|_dS)NT)_enteredrs r%	__enter__zTestCopyFile.Faux.__enter__s
 DMMMr'c^|||f|_|jrd|_td|jS)NTCannot close)_exited_withr_raisedr r)rexc_typeexc_valexc_tbs    r%__exit__zTestCopyFile.Faux.__exit__s: ('6 9D"
.#n---))r'r)
rrrrrrrr^rrrFr'r%Fauxrsd	6	6	6	6				!	!	!	*	*	*	*	*r'rcdd}tjtd|5|t5tjdddddn#1swxYwYddddS#1swxYwYdS)Nr]c0|dkrtddS)NsrcfilezCannot open "srcfile"r)rrAs  r%_openz4TestCopyFile.test_w_source_open_fails.<locals>._opens$9$$5666%$r'r=rdestfiler])rrrrr r&)rrs  r%test_w_source_open_failsz%TestCopyFile.test_w_source_open_failss				

vvu
5
5	7	7""7++
7
7	:666
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7s4A5AA5A!	!A5$A!	%A55A9<A9zskipped on macOSc|d	fd	}tjtd|5tjdddddn#1swxYwY|j|jdtu|	jdj
ddS)
Nr]cB|dkrS|dkrtddS)NrrCannot open "destfile"r)rrArs  r%rz2TestCopyFile.test_w_dest_open_fails.<locals>._open	s59$$:%%6777&%r'r=rrrr)rr)rrrrr&rrrr rr#)rrrs  @r%test_w_dest_open_failsz#TestCopyFile.test_w_dest_open_fails	s))++						
vvu
5
5	3	3OIz222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3())),Q/7:;;;-a054	6	6	6	6	6sAA Ac0||dd
fd	}tjtd|5tjdddddn#1swxYwY|j|j|j|jdtu|
jdjd	dS)NTr]c(|dkrS|dkrSdSNrrrFrrArrs  r%rz3TestCopyFile.test_w_dest_close_fails.<locals>._open	+9$$:%%&%r'r=rrrr)rr)rrrrr&rrrrr rr#rrrrs  @@r%test_w_dest_close_failsz$TestCopyFile.test_w_dest_close_fails	sQ))++99T??							
vvu
5
5	3	3OIz222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3())))***())),Q/7:;;;-a05*	,	,	,	,	,sA00A47A4cr|d|dfd	}tjtd|5|t
5tjdddddn#1swxYwYdddn#1swxYwY|j|j|	j
|jddu|j
dS)	NTr]c(|dkrS|dkrSdSrrFrs  r%rz5TestCopyFile.test_w_source_close_fails.<locals>._open4	rr'r=rrrr)rrrrrr r&rrrrrrs  @@r%test_w_source_close_failsz&TestCopyFile.test_w_source_close_fails.	s))D//99;;							
vvu
5
5	7	7""7++
7
7	:666
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	
())))***)***,Q/47888(((((s6B")B?B"B	B"B	B""B&)B&N)rrrobjectrrr+r-r<rrrrFr'r%rrs*****v***$777X_U.//660/6"X_U.//,,0/,(X_U.//))0/)))r'rceZdZdZedZedZdZej	dZ
dZdZdZ
d	Zejejd
kddZd
S)TestCopyFileObji c:tt|jdSr*)rZrFILESIZEclss r%
setUpClasszTestCopyFileObj.setUpClassH	s-----r'cjtjttjtdSr*)rrwrrrs r%
tearDownClasszTestCopyFileObj.tearDownClassL	s*   !!!!!r'c8tjtdSr*rrwrrs r%tearDownzTestCopyFileObj.tearDownQ	!!!!!r'c#Kttd5}ttd5}||fVdddn#1swxYwYddddS#1swxYwYdSNr\r4r=rrr%s   r%	get_fileszTestCopyFileObj.get_filesT	
&$

	!3gt$$
!Cj   
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!3AAAA	AA		AA Act|d5}t|d5}|||dddn#1swxYwYddddS#1swxYwYdSrm)r=rr^)rrzr{fsrcfdsts     r%assert_files_eqzTestCopyFileObj.assert_files_eqZ	s
#t__	;c4
;D  diikk:::
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;s4B;A)B)A-	-B0A-	1BBBc|5\}}tj||dddn#1swxYwY|tt
dSr*)rrcopyfileobjrrrr%s   r%test_contentzTestCopyFileObj.test_content_	s
^^

	)#ssC(((	)	)	)	)	)	)	)	)	)	)	)	)	)	)	)VW-----s
:>>c|5\}}tj||ddddS#1swxYwYdSr*)rrr
r%s   r%test_file_not_closedz$TestCopyFileObj.test_file_not_closedd	s
^^

	"#ssC(((	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"s
;??cD|5\}}tj|||||j|||jddddS#1swxYwYdSr*)rrr
rtellrr%s   r%test_file_offsetz TestCopyFileObj.test_file_offsetj	s
^^

	8#ssC(((SXXZZ777SXXZZ777	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8sA3BBBrMzWindows onlyctjd5}tjt
tdddn#1swxYwY||jdddtj
tjd5}|
ddddn#1swxYwY|j}|t j|tjd5}tj|tdddn#1swxYwY||jdddtj
tjd5}	dddn#1swxYwY|j}|t j|tjd5}tj|tdddn#1swxYwY||tdS)	Nzshutil._copyfileobj_readintorrqiFrnsfoor)r+rrrr&rrr	call_argsrsrtr+rur>rirrrwr)rmrXrs    r%
test_win_implzTestCopyFileObj.test_win_implp	s]
 
 !?
@
@	-AOFG,,,	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
	
Q*O<<<
(RY[[
G
G
G	1
GGFOOO																(%000
]
 
 !?
@
@	,AOE7+++	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,Q*A...
(RY[[
G
G
G	1																(%000
]
 
 !?
@
@	,AOE7+++	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	
UG,,,,,sY AAA%CCCD??EEF&&F*-F*7HH"%H"N)rrrrclassmethodrrr
contextlibcontextmanagerrrrr
rr+r-r+rirrFr'r%rrE	sH..[.""[""""!!!
;;;
...
"""888X_RW_n55--65---r'rceZdZ	dZdZdZedZedZdZ	e
jdZdZ
d	Zd
ZdZdZd
ZdZdZdZdS)_ZeroCopyFileTestir'rctt|jttd5}||_ddddS#1swxYwYdSrm)rZrrr=r^FILEDATA)rrXs  r%rz_ZeroCopyFileTest.setUpClass	s---
&$

	516688CL	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5sAAAc8tjtdSr*)rrwrrs r%rz_ZeroCopyFileTest.tearDownClass	s     r'c8tjtdSr*rrs r%rz_ZeroCopyFileTest.tearDown	rr'c#Kttd5}ttd5}||fVdddn#1swxYwYddddS#1swxYwYdSrrr%s   r%rz_ZeroCopyFileTest.get_files	rrc td)Nzmust be implemented in subclass)r)rr#r$s   r%zerocopy_funz_ZeroCopyFileTest.zerocopy_fun	s!"CDDDr'c||||dSr*)rrrr)rs r%resetz_ZeroCopyFileTest.reset	sB



r'c|5\}}|||dddn#1swxYwY|ttd|j|5\}}tjd5}tj
ttdddn#1swxYwYddddS#1swxYwYdS)NTr@zshutil.copyfileobj)rr rr_rrr+rrrr&r)rrzr{rs    r%test_regular_copyz#_ZeroCopyFileTest.test_regular_copy	s
^^

	(#sc3'''	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(74888$-HHH
^^

	 #s$$%9::
1a000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 sC;??	#C0, CC0C	C0C	 C00C47C4c||j|5\}}|tt
f5|||dddn#1swxYwYdddn#1swxYwY|ttd|j
dS)NTr$)rr"rrr rr rr_rrr%s   r%test_same_filez _ZeroCopyFileTest.test_same_file	s.
###
^^

	,#s""G->#?@@
,
,!!#s+++
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	
6$777GGGGGs5%BA7+B7A;	;B>A;	?BBBc tjtj}|t
5}t
j|ddddn#1swxYwY||j	j
|dS)Nrnew)rsrr+rurrrr&rrr)rrirs   r%test_non_existent_srcz'_ZeroCopyFileTest.test_non_existent_src	s29;;///


0
1
1	)ROD%(((	)	)	)	)	)	)	)	)	)	)	)	)	)	)	).55555sA##A'*A'ctdztdz|fd|fdtd5	dddn#1swxYwYtd5}td5}|||dddn#1swxYwYdddn#1swxYwY|tdd	dS)
Nrzr{c,tjSr*rrw)rxsr%rz3_ZeroCopyFileTest.test_empty_file.<locals>.<lambda>		 0 9 9r'c,tjSr*r-)rysr%rz3_ZeroCopyFileTest.test_empty_file.<locals>.<lambda>	r.r'r4r\Tr$r')rrr=r rr_)rrzr{ryrxs   @@r%test_empty_filez!_ZeroCopyFileTest.test_empty_file	s5.5.9999:::9999:::
'4
 
 																	'4
 
 	,Cgt$$
,!!#s+++
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	
74888#>>>>>sHA%%A),A)CB4(C4B8	8C;B8	<CCCctj|jt5|ttjttddddS#1swxYwYdS)Nr)
r+rr
PATCHPOINTZeroDivisionErrorrrr&rrrs r%test_unhandled_exceptionz*_ZeroCopyFileTest.test_unhandled_exception	s
]
 
 ->!@@	@	@/$ovw
@
@
@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@s2A++A/2A/ctj|jt	t
jd5|5\}}|t5|
||dddn#1swxYwYdddn#1swxYwYddddS#1swxYwYdSNyor)r+rrr2r r"EINVALrrrr r%s   r%test_exception_on_first_callz._ZeroCopyFileTest.test_exception_on_first_call	s]
 
 -4U\4-H-H!JJ	0	0!!
0Zc3&&'89900%%c3///000000000000000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0sYCB,2B	B,BB,BB, C,B0	0C3B0	4CCCcVtj|jt	t
jd5|5\}}|t|j	||dddn#1swxYwYddddS#1swxYwYdSr6)
r+rrr2r r"ENOSPCrrr r%s   r%test_filesystem_fullz&_ZeroCopyFileTest.test_filesystem_full	sA]
 
 -4U\4-H-H!JJ	H	H!!
HZc3!!'4+<c3GGG
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	H	Hs5B&B:BB
	
B
B
	BB"%B"N)rrrrrr2rrrrrrrr r"r%r'r*r0r4r9r<rFr'r%rr	s- HHJ55[5!![!"""!!!
EEE   HHH666???@@@000HHHHHr'rzos.sendfile() not supportedcHeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS)TestZeroCopySendfileos.sendfilec,tj||Sr*)r_fastcopy_sendfile)rrrs   r%r z!TestZeroCopySendfile.zerocopy_fun	s(t444r'ctj|j5}ttd5}|t5|||dddn#1swxYwYtj	||dddn#1swxYwYdddn#1swxYwY|
ttd|jdS)Nr4Tr$)ioBytesIOrr=rrrr rr
rr_r%s   r%test_non_regular_file_srcz.TestZeroCopySendfile.test_non_regular_file_src	s
Z

&
&	-#gt$$
-&&'89900%%c3///000000000000000"3,,,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	
74888$-HHHHHsXB1BA."B.A22B5A26BB1B	B1!B	"B11B58B5cttd5}tj5}|t
5|||dddn#1swxYwYtj|||	d|
||jdddn#1swxYwYddddS#1swxYwYdS)Nr\r)
r=rrCrDrrr rr
seekrr^rr%s   r%test_non_regular_file_dstz.TestZeroCopySendfile.test_non_regular_file_dst
s
&$

	<3
<&&'89900%%c3///000000000000000"3,,,  T];;;
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<sYC.CA(C(A,,C/A,0AC
C.C	C.C	C..C25C2cfd}gtjtjdd|5|5\}}|t5}tj	||dddn#1swxYwYdddn#1swxYwYdddn#1swxYwY|
|jjtj
dS)Ncvsd|i|Sttjd)Nr7)rfr r"EBADF)r#r$r
orig_sendfiles  r%rmzDTestZeroCopySendfile.test_exception_on_second_call.<locals>.sendfile
sD
1D!!!$}d5f555ek4000r'r?T)rMr)r+rmr+rrrrr rrArrr"rK)rrmrzr{rrrLs     @@r%test_exception_on_second_callz2TestZeroCopySendfile.test_exception_on_second_call
s	1	1	1	1	1	1

]
 
 t-5!77	8	8!!
8Zc3&&w//82-c3777888888888888888
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	
+U[99999sYB<B%,BB%BB%BB%B<%B)	)B<,B)	-B<<CCchtjdt5}|5\}}tj||dddn#1swxYwYdddn#1swxYwY|ttd|j
dS)Nos.fstatrTr$)r+rrr rrrArr_rrrrrzr{s    r%test_cant_get_sizez'TestZeroCopySendfile.test_cant_get_size
s]
 
 
 
A
A	 Q!!
 Zc3)#s333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
74888$-HHHHHs4A8A!A8!A%	%A8(A%	)A88A<?A<ctj}d|_tjd|5}|5\}}t
j||dddn#1swxYwYdddn#1swxYwY|ttd|jdS)NirOrLTr$)r+rMockst_sizerrrrArr_rrrrrrzr{s     r%test_small_chunksz&TestZeroCopySendfile.test_small_chunks(
s1
}!!## 
]
 
 $
 
?
?	 1!!
 Zc3)#s333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
74888$-HHHHHs6BB5BB	BB		BBBctj}|jdz|_tjd|5}|5\}}tj||dddn#1swxYwYdddn#1swxYwY|	ttd|jdS)Ni@rOrSTr$)
r+rrTrrUrrrrArr_rrrVs     r%test_big_chunkz#TestZeroCopySendfile.test_big_chunk5
s9
}!!##}(9:
]
 
 $
 
?
?	 1!!
 Zc3)#s333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
74888$-HHHHHs6B $B	=B 	B
	
B B
	B  B$'B$ctjdt5}|tt
jtt|j	dd}|
|tj
ttjtt!tdd|tjtdz|tt
jttdz|j	dd}|
|d	ddddS#1swxYwYdS)
Nr?rrrshelloTr$3i)r+rrr3rrr&rrrrr+r;getsizerrwrCr)rr	blocksizes   r%test_blocksize_argz'TestZeroCopySendfile.test_blocksize_argB
sw
]
 
 ->!@@	1CD/$ovw
@
@
@Aq)I
Y(?(?@@@W%%%w6666OOI,gm<<</$ow#

G
G
GAq)IY000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1sD2E&&E*-E*c	tj|jt	t
jd5}|5\}}|t5tj||dddn#1swxYwYdddn#1swxYwYdddn#1swxYwYtj|j5}tjttdddn#1swxYwYdt_dS#dt_wxYw)Nr7rT)r+rrr2r r"ENOTSOCKrrrrrAr&rr_USE_CP_SENDFILErPs    r%test_file2file_not_supportedz1TestZeroCopySendfile.test_file2file_not_supportedT
s
	+$$O ' = =%??
 BC^^%%<#s**+<==<<1#s;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 $$T_55
$000
$
$
$
$
$
$
$
$
$
$
$
$
$
$
$'+F###dF#****s>D7CB,3B	B,BB,BB, C,B0	0C3B0	4C7D7CD7
C'D72 DD7D""D7%D"&D77EN)
rrrr2r rErHrMrQrWrYr^rbrFr'r%r>r>	sJ555III<<<:::$IIIIIIIII111$+++++r'r>z
macOS onlyceZdZdZdZdS)TestZeroCopyMACOSzposix._fcopyfilecBtj||tjSr*)r_fastcopy_fcopyfileposix_COPYFILE_DATAr%s   r%r zTestZeroCopyMACOS.zerocopy_funn
s)#sE4HIIIr'N)rrrr2r rFr'r%rdrdj
s-#JJJJJJr'rdceZdZdZdZdZejej	e
jdeje
edddZejejdd	Zd
S)TestGetTerminalSizec	tj}||jd||jddS)Nr)rget_terminal_sizercolumnslines)rrUs  r%test_does_not_crashz'TestGetTerminalSize.test_does_not_crashs
sM	
'))a000
A.....r'c	tj5}d|d<|d=tj}dddn#1swxYwY||jdtj5}|d=d|d<tj}dddn#1swxYwY||jddS)N777COLUMNSLINESi	888ix)rrErrlrrmrnrrGrUs   r%test_os_environ_firstz)TestGetTerminalSize.test_os_environ_first}
s=8

*
,
,	."C	NG+--D	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	
s+++

*
,
,	.I CL+--D	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	
S)))))s!=AA6BB"%B"ctj5}d|d<d|d<tj}dddn#1swxYwY||jd||jddS)Nrrryyyrsr)rrErrlrrmrnrus   r%test_bad_environz$TestGetTerminalSize.test_bad_environ
s

*
,
,	."C	N CL+--D	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	
a000
A.....s>AAz
not on ttyrlzneed os.get_terminal_size()c		tjddg}n7#tt
tjf$r|dYnwxYwt|dt|df}tj
5}|d=|d=tj}dddn#1swxYwY|
||dS)NsttyrUzstty invocation failedrrrsrr)rrrrrryrrrrrErrlr)rrUrrGr?s     r%test_stty_matchz#TestGetTerminalSize.test_stty_match
s7		4*FF+;<<CCEEKKMMDD!?-/	4	4	4MM233333	4QLL#d1g,,/

*
,
,	0GI-//F	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	
6*****s!:>1A21A22CCCzWASI has no /dev/nullctj5}|d=|d=tjtdd5tjd}dddn#1swxYwY||jd||j	dttjdd	
5}tjtd|5tjd}dddn#1swxYwYdddn#1swxYwY||jd||j	d
ddddS#1swxYwYdS)Nrsrr
__stdout__)
)fallbackrrr5r6r7)(rr)
rrErrrrrlrrmrnr=r+devnull)rrGrUrXs    r%
test_fallbackz!TestGetTerminalSize.test_fallback
s{

*
,
,	-GI"3d;;
C
C/BBB
C
C
C
C
C
C
C
C
C
C
C
C
C
C
CT\2...TZ,,,bj#888
CA"3a88
C
C/BBB
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
T\2...TZ,,,!	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-s}"EAEA	EA	 AE5D
C3'D
3C77D
:C7;D
>E
D	ED	9EEEN)rrrrorvryr+r,r+isattyrr~rvrrr|r-ris_wasirrFr'r%rjrjr
s///
*
*
*///X3>#8#8#:#:;;\JJX%899688++88KJ+*X_W_&=>>--?>---r'rjceZdZ	dZdS)PublicAPITestscF|ttdgd}ttdstjdkr|d|ttjt|dS)N__all__)r
r&rrr	rr:rnrrr.	ExecErrorrrrrrr	rrrcrrrlr
statvfsrMr)	rrrrr+rirfrrkr)r
target_apis  r%test_module_all_attributez(PublicAPITests.test_module_all_attribute
s	22333<<<
2y!!	,RW__l+++V^,,c*oo>>>>>r'N)rrrrrFr'r%rr
s&H?????r'r__main__)F)Vr+
unittest.mockrrsrrr+os.pathr"r0rorrKrMrrCrrrrrrr	r
rrr
rrLrtrgImportErrorrrtest.supportrtest.support.os_helperrrrrrrr.rRr<r=rrrrrrrAssertionErrorrJr&r2rCrZr_rgr~SUPPORTS_SENDFILErrTestCaserr2rr?rrrgrjrrrrr-r>rdrjrrmainrFr'r%<module>rs







				







				6666666666666666666666666666LLLLEEE""""""33333333((((((
3,
f_

f_
))

,
!
!'
*
*	l2A2%JJJJJJOOOOONNNNGGG=z"N#>??AALLL			)))$


&&&:0/11								W6W6W6W6W68,W6W6W6t`2`2`2`2`28X.`2`2`2D@?@?@?@?@?x*@?@?@?Ff8f8f8f8f88X.f8f8f8R
M+M+M+M+M+x*M+M+M+`w4w4w4w4w4(+w4w4w4t)))))Y)))o-o-o-o-o-x*o-o-o-dY)Y)Y)Y)Y)8$Y)Y)Y)xG-G-G-G-G-h'G-G-G-TaHaHaHaHaHaHaHaHH&&(EFFs+s+s+s+s+,h.?s+s+GFs+lUL))JJJJJ)8+<JJ*)JL-L-L-L-L-(+L-L-L-^?????X&???$zHMOOOOOs6&A++A54A5)
C44C>=C>DDD