+
    BiS4                       ^ RI t ^ RIt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtHtHtHtHtHtHtHtHtHt ^ RIt^ RIt ^ RIt^ RIH t  ^ RI!H"t" ^ RI#H$t$H%t% ]$R,           t&]$R,           t']$R,           t(]PR                  PU                  R	4      t+]PR                  PU                  R
4      t,]PR                  R,          R8H  t- ^ RI.t.^ RI/t/Rt0 ^ RI1t1] Pd                  Pg                  R]4! R4      R7      t5R t6R t7RCR lt8R t9RDR lt:R t;R t<]<! 4       t=R t> ! R R4      t? ! R R]?] P                  4      tA ! R R]?] P                  4      tB ! R  R!]?] P                  4      tC ! R" R#]?] P                  4      tD ! R$ R%]?] P                  4      tE] P                  ! 4        ! R& R']?] P                  4      4       tG ! R( R)]G4      tH ! R* R+]?] P                  4      tI ! R, R-] P                  4      tJ ! R. R/] P                  4      tK ! R0 R1]L4      tM ! R2 R3]M4      tN] P                  ! ]='       * R44      ] Pd                  Pf                  P                  ]R5R4       ! R6 R7]N] P                  4      4       4       tP] P                  ! ]P                  R84       ! R9 R:]N] P                  4      4       tS] P                  ! ]+'       * R;4       ! R< R=]M] P                  4      4       tT ! R> R?] P                  4      tU ! R@ RA] P                  4      tV]WRB8X  d   ] P                  ! 4        R# R#   ] d    Rt ELi ; i  ] d    Rt0 ELri ; i  ] d    Rt1 EL}i ; i)E    N)make_archiveregister_archive_formatunregister_archive_formatget_archive_formatsErrorunpack_archiveregister_unpack_formatRegistryErrorunregister_unpack_formatget_unpack_formatsSameFileError_GiveupOnFastCopy)support)	os_helper)TESTFNFakePath2_SRC_DSTdarwinsunos:N   NaixTFzos.chdirzshouldn't call os.chdir()side_effectc                  8    \        \        \        R ^4      R4      h)EXDEVzInvalid cross-device link)OSErrorgetattrerrno)argskwargss   *,'/usr/lib/python3.14/test/test_shutil.py_fake_renamer$   8   s    
'%"-/J
KK    c                 F   a  \         P                  ! S 4      V 3R  l4       pV# )c                     <  \         P                  p\        \         n        S! V / VB V\         n        #   X\         n        i ; iN)osrenamer$   )r!   r"   builtin_renamefuncs   *, r#   wrapmock_rename.<locals>.wrap=   s4    	'YYN$BI((&BIBIs	   &5 A)	functoolswraps)r,   r-   s   f r#   mock_renamer1   <   s%    __T' ' Kr%   c                >   \        V \        4      '       d   \        P                  P                  ! V !  p \        V\
        4      '       d   VP                  4       p\        V R4      ;_uu_ 4       pVP                  V4       RRR4       R#   + '       g   i     R# ; i)zWrite *content* to a file located at *path*.

If *path* is a tuple instead of a string, os.path.join will be used to
make a path.
xbN)	
isinstancetupler)   pathjoinstrencodeopenwrite)r6   contentfps   && r#   create_filer>   G   sf     $ww||T"'3.."	dD		R
 
			s   /BB	c                   R p\        VR4      pRP                  \        V4       Uu. uF5  p\        P                  ! \
        P                  4      P                  4       NK7  	  up4      p\        V R4      ;_uu_ 4       pV! W4       F  pVP                  V4       K  	  RRR4       R# u upi   + '       g   i     R# ; i)zBCreate a test file with an arbitrary size and random text content.c              3   R   "   W8  d   Vx  W,          p K  V '       d   V x  R # R # 5ir(    )totalsteps   &&r#   chunkswrite_test_file.<locals>.chunksV   s#     lJMEK s   ''i    r%   wbN)
minr7   rangerandomchoicestringascii_lettersr9   r:   r;   )r6   sizerD   bufsizeichunkfcsizes   &&      r#   write_test_filerS   T   s     $oGHH$W~/-! mmF$8$89@@B-/ 0E	dD		QD*EGGEN + 
	/			s   ;B)>!B..B?	c                "   \        V \        4      '       d   \        P                  P                  ! V !  p V'       d   RMRpV'       d   RMRp\        WVR7      ;_uu_ 4       pVP                  4       uuRRR4       #   + '       g   i     R# ; i)zReturn contents from a file located at *path*.

If *path* is a tuple instead of a string, os.path.join will be used to
make a path.  If *binary* is true, the file will be opened in binary
mode.
rbrNutf-8encoding)r4   r5   r)   r6   r7   r:   read)r6   binarymoderY   r=   s   &&   r#   	read_filer]   f   s\     $ww||T"4sDt7H	d8	,	,wwy 
-	,	,	,s   "A==B	c                    . p\        \        P                  ! V 4      4       F  p\        P                  P	                  W4      p\        P                  P                  V4      '       dq   \        P                  P                  V4      '       gL   VP                  VR ,           4       \        V4       F"  pVP                  VR ,           V,           4       K$  	  K  VP                  V4       K  	  V# )/)	sortedr)   listdirr6   r7   isdirislinkappendrlistdir)r6   resnamepns   &    r#   re   re   t   s    
Crzz$'(GGLL$77==BGGNN1$5$5JJtcz"a[

4#:>* ! JJt ) Jr%   c            
         \        \        R 4      '       g   R# Rp Rp \        P                  ! R\        P                  ! 4       RR7      ;_uu_ 4       pVP
                  p VP                  R4       RRR4       \        V R4      ;_uu_ 4       p\        P                  ! R\        P                  ! 4       RR7      ;_uu_ 4       pVP
                  pVP                  4       pVP                  4       p \        P                  ! We^ ^4        RRR4       RRR4       V e   \        P                  ! V 4       Ve   \        P                  ! V4       R# R#   + '       g   i     L; i  \         dK     RRR4       RRR4       T e   \        P                  ! T 4       Te   \        P                  ! T4       R# R# i ; i  + '       g   i     M; i RRR4       M  + '       g   i     M; iT e   \        P                  ! T 4       Te   \        P                  ! T4       R# R#   T e   \        P                  ! T 4       Te   \        P                  ! T4       i i ; i)sendfileFNrF   dirdeletes
   0123456789rU   T)hasattrr)   tempfileNamedTemporaryFilegetcwdrg   r;   r:   filenork   r   unlinkr   )srcnamedstnamerQ   srcdstinfdoutfds          r#   supports_file2file_sendfiler{      s   2z""GG&((299;uMMQRffGGGM" N '4  C,,Tryy{5QQUX((zz|

 KKQ2   R ! W%W% % NM  !  R ! W%W% ! RQQ !    W%W%  W%W% s   4H# E0H# 5G-F;	/E#F;	GH# E 	H# #F8.F;	/G7H# H# 7F88F;	;GG	H# G(	#H# #7Ic                     \         '       d}   \        P                  R 8X  dh   \        P                  ! R\        P
                  ,          4      p V P                  R4      R,          P                  4       ^,          p\        V^4      R8  # R# )iz/usr/bin/dump -o %s
i    T)AIXsysmaxsize
subprocess	getoutput
executablesplitint)hdrsmaxdatas     r#   
_maxdataOKr      sa    
ss{{j(!!"7#.."HI

4 $**,Q/72*,,r%   c                   *   a  ] tR t^t o RR ltRtV tR# )BaseTestNc                    \         P                  ! V\        P                  ! 4       R7      pV P	                  \
        P                  V4       V# )zZCreate a temporary directory that will be cleaned up.

Returns the path of the directory.
)prefixrm   )rp   mkdtempr)   rr   
addCleanupr   rmtree)selfr   ds   && r#   r   BaseTest.mkdtemp   s5    
 F		<	((!,r%   rA   r(   )__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r#   r   r      s      r%   r   c                     a  ] tR t^t o R t]P                  R 4       t]P                  R 4       t]P                  R 4       t	]
P                  ! ]R4      R 4       t]
P                  ! ]R4      R 4       t]
P                  ! ]R4      R 4       tR	 tR
 tR t]
P&                  ! ]P*                  R,          R8H  R4      ]P,                  ]P.                  R 4       4       4       tR t]
P&                  ! ]P*                  R,          R8H  R4      ]P,                  ]P.                  R 4       4       4       tR t]
P&                  ! ]P*                  R,          R8H  R4      ]P,                  ]P.                  R 4       4       4       tR tR t]
P                  ! ]P@                  PB                  R4      R 4       t"]
P                  ! ]P@                  PB                  R4      R 4       t#]
P&                  ! ]P@                  PB                  R4      R 4       t$R t%]P                  R 4       t&]
P                  ! ]R4      R 4       t']
P                  ! ](! ])R4      R 4      ]
P&                  ! ]P*                  R!8H  R"4      R# 4       4       t*]
P&                  ! ]P*                  R,          R8H  R4      ]P,                  ]P.                  R$ 4       4       4       t+R% t,R&t-V t.R'# )(
TestRmTreec                j   V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        \        P                  P                  VR4      R4       \        P                  ! V4      pV P                  V\        4       \        P                  ! V4       R# )killmesomefilefooN)r   r)   r6   r7   mkdirr>   fsencodeassertIsInstancebytesshutilr   )r   tmpvictims   &  r#   test_rmtree_works_on_bytes%TestRmTree.test_rmtree_works_on_bytes   sp    llnc8,
BGGLL4e<V$fe,fr%   c                |  a V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        P                  P                  VR4      p\        P
                  ! W#4       V P                  \        \        P                  V4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       . oV3R lp\        P                  ! W4R7       V P                  \        S4      ^4       V P                  S^ ,          ^ ,          \        P                  P                   4       V P                  S^ ,          ^,          V4       V P#                  S^ ,          ^,          ^,          \        4       R# )rm   linkc                  *   < SP                  V 4       R # r(   rd   r!   errorss   *r#   onerror@TestRmTree.test_rmtree_fails_on_symlink_onerror.<locals>.onerror       MM$r%   r   Nr   r)   r6   r7   r   symlinkassertRaisesr   r   r   
assertTrueexistslexistsassertEquallenassertIsrc   r   r   r   dir_r   r   r   s   &    @r#   $test_rmtree_fails_on_symlink_onerror/TestRmTree.test_rmtree_fails_on_symlink_onerror   s   llnww||C'
ww||C(


4'6==$7t,--.	 d,Va(fQilBGGNN31t,fQil1ow7r%   c                n  a V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        P                  P                  VR4      p\        P
                  ! W#4       V P                  \        \        P                  V4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       . oV3R lp\        P                  ! W4R7       V P                  \        S4      ^4       V P                  S^ ,          ^ ,          \        P                  P                   4       V P                  S^ ,          ^,          V4       V P#                  S^ ,          ^,          \        4       R# )rm   r   c                  *   < SP                  V 4       R # r(   r   r   s   *r#   onexc<TestRmTree.test_rmtree_fails_on_symlink_onexc.<locals>.onexc   r   r%   r   Nr   r   r   r   r   r   r   s   &    @r#   "test_rmtree_fails_on_symlink_onexc-TestRmTree.test_rmtree_fails_on_symlink_onexc   s   llnww||C'
ww||C(


4'6==$7t,--.	 d(Va(fQilBGGNN31t,fQilG4r%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      pW#V3 F  p\        P                  ! V4       K  	  \        P                  P                  VR4      p\        VR4       \        P                  P                  VR4      p\        P                  ! W74       \        P                  P                  VR4      p\        P                  ! WH4       \        P                  P                  VR4      p	\        P                  ! Wi4       \        P                  ! V4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       R# 	dir1dir2dir3file1r   link1link2link3N)r   r)   r6   r7   r   r>   r   r   r   assertFalser   r   
r   r   r   r   r   r   r   r   r   r   s
   &         r#   test_rmtree_works_on_symlinks(TestRmTree.test_rmtree_works_on_symlinks   s:   llnww||C(ww||D&)ww||C(T!AHHQK "S'*E5!T7+


4T7+


4T7+


5 d-.t,-u-.r%   zonly relevant on Windowsc                  a V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        P                  P                  VR4      p\
        P                  ! W#4       V P                  \        P                  V4       V P                  \        \        P                  V4       V P                  \        P                  P                  V4      4       V P                  \        P                  P!                  V4      4       . oV3R lp\        P                  ! W4R7       V P#                  \%        S4      ^4       V P'                  S^ ,          ^ ,          \        P                  P(                  4       V P#                  S^ ,          ^,          V4       V P+                  S^ ,          ^,          ^,          \        4       R# )rm   r   c                  *   < SP                  V 4       R # r(   r   r   s   *r#   r   BTestRmTree.test_rmtree_fails_on_junctions_onerror.<locals>.onerror  r   r%   r   Nr   r)   r6   r7   r   _winapiCreateJunctionr   r   rt   r   r   r   r   r   r   r   r   r   r   rc   r   r   s   &    @r#   &test_rmtree_fails_on_junctions_onerror1TestRmTree.test_rmtree_fails_on_junctions_onerror   s'   llnww||C'
ww||C(t*	(($/'6==$7t,--.	 d,Va(fQilBGGNN31t,fQil1ow7r%   c                  a V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        P                  P                  VR4      p\
        P                  ! W#4       V P                  \        P                  V4       V P                  \        \        P                  V4       V P                  \        P                  P                  V4      4       V P                  \        P                  P!                  V4      4       . oV3R lp\        P                  ! W4R7       V P#                  \%        S4      ^4       V P'                  S^ ,          ^ ,          \        P                  P(                  4       V P#                  S^ ,          ^,          V4       V P+                  S^ ,          ^,          \        4       R# )rm   r   c                  *   < SP                  V 4       R # r(   r   r   s   *r#   r   >TestRmTree.test_rmtree_fails_on_junctions_onexc.<locals>.onexc  r   r%   r   Nr   r   s   &    @r#   $test_rmtree_fails_on_junctions_onexc/TestRmTree.test_rmtree_fails_on_junctions_onexc  s#   llnww||C'
ww||C(t*	(($/'6==$7t,--.	 d(Va(fQilBGGNN31t,fQilG4r%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      pW#V3 F  p\        P                  ! V4       K  	  \        P                  P                  VR4      p\        VR4       \        P                  P                  VR4      p\        P                  ! W74       \        P                  P                  VR4      p\        P                  ! WH4       \        P                  P                  VR4      p	\        P                  ! Wi4       \        P                  ! V4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       R# r   )r   r)   r6   r7   r   r>   r   r   r   r   r   r   r   r   s
   &         r#   test_rmtree_works_on_junctions)TestRmTree.test_rmtree_works_on_junctions'  s@   llnww||C(ww||D&)ww||C(T!AHHQK "S'*E5!T7+t+T7+t+T7+u,d-.t,-u-.r%   c                <   \         P                  ! V P                  4       R 7      pV P                  \        \
        P                  V4       \
        P                  ! VRR7       V P                  4       p\        P                  P                  VR4      p\        V4       V P                  \        4      ;_uu_ 4       p\
        P                  ! V4       RRR4       V P                  XP                  P                  V4       V P                  \        P                  P!                  V4      4       \
        P                  ! VRR7       V P                  \        P                  P!                  V4      4       V P                  \"        \
        P                  R4       V P                  \"        \
        P                  RRR7       \
        P                  P$                  '       d   \"        M\&        pV P                  V4      ;_uu_ 4        \
        P                  ! VRR7       RRR4       V P                  V4      ;_uu_ 4        \
        P                  ! VRRR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     La; i  + '       g   i     R# ; i)rm   Tignore_errorststfileNinvaliddir_fd)r   r   )rp   mktempr   r   FileNotFoundErrorr   r   r)   r6   r7   r>   NotADirectoryErrorr   	exceptionfilenamer   r   	TypeErroravoids_symlink_attacksNotImplementedError)r   r   tmpdircmexcs   &    r#   test_rmtree_errorsTestRmTree.test_rmtree_errors=  s   ??t||~6+V]]HEhd3 77<<	2H122bMM(# 3..9x01hd3x01)V]]D9)V]]DM!==???iEXs##MM(95 $s##MM(9DI $# 322 $####s$   ;I#I7?J
#I4	7J	
J	c                  a V P                  4       p\        P                  P                  VR 4      p\	        V4       . oV3R lp\
        P                  ! W#R7       V P                  \        S4      ^4       V P                  S^ ,          ^ ,          \        P                  4       V P                  S^ ,          ^,          V4       V P                  S^ ,          ^,          ^,          \        4       V P                  S^ ,          ^,          ^,          P                  V4       V P                  S^,          ^ ,          \        P                  4       V P                  S^,          ^,          V4       V P                  S^,          ^,          ^,          \        4       V P                  S^,          ^,          ^,          P                  V4       R# )r   c                  *   < SP                  V 4       R # r(   r   r   s   *r#   r   6TestRmTree.test_rmtree_errors_onerror.<locals>.onerror]  r   r%   r   Nr   r)   r6   r7   r>   r   r   r   r   r   scandirr   r   r   rmdir)r   r   r   r   r   s   &   @r#   test_rmtree_errors_onerror%TestRmTree.test_rmtree_errors_onerrorX  s6   77<<	2H	 h0Va(fQilBJJ/1x0fQil1o/AB1a118<fQilBHH-1x0fQil1o/AB1a118<r%   c                b  a V P                  4       p\        P                  P                  VR 4      p\	        V4       . oV3R lp\
        P                  ! W#R7       V P                  \        S4      ^4       V P                  S^ ,          ^ ,          \        P                  4       V P                  S^ ,          ^,          V4       V P                  S^ ,          ^,          \        4       V P                  S^ ,          ^,          P                  V4       V P                  S^,          ^ ,          \        P                  4       V P                  S^,          ^,          V4       V P                  S^,          ^,          \        4       V P                  S^,          ^,          P                  V4       R# )r   c                  *   < SP                  V 4       R # r(   r   r   s   *r#   r   2TestRmTree.test_rmtree_errors_onexc.<locals>.onexco  r   r%   r   Nr   )r   r   r   r   r   s   &   @r#   test_rmtree_errors_onexc#TestRmTree.test_rmtree_errors_onexcj  s&   77<<	2H	 h,Va(fQilBJJ/1x0fQil,>?1..9fQilBHH-1x0fQil,>?1..9r%   :N   Ncygwinz2This test can't be run on Cygwin (issue #1071513).c                $   ^ V n         \        P                  ! \        4       V P	                  \
        P                  \        4       \        P                  P                  \        R4      V n	        \        P                  P                  \        R4      V n
        \        P                  ! V P                  4       \        P                  ! V P                  4       \        P                  ! \        4      P                  p\        P                  ! V P                  4      P                  p\        P                  ! V P                  4      P                  p\        P                  \        P                   ,          p\        P"                  ! V P                  V4       \        P"                  ! V P                  V4       \        P"                  ! \        V4       V P	                  \        P"                  \        V4       V P	                  \        P"                  V P                  V4       V P	                  \        P"                  V P                  V4       \
        P                  ! \        V P$                  R7       V P'                  V P                   ^R4       R# )r   abr   z1Expected call to onerror function did not happen.N)
errorStater)   r   r   r   r   r   r6   r7   child_file_pathchild_dir_pathr   create_empty_filestatst_modeS_IREADS_IEXECchmodcheck_args_to_onerrorr   r   old_dir_modeold_child_file_modeold_child_dir_modenew_modes   &    r#   test_on_errorTestRmTree.test_on_error|  s   
 
v.!ww||FC8 ggll637##D$8$89
$$%wwv.. ggd&:&:;CCWWT%8%89AA<<,
%%x0
$$h/
"&,7$"6"68KL$"5"57IJfd&@&@A!L	Nr%   c                   V P                   ^8  d   V\        P                  J d   V P                  W P                  4       MrV\        P
                  J d   V P                  W P                  4       MBV P                  V\        P                  4       V P                  V\        V P                  .4       V P                  V^ ,          \        4       V ;P                   ^,          un         R# V P                  V\        P
                  4       V P                  V\        4       V P                  V^ ,          \        4       ^V n         R#    N)r  r)   rt   r   r  r  r  r   ra   assertInr   assertIsSubclassr   r   r,   argr   s   &&&&r#   r   TestRmTree.check_args_to_onerror  s     ??Qryy   &:&:;!  &9&9:dBJJ/cFD,?,?#@A!!#a&'2OOq OT288,S&)!!#a&'2DOr%   c                $   ^ V n         \        P                  ! \        4       V P	                  \
        P                  \        4       \        P                  P                  \        R4      V n	        \        P                  P                  \        R4      V n
        \        P                  ! V P                  4       \        P                  ! V P                  4       \        P                  ! \        4      P                  p\        P                  ! V P                  4      P                  p\        P                  ! V P                  4      P                  p\        P                  \        P                   ,          p\        P"                  ! V P                  V4       \        P"                  ! V P                  V4       \        P"                  ! \        V4       V P	                  \        P"                  \        V4       V P	                  \        P"                  V P                  V4       V P	                  \        P"                  V P                  V4       \
        P                  ! \        V P$                  R7       V P'                  V P                   ^R4       R# )r   r  r  r   z/Expected call to onexc function did not happen.N)r  r)   r   r   r   r   r   r6   r7   r  r  r   r  r  r  r  r  r  check_args_to_onexcr   r  s   &    r#   test_on_excTestRmTree.test_on_exc  s   
 
v.!ww||FC8 ggll637##D$8$89
$$%wwv.. ggd&:&:;CCWWT%8%89AA<<,
%%x0
$$h/
"&,7$"6"68KL$"5"57IJfD$<$<=!J	Lr%   c                   V P                   ^8  d   V\        P                  J d   V P                  W P                  4       MrV\        P
                  J d   V P                  W P                  4       MBV P                  V\        P                  4       V P                  V\        V P                  .4       V P                  \        V\        4      4       V ;P                   ^,          un         R# V P                  V\        P
                  4       V P                  V\        4       V P                  \        V\        4      4       ^V n         R# r   )r  r)   rt   r   r  r  r  r   ra   r"  r   r   r4   r   r$  s   &&&&r#   r(  TestRmTree.check_args_to_onexc  s     ??Qryy   &:&:;!  &9&9:dBJJ/cFD,?,?#@AOOJsG45OOq OT288,S&)OOJsG45DOr%   c                0  aa R oR oV3R lpV3R lp\         P                  ! \        4       V P                  \        P
                  \        4       \         P                  P                  \        R4      V n        \         P                  P                  \        R4      V n	        \        P                  ! V P                  4       \         P                  ! V P                  4       \         P                  ! \        4      P                  p\         P                  ! V P                  4      P                  p\         P                  ! V P                  4      P                  p\        P                  \        P                  ,          p\         P                   ! V P                  V4       \         P                   ! V P                  V4       \         P                   ! \        V4       V P                  \         P                   \        V4       V P                  \         P                   V P                  V4       V P                  \         P                   V P                  V4       \        P
                  ! \        WR7       V P#                  S4       V P%                  S4       R# )Fc                     < R oR# TNrA   )r!   onerror_calleds   *r#   r   7TestRmTree.test_both_onerror_and_onexc.<locals>.onerror  s    !Nr%   c                     < R oR# r/  rA   )r!   onexc_calleds   *r#   r   5TestRmTree.test_both_onerror_and_onexc.<locals>.onexc  s    Lr%   r  r  )r   r   N)r)   r   r   r   r   r   r6   r7   r  r  r   r  r  r  r  r  r  r   r   )	r   r   r   r  r  r  r  r0  r3  s	   &      @@r#   test_both_onerror_and_onexc&TestRmTree.test_both_onerror_and_onexc  s   
 	"	  	v.!ww||FC8 ggll637##D$8$89
$$%wwv.. ggd&:&:;CCWWT%8%89AA<<,
%%x0
$$h/
"&,7$"6"68KL$"5"57IJfg;%(r%   c                  a  \         P                  oV3R  lpV\         n        \         P                  ! \        4       \	        \        R3R4       \
        P                  ! \        4       S\         n        R#   S\         n        i ; i)c                 >   < V \         8w  d   \        4       hS! V 4      # r(   )r   r   )fnr!   r"   
orig_lstats   &*,r#   raiserFTestRmTree.test_rmtree_does_not_choke_on_failing_lstat.<locals>.raiser  s    <!)O%b>)r%   r   N)r)   lstatr   r   r>   r   r   )r   r;  r:  s   & @r#   +test_rmtree_does_not_choke_on_failing_lstat6TestRmTree.test_rmtree_does_not_choke_on_failing_lstat  sT    	"J*
 BHHHV/MM&!!BHzBHs   A'A7 7Bc                h  a \         P                  \         P                  \         P                  \         P                  0\         P
                  8*  ;'       dK    \         P                  \         P                  9   ;'       d"    \         P                  \         P                  9   pV'       d   V P                  \        P                  P                  4       V P                  4       p\         P                  P                  VR 4      p\         P                   ! V4        \         P                  p ! R R\"        4      oV3R lpV\         n        V P%                  S\        P                  V4       V\         n        R# V P'                  \        P                  P                  4       R#   X\         n        i ; i)r  c                       ] tR tRtRtR# )HTestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>.Calledi4  rA   N)r   r   r   r   r   rA   r%   r#   CalledrB  4  s    r%   rC  c                     < Shr(   rA   )r!   r"   rC  s   *,r#   _raiserITestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>._raiser5  s     Lr%   N)r)   r:   r  rt   r  supports_dir_fdra   supports_fdsupports_follow_symlinksr   r   r   r   r   r6   r7   r   	Exceptionr   r   )r   _use_fd_functionstmp_dirr   	real_openrE  rC  s   &     @r#   -test_rmtree_uses_safe_fd_version_if_available8TestRmTree.test_rmtree_uses_safe_fd_version_if_available(  s    ggrww		288D//0 D DZZ2>>9D D  WW(C(CC 	 OOFMM@@AllnGWc*AHHQK$GG	-Y-!!!!&&--;#V]]AAB $s   AF$ $F1zrequires safe rmtreec           	       aaa V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        P                  P                  VR4      p\        P                  ! V4       VV3R lp^ o\
        P                  ! \        RV4      ;_uu_ 4       oV P                  \        4      ;_uu_ 4        \        P                  ! V4       RRR4       RRR4       V P                  \        P                  P                  V4      4       V P                  S^4       ^ o. oV3R lp\
        P                  ! \        RV4      ;_uu_ 4       o\        P                  ! W%R7       RRR4       V P                  \        S4      ^4       V P                  S^ ,          ^ ,          V4       V P                  S^ ,          ^,          V4       V P                  S^,          ^ ,          V4       V P                  S^,          ^,          V4       V P                  S^4       R#   + '       g   i     ELV; i  + '       g   i     ELb; i  + '       g   i     L; i)r   r   c                 2   < S! V 4       S^,          o\         h)   r   )fdclose_count
orig_closes   &r#   close4TestRmTree.test_rmtree_fails_on_close.<locals>.closeG  s    rN1KMr%   rW  Nc                  *   < SP                  V 4       R # r(   r   r   s   *r#   r   4TestRmTree.test_rmtree_fails_on_close.<locals>.onexcV  r   r%   r   )r   r)   r6   r7   r   r   	swap_attrr   r   r   r   r   rb   r   r   r   )	r   r   r   r   rW  r   rU  r   rV  s	   &     @@@r#   test_rmtree_fails_on_close%TestRmTree.test_rmtree_fails_on_close>  s    llnww||C(
ww||D&)
	 r7E22j""7++d# , 3 	d+,a(	 r7E22jMM$, 3Va(fQilE*1t,fQilE*1t,a(! ,++ 322 32s0   -IH/	"I I/I :	II	I'	zdir_fd is not supportedc                   V P                  4       pR p\        P                  P                  W4      p\        P                  ! V\        P
                  4      pV P                  \        P                  V4       \        P                  ! V4       \        P                  ! \        P                  P                  VR4      4       \        \        P                  P                  VRR4      R4       V P                  \        P                  P                  V4      4       \        P                  ! W$R7       V P                  \        P                  P                  V4      4       R# )r   subdirr   r   r   N)r   r)   r6   r7   r:   O_RDONLYr   rW  r   r>   r   r   r   r   r   )r   rL  r   fullnamer   s   &    r#   test_rmtree_with_dir_fd"TestRmTree.test_rmtree_with_dir_fda  s    ,,.77<<0"++.&)

h12BGGLL8Z@%Hx01f,12r%   zdir_fd is supportedc                $   V P                  4       pV P                  \        4      ;_uu_ 4        \        P                  ! V^ R7       RRR4       V P                  \        P                  P                  V4      4       R#   + '       g   i     L@; i)r   r   N)	r   r   r   r   r   r   r)   r6   r   )r   rL  s   & r#   #test_rmtree_with_dir_fd_unsupported.TestRmTree.test_rmtree_with_dir_fd_unsupportedo  sT    ,,.233MM'!, 4w/0 43s   A??B	c                    \         P                  ! V P                  4       R 7      w  r\        P                  ! V4       V P                  \        \        P                  V4       \        P                  ! V4       R# r   N)
rp   mkstempr   r)   rW  r   r   r   r   remove)r   handler6   s   &  r#   test_rmtree_dont_delete_file'TestRmTree.test_rmtree_dont_delete_filev  sH    ''DLLN;
,fmmTB
		$r%   c                   \         P                  ! \        4        \         P                  P	                  \        R 4      p\         P                  P	                  \        R4      p\         P                  ! V4       \         P
                  ! W4       V P                  \        \        P                  V4       \        P                  ! VRR7       \        P                  ! \        RR7       R#   \        P                  ! \        RR7       i ; i)cheeseshopTr   N)
r)   r   r   r6   r7   r   r   r   r   r   r   rw   rx   s   &  r#   test_rmtree_on_symlink!TestRmTree.test_rmtree_on_symlink}  s     		6'',,vx0C'',,vv.CHHSMJJs gv}}c:MM#T2MM&5FMM&5s   B1C+ +D	c                j   \         P                  ! \        4        \         P                  P	                  \        R 4      p\         P                  P	                  \        R4      p\         P                  ! V4       \        \         P                  P	                  VR4      4       \        P                  ! W4       V P                  \        \        P                  V4       \        P                  ! VRR7       \        P                  ! \        RR7       R#   \        P                  ! \        RR7       i ; i)ro  rp  spamTr   N)r)   r   r   r6   r7   r>   r   r   r   r   r   r   rq  s   &  r#   test_rmtree_on_junction"TestRmTree.test_rmtree_on_junction  s    
		6'',,vx0C'',,vv.CHHSMS&12""3,gv}}c:MM#T2MM&5FMM&5s   CD D2mkfiforequires os.mkfifo()vxworks%fifo requires special path on VxWorksc                   \         P                  ! \        4        V P                  \        4      ;_uu_ 4        \
        P                  ! \        4       R R R 4       V P                  \         P                  P                  \        4      4       \         P                  ! \        4       \         P                  ! \        4       \         P                  ! \         P                  P                  \        R4      4       \
        P                  ! \        4       V P                  \         P                  P                  \        4      4       R #   + '       g   i     L; i  \         P                  ! \        4       i ; i)Nmypipe)r)   rx  r   r   r   r   r   r   r6   r   rt   r   r7   r   r   s   &r#   test_rmtree_on_named_pipe$TestRmTree.test_rmtree_on_named_pipe  s     			&	""#566f% 7OOBGGNN623IIf

		"'',,vx01f/0 76 IIfs"   E E:E E	E E7c           	     z  aaaa	 VVVV	3R  lp\         P                  ! \        4       \        .\        ^4       Uu. uF*  p\         P                  P                  \        RV 24      NK,  	  up,           o	S	R,          oS	R,          oS F  p\         P                  ! V4       K  	  S F  p\        V4       K  	  S	 Uu. uF#  p\         P                  ! V4      P                  NK%  	  upo\        P                  \        P                  ,          p\        S	4       F  p\         P                  ! W44       K  	   \        P                  ! \        VR7       R# u upi u upi    \        S	S4       F.  w  r5 \         P                  ! Y54       K    \          d     K,  i ; i	  \        P                  ! \        4       h ; i)c                 ~  <a \        V\        4      '       g   h \        S	S4       F  w  r4\        P                  ! W44       K  	  \        V3R  lS 4       4      pS F!  pW58w  g   K  \        P                  ! V4       K#  	  \        V3R lS 4       4      pS F!  pW58w  g   K  \        P                  ! V4       K#  	  R# )c              3   8   <"   T F  qS8w  g   K  Vx  K  	  R # 5ir(   rA   .0rh   r6   s   & r#   	<genexpr>PTestRmTree.test_rmtree_deleted_race_condition.<locals>._onexc.<locals>.<genexpr>  s     54a94   
c              3   8   <"   T F  qS8w  g   K  Vx  K  	  R # 5ir(   rA   r  s   & r#   r  r    s     65aI5r  N)r4   PermissionErrorzipr)   r  nextr  rt   )
r9  r6   r   rh   r\   keepdirsfiles	old_modespathss
   &f&   r#   _onexc=TestRmTree.test_rmtree_deleted_race_condition.<locals>._onexc  s    c?33ui0! 1 5455D9HHQK  6566D9IIaL r%   child:rR  Nr!  :r!  Nr!  r   N)r)   r   r   rH   r6   r7   r>   r  r  r  r  reversedr  r   r   r  r   )
r   r  rO   r6   r  r\   r  r  r  r  s
   &     @@@@r#   "test_rmtree_deleted_race_condition-TestRmTree.test_rmtree_deleted_race_condition  sQ   	! 	!$ 	%*1X/%- GGLL5=%-/ /T{dDHHTN D  8==utRWWT]**u=	 <<,UODHHT$ $
	MM&/#/ >	!%3
HHT(  4
 MM&!s;   0E=)E7E F:3F	F:FF:F F:c                N   ^(pV^
,           p\         P                  P                  ! \        .R.V,          O5!  p\         P                  ! V4       \
        P                  ! V4      ;_uu_ 4        \        P                  ! \        4       RRR4       R#   + '       g   i     R# ; i)(   r   N)	r)   r6   r7   r   makedirsr   infinite_recursionr   r   )r   recursion_limitdirectory_depthbases   &   r#   !test_rmtree_above_recursion_limit,TestRmTree.test_rmtree_above_recursion_limit  sg    )B.ww||F?seo&=?
D''88MM&! 9888s   .BB$	)r  r  r  N)/r   r   r   r   r   r   skip_unless_symlinkr   r   r   unittest
skipUnlessr   r   r   r   r   r  r  skipIfr   platformskip_if_dac_overrideskip_unless_working_chmodr  r  r)  r(  r5  r>  rN  r   r   r   r\  rb  re  rl  rr  rv  ro   r)   r  r  r  r   r   r   s   @r#   r   r      s;     ""8 #8$ ""5 #5$ ""/ #/* "<=8 >8& "<=5 >5& "<=/ >/*J6=$:$ __S\\"%1IK##((N ) $KN6 6 __S\\"%1IK##((L ) $KL6 6 __S\\"%1IK##((") ) $K")H" C, ==?UV ) W )D ==?XY3 Z3 __V]]99;PQ1 R1 ""6 #6 "<=6 >6 X.0FG__S\\Y.;=1= H1 __S\\"%1IK##((3 ) $K3j" "r%   r   c                     a  ] tR tRt o R tR t]P                  R 4       tR t	R t
R t]P                  P                  R4      R	 4       tR
 t]P"                  ! ]! ]R4      R4      ]P                  ]P(                  ! ]P,                  R8H  R4      R 4       4       4       tR t]P                  R 4       t]P                  R 4       tR tR tRtV tR# )TestCopyTreei  c           	     R   V P                  4       p\        P                  P                  V P                  4       R 4      pV P	                  \
        P                  V4       V P	                  \
        P                  \        P                  P                  V4      4       \        VR3R4       \        P                  ! \        P                  P                  VR4      4       \        VRR3R4       \
        P                  ! W4       V P                  \        P                  P                  \        P                  P                  VR4      4      4       V P                  \        P                  P                  \        P                  P                  VR4      4      4       V P                  \        P                  P                  \        P                  P                  VRR4      4      4       \        VR34      pV P                  VR4       \        VRR34      pV P                  VR4       R# )destinationtest.txt123test_dir456N)r   r)   r6   r7   r   r   r   dirnamer>   r   copytreer   isfilerb   r]   r   r   src_dirdst_diractuals   &   r#   test_copytree_simple!TestCopyTree.test_copytree_simple  sc   ,,.'',,t||~}=w/rwww'?@Wj)51
gz23Wj*5u=)rww||GZ'HIJbggll7J&GHIrww||GZ4>(@ A 	BGZ01'GZ<='r%   c           	     
   V P                  4       pV P                  4       pV P                  \        P                  V4       V P                  \        P                  V4       \	        VR 3R4       \
        P                  ! \
        P                  P                  VR4      4       \
        P                  ! \
        P                  P                  VR4      4       \	        VRR3R4       \	        VRR3R4       \        P                  ! WRR7       V P                  \
        P                  P                  \
        P                  P                  VR 4      4      4       V P                  \
        P                  P                  \
        P                  P                  VR4      4      4       V P                  \
        P                  P                  \
        P                  P                  VRR4      4      4       \        VR 34      pV P                  VR4       \        VRR34      pV P                  VR4       V P                  \         4      ;_uu_ 4        \        P                  ! WRR7       R	R	R	4       R	#   + '       g   i     R	# ; i)
znonexisting.txtr  existing_dirzexisting.txtzwill be replacedzhas been replacedT)dirs_exist_okFN)r   r   r   r   r>   r)   r   r6   r7   r  r   r  rb   r]   r   r   FileExistsErrorr  s   &   r#   test_copytree_dirs_exist_ok(TestCopyTree.test_copytree_dirs_exist_ok  s   ,,.,,.w/w/W/0%8
g~67
g~67Wnn=?QRWnn=?RS=rww||G=N'OPQbggll7N&KLMrww||G^4B(D E 	FG%678'G^^DE!45//OOGEB 0///s   I11J	c           	        V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  ! V4       \        P                  ! V4       \        VR3R4       \        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  ! \        P                  P                  VR4      V4       \        \        R4      '       d;   \        P                  ! V\        P                  \        P                  ,          4       \        \        R4      '       d<   \        \        R	4      '       d&   \        P                  ! V\        P                  4       \        P                  ! V4      p\        P                   ! W#R
R7       V P#                  \        P                  P%                  \        P                  P                  VRR4      4      4       \        P&                  ! \        P                  P                  VRR4      4      p\        P(                  R8X  d!   VP+                  R4      '       d
   VR,          pV P-                  V\        P                  P                  VR4      4       \        P                  ! V4      p	\        \        R4      '       d'   V P-                  V	P.                  VP.                  4       \        \        R4      '       d)   V P-                  V	P0                  VP0                  4       R# R# )rw   rx   subzfile.txtr   r   zsub/linklchmodlchflags	UF_NODUMPTsymlinksntz\\?\:   NNN)r   r)   r6   r7   r   r>   r   ro   r  r  S_IRWXUS_IRWXOr  r  r=  r   r  r   rc   readlinkrg   
startswithr   r  st_flags)
r   rL  r  r  sub_dirsrc_linkdst_linksrc_statr  dst_stats
   &         r#   test_copytree_symlinks#TestCopyTree.test_copytree_symlinks  s   ,,.'',,w.'',,w.'',,w.

Wj)5177<<077<<4


277<<4	2x  IIht|| ;<2z""wt['A'AKK$..188H%48rww||GUF'KLMRWW\\'5&AB 77d?v00;;BZFgz!BC88H%2x  X--x/?/?@2z""X..0A0AB #r%   c           
        \         P                  P                  p\         P                  P                  pV P	                  4       p V! V P	                  4       R 4      p\        VR3R4       \        VR3R4       \         P                  ! V! VR4      4       \        VRR3R4       \         P                  ! V! VR4      4       \        VRR3R4       \         P                  ! V! VRR4      4       \         P                  ! V! VRR4      4       \        VRRR3R4       \        VRRR	3R4        \        P                  ! R
R4      p\        P                  ! W4VR7       V P                  V! V! VR4      4      4       V P                  V! V! VR4      4      4       V P                  V! V! VR4      4      4       \        P                  ! V4        \        P                  ! R
R4      p\        P                  ! W4VR7       V P                  V! V! VR4      4      4       V P                  V! V! VRR4      4      4       V P                  V! V! VRR4      4      4       \        P                  ! V4        R p\        P                  ! W4VR7       V P                  V! V! VRRR	4      4      4       V P                  V! V! VRR4      4      4       \        P                  ! V4        \        P                  ! V4       \        P                  ! \         P                  P                  V4      4       R#   \        P                  ! T4       i ; i  \        P                  ! T4       i ; i  \        P                  ! T4       i ; i  \        P                  ! T4       \        P                  ! \         P                  P                  X4      4       i ; i)r  r  r  ztest.tmpr  r  	test_dir2r_  subdir2ztest.pyz*.tmpignorezsubdir*c                 ~   . pV F  p\         P                  P                  W4      p\         P                  P                  V4      '       d0   VP	                  4       R,          R8X  d   VP                  V4       Kv  \         P                  P                  V4      R,          R9   g   K  VP                  V4       K  	  V# )rR  r_  z.pyr~   )r)   r6   r7   rb   r   rd   splitext)rw   namesrf   rg   r6   s   &&   r#   _filter8TestCopyTree.test_copytree_with_exclude.<locals>._filterd  s    C %!ww||C6GGMM$// JJL,8JJt,WW--d3B7EBJJt, !& Jr%   N)r)   r6   r7   r   r   r>   r   r   ignore_patternsr  r   r   r   r  )r   r7   r   r  r  patternsr  s   &      r#   test_copytree_with_exclude'TestCopyTree.test_copytree_with_exclude<  s   ww||,,.:	44<<>=9G*-u5*-u5HHT':./*j95AHHT';/0+z:EBHHT';9:HHT';	:;+xDeL+y)DeL'!11';GBtGZ'@ AB  Wj(A!BC  Wk(B!CDg&'!11'9EB  Wj(A!BC  Wk9(M!NO  Wk8(L!MNg&'
 A   Wk9-6)8 "9 :  Wk8(L!MN g&MM'"MM"''//'23I g& g&0 g&MM'"MM"''//'23sY   C'M= .B	L, 7M= BM M= 0AM" 
M= ,MM= MM= "M::M= =AOc           
     `  a a \         P                  P                  p\         P                  P                  pS P	                  4       pV! VR 4      p\         P
                  ! V! V4      4       \         P
                  ! V! VR4      4       \         P
                  ! \         P                  P                  VRR4      4       \        VRRR3R4       . oVV 3R lpV! S P	                  4       R4      p\        P                  ! WFVR7       S P                  V! V! VRRR4      4      4       V! S P	                  4       R4      p\        P                  ! \        V4      WeR7       S P                  V! V! VRRR4      4      4       V! S P	                  4       R4      p\        \         P                  ! V4      4      ^ ,          pS P                  V\         P                  4       \        P                  ! WvVR7       S P                  V! V! VRRR4      4      4       S P                  \!        S4      ^	4       R# )	sourcer  r_  r  r  c                   < SP                  V 4       SP                  V \        4       SP                  V\        4       SP	                  \        V4      \        \        V4      4      4       V F  pSP                  V\        4       K  	  . # r(   )rd   r   r8   listr   r   set)rw   r  rg   invocationsr   s   && r#   _ignore?TestCopyTree.test_copytree_arg_types_of_ignore.<locals>._ignore  sl    s#!!#s+!!%.SZSZ9%%dC0 Ir%   r  r  N)r)   r6   r7   r   r   r   r>   r   r  r   r   r  r   r   DirEntryr   r   )	r   r7   r   rL  r  r  r  src_dir_entryr  s	   f       @r#   !test_copytree_arg_types_of_ignore.TestCopyTree.test_copytree_arg_types_of_ignore}  s   ww||,,.w)
g
gz*+
gz8<=Wj(J?G	 t||~}59tGZ$. 0 1 	2 t||~}5)7CtGZ$. 0 1 	2 t||~}5RZZ01!4mR[[9w?tGZ$. 0 1 	2 	[)1-r%   c           	        V P                  4       p\        P                  P                  VR 4      p\        P                  ! V4       \        P                  P                  VR4      pV P                  \        P                  V4       \        P                  ! VR4       \        VR3R4       \        P                  ! \        P                  P                  VR4      R4       \        VR3R4       \        P                  ! \        P                  P                  VR4      R4       \        P                   ! VR7      pV P                  \        P                  V4       \        P                  ! VR4       \        P                  ! W#4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       V P                  \        P                  ! \        P                  P                  VR4      4      P                  \        P                  ! \        P                  P                  VR4      4      P                  4       V P                  \        P                  ! \        P                  P                  VR4      4      P                  \        P                  ! \        P                  P                  VR4      4      P                  4       \        P                  P                  V\        P                  P!                  V4      ^,          4      pV P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       R	# )
r  r  i  zpermissive.txtr  zrestrictive.txtr  i  r   N)r   r)   r6   r7   r   r   r   r   r  r>   rp   r   r  r   r  r  r   )r   rL  r  r  restrictive_subdirrestrictive_subdir_dsts   &     r#   !test_copytree_retains_permissions.TestCopyTree.test_copytree_retains_permissions  s1   ,,.'',,w1
'',,w6w/
% W./7
g'78%@W/0%8
g'895A%--':	((*<=
#U+))1127773C3K3KLg7G!HIQQ''"'',,w8H"IJRR	Tg7H!IJRR''"'',,w8I"JKSS	U!#g.0ggmm<N.OPQ.R"T!34<<''"89AA	Cr%   zos.chmodc                   V P                  4       p\        P                  P                  V P                  4       R 4      pV P	                  \
        P                  V4       V P	                  \
        P                  \        P                  P                  V4      4       \        R4      Vn	        V P                  \
        P                  4      ;_uu_ 4        \
        P                  ! W#4       RRR4       R#   + '       g   i     R# ; i)r  zka-boomN)r   r)   r6   r7   r   r   r   r  r  r   r   r   r  )r   
mock_patchr  r  s   &&  r#   test_copytree_winerror#TestCopyTree.test_copytree_winerror  s    
 ,,.'',,t||~}=w/rwww'?@!0!;
v||,,OOG- -,,,s   C44D	c                H  a aaa VVV V3R  lp. oS P                  4       o\        P                  ! S P                  4       R7      o\        \        P
                  P                  SR4      4       \        P                  ! SSVR7       S P                  \        S4      ^4       R# )c                 B  < SP                  R 4       SP                  V \        4       SP                  V\        4       SP                  V \        P
                  P                  SR4      4       SP                  V\        P
                  P                  SR4      4       R # )Nr   )rd   r   r8   r   r)   r6   r7   )r  r  rx   flagr   rw   s   &&r#   custom_cpfunETestCopyTree.test_copytree_custom_copy_function.<locals>.custom_cpfun  sm    KK!!!S)!!!S)QS% 89QS% 89r%   r   r   copy_functionN)r   rp   r   r>   r)   r6   r7   r   r  r   r   )r   r  rx   r  rw   s   f @@@r#   "test_copytree_custom_copy_function/TestCopyTree.test_copytree_custom_copy_function  sn    	: 	: llnoo$,,.1BGGLLe,-S=TA&r%   rx  ry  rz  r{  c                   \         P                  ! \        4        \         P                  P	                  \        R 4      p\         P                  ! V4       \         P                  P	                  VR4      p \         P
                  ! V4        \        P                  ! \        \        4       V P                  R4       \        P                   ! \        RR7       \        P                   ! \        RR7       R#   \         d#   pT P                  RT,          4        Rp?LRp?ii ; i  \        P                   d^   pTP                  ^ ,          pT P                  \        T4      ^4       T^ ,          w  rVpT P                  RT,          T4        Rp?LRp?ii ; i  \        P                   ! \        RR7       \        P                   ! \        RR7       i ; i)r_  r}  os.mkfifo(): %sNz$shutil.Error should have been raisedz`%s` is a named pipeTr   )r)   r   r   r6   r7   rx  r  skipTestr   r  TESTFN2failr   r!   r   r   r   )r   r_  pipeer   rw   rx   	error_msgs   &       r#   test_copytree_named_pipe%TestCopyTree.test_copytree_named_pipe  s=   
 		7WW\\&(3FHHV77<<1D5		$B0 		@AMM&5MM'6 # 5/!3445 << K  Va0&,Qi#)  !7$!>	JJ	K MM&5MM'6s[   AF 7C8 D( -F 8D%D F  D%%F (F=AFF FF :Gc                  a V P                  4       p\        P                  P                  V P                  4       R 4      p\	        VR3R4       \        P
                  ! \        P                  P                  VR4      4       \	        VRR3R4       . oV3R lp\        P                  ! WVR7       V P                  \        S4      ^4       R# )r  r  r  r  r  c                 ,   < SP                  W34       R # r(   r   )rw   rx   copieds   &&r#   _copy6TestCopyTree.test_copytree_special_func.<locals>._copy  s    MM3*%r%   r  N)
r   r)   r6   r7   r>   r   r   r  r   r   )r   r  r  r  r  s   &   @r#   test_copytree_special_func'TestCopyTree.test_copytree_special_func  s    ,,.'',,t||~}=Wj)51
gz23Wj*5u=	& 	>Va(r%   c                d   V P                  4       p\        P                  P                  VR 4      p\	        VR4       \        P                  P                  VR4      p\        P
                  ! V4       W3 Fm  p\        P                  ! R\        P                  P                  VR4      4       \        P                  ! V\        P                  P                  VR4      4       Ko  	  \        P                  P                  V P                  4       R4      pV P                  \        \        P                  W4       \        P                  P                  V P                  4       R4      p\        P                  ! WRR	7       \        P                  ! V4       F*  w  rgpV P                  RV4       V P                  RV4       K,  	  \        P                  P                  V P                  4       R
4      p\        P                  ! WRR7       V P                  R \        P                  ! V4      4       R# )r  abcdir_a
IDONTEXISTbrokenvalidr  destination2T)ignore_dangling_symlinksdestination3r  N)r   r)   r6   r7   r>   r   r   r   r   r   r  walkassertNotInr"  ra   )	r   r  
valid_filer  r   r  rootr  r  s	   &        r#   test_copytree_dangling_symlinks,TestCopyTree.test_copytree_dangling_symlinks
  sc   ,,.WW\\':6
J&Wg.
AJJ|RWW\\!X%>?JJz277<<7#;<  
 '',,t||~}=%'C '',,t||~~>4H!#!1DXu-MM'5) "2
 '',,t||~~>48j"**W"56r%   c           	        V P                  4       p\        P                  P                  V P                  4       R 4      p\        P                  ! \        P                  P                  VR4      4       \        \        P                  P                  VRR4      4       \        P                  ! \        P                  P                  VR4      \        P                  P                  VR4      RR7       \        P                  ! WRR7       V P                  \        P                  P                  \        P                  P                  VR4      4      4       V P                  R\        P                  ! \        P                  P                  VR4      4      4       \        P                  P                  V P                  4       R4      p\        P                  ! WRR7       V P                  \        P                  P                  \        P                  P                  VR4      4      4       V P                  R\        P                  ! \        P                  P                  VR4      4      4       R	# )
r  real_dirr  link_to_dirTtarget_is_directoryFr  r  N)r   r)   r6   r7   r   r>   r   r   r  r   rc   r"  ra   r   )r   r  r  s   &  r#   test_copytree_symlink_dir&TestCopyTree.test_copytree_symlink_dir%  sc   ,,.'',,t||~}=
gz23BGGLL*jAB


277<<477<<7'+	- 	59Wm(LMNj"**RWW\\'=-Q"RS'',,t||~~>48rww||G]'KLMj"**RWW\\'=-Q"RSr%   c                L   V P                  4       pVR ,           pV P                  \        P                  VR4       \        P
                  P                  VR4      p\        VR4       \        P                  ! W4      pV P                  R.\        P                  ! V4      4       R# )destTr   N)r   r   r   r   r)   r6   r7   r>   r  r   ra   )r   r  r  rw   rvs   &    r#   test_copytree_return_value'TestCopyTree.test_copytree_return_value8  sq    ,,.F"w5ggll7E*C__W.%"**R.1r%   c                   V P                  4       pV P                  \        P                  VR R7       \        P
                  P                  VRR4      p\        P
                  P                  VRR4      p\        P                  ! V4       \        P
                  P                  VR4      p\        VR4       \        P                  ! W#4      pV P                  R.\        P                  ! V4      4       R# )Tr   tpg
somevendorz1.0polN)r   r   r   r   r)   r6   r7   r  r>   r  r   ra   )r   base_dirr  r  rw   r)  s   &     r#   test_copytree_subdirectory'TestCopyTree.test_copytree_subdirectoryB  s    <<>xtD'',,xd3'',,we<
Gggll7E*C__W.%"**R.1r%   rA   N)r   r   r   r   r  r  r   r  r  r  r  r  r  mockpatchr  r  r  ro   r)   r  r   r  r  r  r  r%  r*  r2  r   r   r   s   @r#   r  r    s    (&C2 ""C #C>?4B(.TC6 ]]$. %.'" X.0FG""__S\\Y.;=7= # H7.) ""7 #74 ""T #T$2
2 
2r%   r  c                     a  ] tR tRt o ]P
                  R 4       t]P                  ! ]	! ]
R4      R4      ]P
                  R 4       4       t]P                  ! ]	! ]
R4      R4      ]P
                  R 4       4       t]P
                  R 4       t]P                  ! ]	! ]
R	4      ;'       d    ]	! ]R
4      ;'       d
    ]	! ]R4      R4      R 4       t]P"                  R 4       t]P
                  ]P"                  ]P&                  R 4       4       4       tR tR t]P
                  R 4       t]P                  ! ]	! ]
R4      R4      R 4       t]P
                  R 4       t]P"                  R 4       tR tR tR tR t]P
                  R 4       t]P                  ! ]	! ]
R4      R4      R 4       t ]P
                  R  4       t!]P                  ! ]	! ]
R!4      R"4      ]P                  ! ]"PF                  R#8H  R$4      R% 4       4       t$R& t%R' t&]P                  ! ]';'       g    ](;'       g    ])R(4      ]P                  ! ]*R)4      R* 4       4       t+R+ t,R,t-V t.R-# ).TestCopyiN  c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR 4       \	        VR 4       \        P
                  ! W$4       \        P
                  ! W54       \        P                  ! V\        P                  \        P                  ,          4       \        P                  ! V\        P                  4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       \        P                  ! W#4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       \        P                  ! V\        P                  4       \        P                  ! WC4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       \        P                  ! V\        P                  4       \        P                  ! W%4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       \        P                  ! V\        P                  4       \        P                  ! WE4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       R# )r   barbazquuxN)r   r)   r6   r7   r>   r   r  r  r  S_IRWXGr  assertNotEqualr  r   copymoder   r   rL  rw   rx   r  r  s   &     r#   test_copymode_follow_symlinks&TestCopy.test_copymode_follow_symlinksR  s   ,,.ggll7E*ggll7E*77<</77<<0CC


3!


3!
dll4<</0
dll#BGGCL00"''#,2F2FG!--rwws|/C/CD 	dll#&--rwws|/C/CD
dll#&--rwws|/C/CD
dll#+--rwws|/C/CDr%   r  zrequires os.lchmodc                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR 4       \	        VR 4       \        P
                  ! W$4       \        P
                  ! W54       \        P                  ! V\        P                  \        P                  ,          4       \        P                  ! V\        P                  4       \        P                  ! V\        P                  \        P                  ,          4       \        P                  ! V\        P                  4       \        P                  ! V4      P                  p\        P                  ! WERR7       V P                  \        P                   ! V4      P                  \        P                   ! V4      P                  4       V P                  \        P                  ! V4      P                  V4       \        P                  ! V\        P                  4       \        P                  ! WCRR7       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       \        P                  ! V\        P                  4       \        P                  ! W%RR7       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       R# r   r9  r:  r;  Ffollow_symlinksN)r   r)   r6   r7   r>   r   r  r  r  r<  r  r  r  r   r>  r   r=  )r   rL  rw   rx   r  r  old_modes   &      r#    test_copymode_symlink_to_symlink)TestCopy.test_copymode_symlink_to_symlinkq  s    ,,.ggll7E*ggll7E*77<</77<<0CC


3!


3!
dll4<</0
dll#
		(DLL56
		(DLL)773<''EB(+33(+33	5--x8
		(DLL)u=--rwws|/C/CD
		(DLL)u=--rwws|/C/CDr%   z requires os.lchmod to be missingc                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR 4       \	        VR 4       \        P
                  ! W$4       \        P
                  ! W54       \        P                  ! WERR7       R# rC  )r   r)   r6   r7   r>   r   r   r>  r?  s   &     r#   *test_copymode_symlink_to_symlink_wo_lchmod3TestCopy.test_copymode_symlink_to_symlink_wo_lchmod  s     ,,.ggll7E*ggll7E*77<</77<<0CC


3!


3!EBr%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR 4       \        P
                  ! V4      p\        P                  ! W&P                  VP                  R,
          34       \	        VR4       V P                  \        P
                  ! V4      P                  \        P
                  ! V4      P                  4       \        P                  ! W$4       \        P                  ! W54       \        \        R4      '       d&   \        P                  ! V\
        P                  4       \        \        R4      '       d<   \        \
        R4      '       d&   \        P                  ! V\
        P                  4       \        P                   ! V4      p\        \        R4      '       dS   \"        P$                  ! WERR	7       V P                  VP&                  \        P
                  ! V4      P&                  4       \"        P$                  ! WER
R	7       \        P                   ! V4      p\        P                  \        P(                  9   d5   R F.  p	V P+                  \-        Wy4      \-        W4      ^,           4       K0  	  \        \        R4      '       d'   V P/                  VP&                  VP&                  4       \        \        R4      '       d9   \        VR4      '       d'   V P/                  VP0                  VP0                  4       \"        P$                  ! WCR
R	7       V P3                  \5        \        P
                  ! V4      P                  \        P
                  ! V4      P                  ,
          4      R8  4       R# )r   r9  r:  quxg      E@r  r  r  TrD  Fr  g?Nst_atimest_mtime)r   r)   r6   r7   r>   r  utimerO  rP  r=  r   ro   r  r  r  r  r=  r   copystatr  rI  assertLessEqualr   r   r  r   abs)
r   rL  rw   rx   r  r  r  src_link_statdst_link_statattrs
   &         r#   test_copystat_symlinksTestCopy.test_copystat_symlinks  s   ,,.ggll7E*ggll7E*77<</77<</C773<
((((4/1 	2CBGGCL112773<3H3HI


3!


3!2x  IIh-2z""wt['A'AKK$..1*2x  OOHE 5 5rwws|7K7KLEB*88r222.$$W]%A%,]%AA%EG / 2x  ]22M4I4IJ2z""w}j'I'I]33]5K5KLu=BGGCL11BGGCL4I4IIJ  	!r%   chflags
EOPNOTSUPPENOTSUPz)requires os.chflags, EOPNOTSUPP & ENOTSUPc                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\	        VR4       \	        VR4       R p\        P
                  p \        P                  \        P                  3 F*  pV! V4      \        n        \        P                  ! W#4       K,  	  V! \        P                  \        P                  ,           4      \        n        V P                  \        \        P                  W#4       V\        n        R#   T\        n        i ; i)r   file2xxxc                 4   a a \        4       oR R/V V3R llpV# )rE  Tc                   < SSn         Shr(   )r    )r6   flagsrE  errexs   &&$r#   _chflags_raiserlTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser.<locals>._chflags_raiser  s    r%   rS  )rc  re  rd  s   f @r#   make_chflags_raiserSTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser  s#    B   #"r%   N)r   r)   r6   r7   r>   rZ  r    r[  r\  r   rR  r   r   )r   r   r   r^  rg  old_chflagsrc  s   &      r#   -test_copystat_handles_harmless_chflags_errors6TestCopy.test_copystat_handles_harmless_chflags_errors  s    
 VW-VW-E5!E5!	# jj	%''605
- 7 -U-=-=-MNBJgvE$BJBJs   =B'D1 1D>c                  aaa	a
 V P                  4       p\        P                  P                  VR 4      o
\	        S
R 4       \        P                  P                  VR4      p\	        VR4       \
        P                  ! S
V4       \        P                  ! S
RR4       \        P                  ! S
RR4       \
        P                  ! S
V4       V P                  \        \        P                  ! S
4      4      \        \        P                  ! V4      4      4       V P                  \        P                  ! S
R4      \        P                  ! VR4      4       \        P                  ! V4       \	        VR4       \        \        P                  R4      o	VV	3R lp \        P                  oV\        n        \
        P                  ! S
V4       V P!                  R\        P                  ! V4      4       S\        n        RR	/VV
3R
 llp \        P                  oV\        n
        \
        P                  ! S
V4       S\        n
        \        P                  P                  VR4      o
\        P                  P                  VR4      p\	        S
S
4       \	        WU4       \        P                  ! S
RR4       \        P                  ! VRR4       \        P"                  ! VR4       \        P                  P                  VR4      p\        P                  P                  VR4      p\	        W"4       \	        Wf4       \
        P$                  ! S
V4       \
        P$                  ! WV4       V P                  \        P                  ! VR4      R4       V P                  \        P                  ! VR4      R4       R#   S\        n        i ; i  S\        n
        i ; i)r   r9  user.foo   42zuser.bar   43EPERMc                 .   < VR 8X  d   ShS! WV3/ VB  R# )rm  NrA   )fnamerW  valr"   orig_setxattros_errors   &&&,r#   _raise_on_user_foo3TestCopy.test_copyxattr.<locals>._raise_on_user_foo  s    z!e39&9r%   rE  Tc                X   < V S8X  d   \        \        P                  R 4      hS! WR7      # )zOperation not supportedrD  )r   r    r\  )rr  rE  orig_listxattrrw   s   &$r#   _raise_on_src.TestCopy.test_copyxattr.<locals>._raise_on_src  s'    |emm-FGG!%IIr%   the_originalthe_original_rozuser.the_values   fiddlyi$  the_copythe_copy_roN)r   r)   r6   r7   r>   r   
_copyxattrsetxattrr   r`   	listxattrgetxattrrj  r   r    rp  r"  r  rR  )r   rL  rx   rv  rz  srcrodstrory  rt  ru  rw   s   &      @@@@r#   test_copyxattrTestCopy.test_copyxattr  s   ,,.ggll7E*Cggll7E*C 	#s#
CU+
CU+#s#S 12F2<<;L4MNC,C,	. 			#C5;;0	:
	(KKM,BKc3'MM*bll3&78'BK	JD 	J 	J	*\\N(BLc3')BL ggll7N3W&78CE!
C)95
E+Y7
ggll7J/Wm4CE!S!%S*:;YGU,<=yI9 (BK *BLs   AN4 2O 4OOc                ^   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\	        VR 4       \        P
                  ! W#4       \        P                  ! VRR4       \        P                  ! VRRRR7       \        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR4       \        P
                  ! WE4       \        P                  ! W5RR7       V P                  \        P                  ! VRRR7      R4       V P                  \        \        P                  VR4       \        P                  ! W4RR7       V P                  \        P                  ! VR4      R4       R	# )
r   r:  ztrusted.foorn  ro  FrD  r9  rM  N)r   r)   r6   r7   r>   r   r  r   r  r   r  r   r   )r   rL  rw   r  rx   r  s   &     r#   test_copyxattr_symlinks TestCopy.test_copyxattr_symlinks(  s    ,,.ggll7E*77<</C


3!
C.
HmUEJggll7E*77<</C


3!(eDX}eTV[\'2;;]C(?S-8%@r%   c                    R pV P                  4       p\        W23R4       \        P                  P	                  W24      pV P                  4       pV! WE4       \        P                  P	                  WR4      pWF3# )r  r_  )r   r>   r)   r6   r7   )r   methodrr  r   r   tmpdir2r^  s   &&     r#   
_copy_fileTestCopy._copy_fileB  s]    VOU+V+,,.uW,~r%   c                @   V P                  \        P                  4      w  rV P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      P                  \        P                  ! V4      P                  4       R # r(   )
r  r   copyr   r)   r6   r   r   r  r  )r   r   r^  s   &  r#   	test_copyTestCopy.test_copyL  s[    v{{3u-.//1G1GHr%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR 4       \        P
                  ! W$4       \        \        R4      '       d;   \        P                  ! V\        P                  \        P                  ,          4       \        P                  ! WCRR7       V P                  \        P                  P                  V4      4       V P                  \!        V4      \!        V4      4       \        P"                  ! V4       \        P                  ! WCRR7       V P%                  \        P                  P                  V4      4       V P                  \        P&                  ! V4      \        P&                  ! V4      4       \        \        R4      '       dQ   V P                  \        P(                  ! V4      P*                  \        P(                  ! V4      P*                  4       R# R# )r   r9  r:  r  TrD  FN)r   r)   r6   r7   r>   r   ro   r  r  r  r  r   r  r   rc   r   r]   rj  r   r  r=  r  )r   rL  rw   rx   r  s   &    r#   test_copy_symlinksTestCopy.test_copy_symlinksR  s^   ,,.ggll7E*ggll7E*77<</C


3!2x  IIht|| ;<H48,-338
		#H59s+,S)2;;x+@A2x  RXXh/77XXc]224 !r%   rQ  zrequires os.utimec                T   V P                  \        P                  4      w  rV P                  \        P
                  P                  V4      4       \        P                  ! V4      p\        P                  ! V4      pV P                  VP                  VP                  4       R F.  pV P                  \        W54      \        WE4      ^,           4       K0  	  \        \        R4      '       d=   \        VR4      '       d)   V P                  \        VR4      \        VR4      4       R# R# R# )rO  rZ  r  NrN  )r  r   copy2r   r)   r6   r   r  r   r  rS  r   ro   )r   r   r^  
file1_stat
file2_statrW  s   &     r#   
test_copy2TestCopy.test_copy2k  s     v||4u-.WWU^
WWU^
++Z-?-?@*D  !:!(!:Q!>@ + 2y!!gj*&E&EWZ<$Z<> 'F!r%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR 4       \        P
                  ! W$4       \        \        R4      '       d;   \        P                  ! V\        P                  \        P                  ,          4       \        \        R4      '       d<   \        \        R4      '       d&   \        P                  ! V\        P                  4       \        P                  ! V4      p\        P                  ! V4      p\        P                  ! WCRR7       V P!                  \        P                  P#                  V4      4       V P%                  \'        V4      \'        V4      4       \        P(                  ! V4       \        P                  ! WCRR7       V P+                  \        P                  P#                  V4      4       V P%                  \        P,                  ! V4      \        P,                  ! V4      4       \        P                  ! V4      p\        P.                  \        P0                  9   d5   R F.  pV P3                  \5        Wh4      \5        Wx4      ^,           4       K0  	  \        \        R4      '       dM   V P%                  VP6                  VP6                  4       V P9                  VP6                  VP6                  4       \        \        R4      '       d=   \        VR	4      '       d)   V P%                  VP:                  VP:                  4       R
# R
# R
# )r   r9  r:  r  r  r  TrD  Fr  NrN  )r   r)   r6   r7   r>   r   ro   r  r  r  r  r  r  r=  r   r  r   rc   r   r]   rj  r   r  rQ  rI  rS  r   r  r=  r  )	r   rL  rw   rx   r  r  rU  r  rW  s	   &        r#   test_copy2_symlinksTestCopy.test_copy2_symlinks|  s3   ,,.ggll7E*ggll7E*77<</C


3!2x  IIht|| ;<2z""wt['A'AKK$..1773<*XD9,-338
		#XE:s+,S)2;;x+@A88C=88r222.$$W]%A%,X%<q%@B / 2x  ]22H4D4DE 0 0(2B2BC2z""w}j'I'I]33X5F5FG (J"r%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\	        VR 4       \        P
                  ! VRR4       \        P                  ! W#4       V P                  \        P                  ! VR4      \        P                  ! VR4      4       \        P                  ! V4       R# )r   r9  rm  rn  N)r   r)   r6   r7   r>   r  r   r  r   r  rj  )r   rL  rw   rx   s   &   r#   test_copy2_xattrTestCopy.test_copy2_xattr  s    ,,.ggll7E*ggll7E*C
CU+SC,C,	. 			#r%   c                
   \         P                  \         P                  3 F  pV P                  4       pV P                  4       p\        P
                  P                  VR 4      p\        VR 4       V! WC4      pV P                  V\        P
                  P                  VR 4      4       V! V\        P
                  P                  VR4      4      pV P                  V\        P
                  P                  VR4      4       K  	  R# )r   r9  N)	r   r  r  r   r)   r6   r7   r>   r   )r   r9  r  r  rw   r)  s   &     r#   test_copy_return_valueTestCopy.test_copy_return_value  s    ;;-BllnGllnG'',,w.CU#C!BRgu!=>Cgu56BRgu!=> .r%   c                D    V P                  \        P                  4       R # r(   )_test_copy_dirr   r  r~  s   &r#   test_copy_dirTestCopy.test_copy_dir  s    FKK(r%   c                D    V P                  \        P                  4       R # r(   )r  r   r  r~  s   &r#   test_copy2_dirTestCopy.test_copy2_dir  s    FLL)r%   c                z   V P                  4       p\        P                  P                  VR 4      pV P                  4       p\        P                  P                  VR4      p\	        VR 4       \
        P                  R8X  d   \        pM\        pV P                  WaWB4       V P                  WaWE4       V! W44       R# r   does_not_exist/win32N)
r   r)   r6   r7   r>   r   r  r  IsADirectoryErrorr   )r   	copy_funcr  src_filer   rx   rc  s   &&     r#   r  TestCopy._test_copy_dir  s    ,,.77<</||~ggll7$56He$<<7"!C#C#$8 	#$4(!r%   c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P                  VR4      p\	        VR4       \        P
                  ! W%4       \        P                  ! WTRR7       V P                  \        P                  P                  V4      4       V P                  \        P                  ! V4      \        P                  ! V4      4       \        P                  ! WS4       V P                  \        P                  P                  V4      4       R# )rw   rx   r  r   r   FrD  N)r   r)   r6   r7   r>   r   r   copyfiler   rc   r   r  r   )r   rL  rw   rx   r  r   s   &     r#   test_copyfile_symlinksTestCopy.test_copyfile_symlinks  s    ,,.ggll7E*ggll7E*77<<4ww||GV,C


3>x01T*BKK,AB",-r%   r   zrequires os.linkc                   \         P                  ! \        4       \         P                  P	                  \        R 4      p\         P                  P	                  \        R4      p \        VR4        \         P                  ! W4       V P                  \        P                  \        P                  W4       \        VRRR7      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       \         P                   ! V4       \        P"                  ! \        RR	7       R#   \         d#   pT P                  RT,          4        Rp?LRp?ii ; i  + '       g   i     Lt; i  \        P"                  ! \        RR	7       i ; i)
ro  rp  cheddarzos.link(): %sNrV   rW   rX   Tr   )r)   r   r   r6   r7   r>   r   r  r  r   r   r   r  r:   r   rZ   rj  r   )r   rw   rx   r  rQ   s   &    r#   'test_dont_copy_file_onto_link_to_itself0TestCopy.test_dont_copy_file_onto_link_to_itself  s     	ggll68,ggll66*	6Y'3! f22FOOSNc311Q  95 2IIcNMM&5 # 3o1223 21 MM&5sO   $E, 1D) AE, !E-E, )E4EE, EE, E)	$E, ,F
c                   \         P                  ! \        4       \         P                  P	                  \        R 4      p\         P                  P	                  \        R4      p \        VR4       \         P                  ! R V4       V P                  \        P                  \        P                  W4       \        VRRR7      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       \         P                  ! V4       \        P                  ! \        RR7       R#   + '       g   i     LD; i  \        P                  ! \        RR7       i ; i)	ro  rp  r  rV   rW   rX   NTr   )r)   r   r   r6   r7   r>   r   r   r   r   r  r:   r   rZ   rj  r   )r   rw   rx   rQ   s   &   r#   *test_dont_copy_file_onto_symlink_to_itself3TestCopy.test_dont_copy_file_onto_symlink_to_itself  s     	ggll68,ggll66*	6Y' JJx%f22FOOSNc311Q  95 2IIcNMM&5	 21 MM&5s%   $A(D< !D)-D< )D9	4D< <Erx  ry  rz  r{  c                    \         P                  ! \        4        V P                  \        P                  \        P                  \        \        4       V P                  \        P                  \        P                  \        \        4       \         P                  ! \        4       R#   \         d#   pT P	                  R T,          4        Rp?LRp?ii ; i  \         P                  ! \        4       i ; i)r  N)r)   rx  r   r  r  r   r   SpecialFileErrorr  r  __file__rj  )r   r  s   & r#   test_copyfile_named_pipe!TestCopy.test_copyfile_named_pipe  s    	1IIf	f55 &Bf55 &6C IIf  	1MM+a/00	1 IIfs#   B) A0C )C4CCC5c                   V P                  4       pV P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\	        VR4       \
        P                  ! WC4      pV P                  \        P                  P                  V4      4       V P                  \        V4      \        V4      4       R# )r9  r   N)r   r)   r6   r7   r>   r   r  r   r   r   r]   )r   r  r  dst_filer  r)  s   &     r#   test_copyfile_return_value#TestCopy.test_copyfile_return_value  s    ,,.,,.77<</77<</He$__X0r*+8,i.ABr%   c                H   V P                  4       p\        P                  P                  VR 4      p\	        VR 4       V P                  \        \        P                  W"4       V P                  \        \        P                  W"4       V P                  \        V4      R 4       R# )r   N)r   r)   r6   r7   r>   r   r   r   r  r   r   r]   )r   r  r  s   &  r#   test_copyfile_same_file TestCopy.test_copyfile_same_file#  sn     ,,.77<</He$-(M%(E8,e4r%   zMOn MACOS, Solaris and Windows the errors are not confusing (though different)zNot valid on AIX, see gh-92670c                   V P                  4       p\        P                  P                  VR 4      p\        P                  P                  VR4      p\	        VR 4       V P                  \        \        P                  W#4       R# )r   r  N)	r   r)   r6   r7   r>   r   r   r   r  )r   r  r  rx   s   &   r#   test_copyfile_nonexistent_dir&TestCopy.test_copyfile_nonexistent_dir/  sY     ,,.77<</ggll7$56He$+V__hLr%   c                   V P                  4       p\        P                  P                  VR 4      pV P                  4       p\        P                  P                  VR4      p\	        VR 4       \
        P                  R8X  d   \        pM\        pV P                  V\        P                  W4       V P                  V\        P                  W!4       V P                  V\        P                  W14       R# r  )r   r)   r6   r7   r>   r   r  r  r  r   r   r  )r   r  r  r   rx   rc  s   &     r#   test_copyfile_copy_dirTestCopy.test_copyfile_copy_dir<  s     ,,.77<</||~ggll7$56He$<<7"!C#C#v=#vB#v>r%   rA   N)/r   r   r   r   r   r  r@  r  r  ro   r)   rG  r  rJ  rX  r    rj  skip_unless_xattrr  skip_unless_dac_overrider  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  MACOSSOLARISr   r   r  r  r   r   r   s   @r#   r7  r7  N  s     ""E #E< X.0DE""E # FE: __WR*,NO""
C # P
C ""&! #&!P Y/ 3 3 53 3 	2DF%	F%6   =J !=J~ ""  ''A ( ! #A.I ""4 #40 W-/BC> D>  "" H # HD   
 !

?)*"$ "". #.  V,.@A6 B6$ ""6 #6& X.0FG__S\\Y.;== H	C
5 __U00g00  3B  C __S:;M <	 C
M? ?r%   r7  c                     a  ] tR tRt o R tR,R lt]P                  ! 4       R 4       t]P                  ! 4       R 4       t	R t
]P                  ! 4       ]P                  ! ]P                  ! R4      R4      R	 4       4       t]P                  ! 4       R
 4       t]P                  ! 4       R 4       t]P                  ! 4       R 4       t]P                  ! 4       ]P                  ! ]P                  ! R4      R4      R 4       4       t]P                  ! 4       ]P                  ! ]P                  ! R4      R4      R 4       4       tR t]P                  ! 4       R 4       t]P                  ! 4       ]P                  ! ]R4      R 4       4       tR tR tR tR t]P                  ! 4       R 4       tR tR t]P                  ! 4       R 4       t R t!R  t"R! t#R" t$]P                  ! 4       R# 4       t%]PL                  ! 4       R$ 4       t']PP                  ! 4       R% 4       t)]PT                  ! 4       ]PV                  ! ],;'       d    ]-! 4       '       * R&4      R' 4       4       t.]P                  ! 4       R( 4       t/R) t0R*t1V t2R+# )-TestArchivesiO  c                    \         P                  ! V4      ;_uu_ 4       pVP                  4       pVP                  4        \	        V4      uuR R R 4       #   + '       g   i     R # ; ir(   )tarfiler:   getnamessortr5   )r   r6   tarr  s   &&  r#   _tarinfoTestArchives._tarinfoS  s=    \\$3LLNEJJL<  s   +AA&	c                   V P                  4       p\        P                  P                  W!4      p\        P                  ! VR R7       \        VR3R4       \        VR3R4       \        P                  ! \        P                  P                  VR4      4       \        VRR3R4       \        P                  ! \        P                  P                  VR4      4       V'       d   \        VR3R4       W!3# )	T)exist_okr   r_  r^  r  file3sub2outer)r   r)   r6   r7   r  r>   r   )r   r1  root_dirdists   &&  r#   _create_filesTestArchives._create_filesY  s    <<>ww||H/
D4(T7OU+T7OU+
dE*+T5'*E2
dF+,7+U3!!r%   c                :	   V P                  4       w  r\        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  R R4      p\        VRV4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! VR4      ;_uu_ 4       pV P                  VP!                  4       . RO4       RRR4       RRR4       RRR4       \        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  RR4      p\        VRW4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! VR4      ;_uu_ 4       pV P                  VP!                  4       . RO4       RRR4       RRR4       RRR4       \        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  R	R4      p\        VRV\        P
                  P                  VR
4      4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! VR4      ;_uu_ 4       pV P                  VP!                  4       RR.4       RRR4       RRR4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)rx   archiver  .tarrV   Ndst2dist/subdist/sub/file3dst3r  .z./distz
./dist/subz./dist/sub2z./dist/file1z./dist/file2z./dist/sub/file3z./outerr  r  z	dist/sub2
dist/file1
dist/file2r  )r  r   temp_cwdno_chdirr)   r6   r7   r   r   abspathr   r  r  
is_tarfiler:   assertCountEqualr  r   r  r1  	base_namer  tfs   &     r#   test_make_tarfileTestArchives.test_make_tarfileg  s   !//1!!88UI6I"9eX>GWbggooi&@6&IJOOBGGNN734OOG..w78gs++r%%bkkm$% , $,! !!88VY7I"9eXHGWbggooi&@6&IJOOBGGNN734OOG..w78gs++r%%bkkmGH , $,! !!88VY7I"9eX#%77<<%#@BGWbggooi&@6&IJOOBGGNN734OOG..w78gs++r%%bkkm#%568 , $,!!) ,++ $,88!!!* ,++ $,88!!!( ,+ $,8!!!s   PCO?	#O+8O?	 P-Q<CP;	#P'5P;	=Q*R	9C5Q6	.#Q#Q6	R	+O<6	O?	?P
	PP$	'P82	P;	;Q	QQ 	#Q3.Q6	6RR		R	c                   V P                  4       w  r\        P                  P                  V P	                  4       R R4      p\        P                  P                  W14      p\        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        \        VR4      pV P                  WCR,           4       V P                  \        P                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! VR4      ;_uu_ 4       pV P!                  VP#                  4       . R
O4       RRR4       RRR4       RRR4       \        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        \        P                  P                  R R4      p\        VRVR7      pV P                  WCR,           4       V P                  \        P                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! VR	4      ;_uu_ 4       pV P!                  VP#                  4       . RO4       RRR4       RRR4       RRR4       R#   + '       g   i     ELD; i  + '       g   i     ELP; i  + '       g   i     EL\; i  + '       g   i     L^; i  + '       g   i     Li; i  + '       g   i     R# ; i)rx   r  gztar.tar.gzzr:gzNr  r1  r  rV   r  r  )r  r)   r6   r7   r   relpathr   
change_cwdr  r   r   r   r  r  r  r:   r  r  r  s   &     r#   !test_make_tarfile_without_rootdir.TestArchives.test_make_tarfile_without_rootdir  s   !//1GGLL	B	GGOOI8	!!(++XX"9g6GW)&;<OOBGGNN734OOG..w78gv.."%%bkkm$% / .6+ !!(++XXUI6I"9ehGGW&&89OOBGGNN734OOG..w78gs++r%%bkkmGH , .6++ /.. .6XX+++$ ,+ .6X+++sz   ?J+BJ	%#JJ	J+>K%B9K	#J?)K	1K%J	J	J("	J++J<	?K
K	K"K%%K6	c                6   V P                  4       w  r\        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  R R4      p\        VRV\        P                  4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! VR4      ;_uu_ 4       pV P!                  VP#                  4       . RO4       RRR4       RRR4       RRR4       R#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R# ; i)rx   r  r  r  rV   Nr  )r  r   r  r  r)   r6   r7   r   curdirr   r  r   r  r  r  r:   r  r  r  s   &     r#   &test_make_tarfile_with_explicit_curdir3TestArchives.test_make_tarfile_with_explicit_curdir  s    !//1!!88UI6I"9eXryyIGWbggooi&@6&IJOOBGGNN734OOG..w78gs++r%%bkkm$% , $,!! ,+ $,8!!!s;   FC%E4	$#E!E4	F!E1,E4	4F?FF	r  zNeed the tar command to runc           
        V P                  4       w  r\        P                  P                  V P	                  4       R 4      p\
        ;_uu_ 4        \        VRW4      pRRR4       V P                  XVR,           4       V P                  \        P                  P                  V4      4       \        P                  P                  VR4      pRRRV.p\        P                  R8X  dR   ^ RIp\        VP                  4       ^ ,          P                  R4      ^ ,          4      ^8  d   VP                  ^R	4       \         P"                  ! Wa\         P$                  R
7       V P                  \        P                  P                  V4      4       V P                  V P'                  V4      V P'                  V4      4       \
        ;_uu_ 4        \        VRW4      pRRR4       V P                  WCR,           4       V P                  \        P                  P                  V4      4       \
        ;_uu_ 4        \        VRWRR7      pRRR4       V P                  WCR,           4       V P                  \        P                  P                  V4      4       R#   + '       g   i     EL@; i  + '       g   i     L; i  + '       g   i     L; i)r  r  Nr   zarchive2.tarr  z-cfr   r  z--no-mac-metadatacwdstdoutr  Tdry_run)r  r)   r6   r7   r   r  r   r   r   r  r   r  r   mac_verr   insertr   
check_callDEVNULLr  )r   r  r1  r  tarballtarball2tar_cmdr  s   &       r#   test_tarfile_vs_tar TestArchives.test_tarfile_vs_tar  s    "//1GGLL;	X"9gxJG  	)i"78w/0 77<<.9%:<<8# 8##%a(..s3A672=q"56g%/%7%7	9 	x01w/x1HI X"9eXHG f"45w/0 X"9eX+/1G  	f"45w/0O XX: X Xs$   J
J(4J;J%	(J8	;K	c                4	   V P                  4       w  r\        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  R R4      p\        VRV4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! V4      ;_uu_ 4       pV P                  VP!                  4       . R
O4       RRR4       RRR4       RRR4       \        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  RR4      p\        VRW4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! V4      ;_uu_ 4       pV P                  VP!                  4       . RO4       RRR4       RRR4       RRR4       \        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  RR4      p\        VRV\        P
                  P                  VR	4      4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! V4      ;_uu_ 4       pV P                  VP!                  4       RR.4       RRR4       RRR4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)rx   r  r  .zip	dist/sub/r  Nr  r  r  dist/r  
dist/sub2/r  r  r  r  r  r  r  r  r  r  )r  r   r  r  r)   r6   r7   r   r   r  r   r  zipfile
is_zipfileZipFiler  namelistr   r  r1  r  r  zfs   &     r#   test_make_zipfileTestArchives.test_make_zipfile  s   !//1!!88UI6I"9eX>GWbggooi&@6&IJOOBGGNN734OOG..w78))R%%bkkm"# * $,! !!88VY7I"9eXHGWbggooi&@6&IJOOBGGNN734OOG..w78))R%%bkkmGH * $,! !!88VY7I"9eX#%77<<%#@BGWbggooi&@6&IJOOBGGNN734OOG..w78))R%%bkkm$&679 * $,!!' *)) $,88!!!& *)) $,88!!!& *) $,8!!!s   PCO<	#O(7O<	?P,Q;CP8	#P$3P8	;Q(R7C4Q3	+#Q Q3	R(O93	O<	<P	PP!	$P5/	P8	8Q		QQ	 Q0+Q3	3R>RR	c                   V P                  4       w  r\        P                  P                  V P	                  4       R R4      p\        P                  P                  W14      p\        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        \        VR4      pV P                  WCR,           4       V P                  \        P                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! V4      ;_uu_ 4       pV P!                  VP#                  4       . RO4       RRR4       RRR4       RRR4       V P                  4       w  r\        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        \        P                  P                  R R4      p\        VRVR7      pV P                  WCR,           4       V P                  \        P                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! V4      ;_uu_ 4       pV P!                  VP#                  4       . RO4       RRR4       RRR4       RRR4       R#   + '       g   i     ELU; i  + '       g   i     ELa; i  + '       g   i     ELm; i  + '       g   i     L^; i  + '       g   i     Li; i  + '       g   i     R# ; i)rx   r  r  r  Nr  r  r  )r  r)   r6   r7   r   r  r   r  r  r   r   r   r  r   r!  r"  r  r#  r$  s   &     r#   !test_make_zipfile_without_rootdir.TestArchives.test_make_zipfile_without_rootdir  s   !//1GGLL	B	GGOOI8	!!(++XX"9e4GW&&89OOBGGNN734OOG..w78))R%%bkkm"# * .6+ "//1!!(++XXUI6I"9ehGGW&&89OOBGGNN734OOG..w78))R%%bkkmGH * .6++ *)) .6XX+++& *) .6X+++sz   ?J;BJ'	$#JJ'	J;K5B8K"	#K9K"	K5J$	J'	'J82	J;;K	KK"	"K2-K55L	c                4   V P                  4       w  r\        P                  ! 4       ;_uu_ 4        \        ;_uu_ 4        \        P
                  P                  R R4      p\        VRV\        P                  4      pV P                  V\        P
                  P                  V4      R,           4       V P                  \        P
                  P                  V4      4       V P                  \        P                  ! V4      4       \        P                  ! V4      ;_uu_ 4       pV P!                  VP#                  4       . RO4       RRR4       RRR4       RRR4       R#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R# ; i)rx   r  r  r  Nr  )r  r   r  r  r)   r6   r7   r   r  r   r  r   r  r   r!  r"  r  r#  r$  s   &     r#   &test_make_zipfile_with_explicit_curdir3TestArchives.test_make_zipfile_with_explicit_curdir2  s     "//1!!88UI6I"9eXryyIGWbggooi&@6&IJOOBGGNN734OOG..w78))R%%bkkm"# * $,!! *) $,8!!!s;   FC$E3	##E E3	F E0+E3	3F>FF	r  zNeed the zip command to runc                   V P                  4       w  r\        P                  P                  V P	                  4       R 4      p\
        ;_uu_ 4        \        VRW4      pRRR4       V P                  XVR,           4       V P                  \        P                  P                  V4      4       \        P                  P                  VR4      pRRRRV.p\        P                  ! Wa\        P                  R7       V P                  \        P                  P                  V4      4       \        P                  ! V4      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! V4      ;_uu_ 4       pVP                  4       p	RRR4       V P                  \!        X4      \!        X	4      4       R#   + '       g   i     ELg; i  + '       g   i     L; i  + '       g   i     L]; i)r  r  Nr  zarchive2.zipz-qz-rr  )r  r)   r6   r7   r   r  r   r   r   r  r   r  r  r   r"  r#  r`   )
r   r  r1  r  r  archive2zip_cmdr%  r  names2s
   &         r#   test_zipfile_vs_zip TestArchives.test_zipfile_vs_zipB  sE    "//1GGLL;	X"9eXHG  	)f"45w/0 77<<.9$nh?g%/%7%7	9 	x01__W%%KKME &__X&&"[[]F 'v7' XX &%&&s$   F;G<G";G	G	"G2	unzipzNeed the unzip command to runc           	       a V P                  4       w  r\        P                  P                  V P	                  4       R 4      p\
        ;_uu_ 4        \        VRW4      pRRR4       V P                  XVR,           4       V P                  \        P                  P                  V4      4       RRV.p\        P                  ! V4      ;_uu_ 4         \        P                  ! V\        P                  R7       RRR4       R#   + '       g   i     L; i  \        P                   d   pTP                   P#                  RR7      o\$        ;QJ d    T3R	 lR 4       F  '       g   K   R
M	  RM! T3R	 lR 4       4      '       d   T P'                  R4       RpT P)                  TP+                  TS4      4        Rp?LRp?ii ; i  + '       g   i     R# ; i)r  r  Nr  r4  z-t)stderrreplace)r   c              3   ,   <"   T F	  qS9   x  K  	  R # 5ir(   rA   )r  messagedetailss   & r#   r  2TestArchives.test_unzip_zipfile.<locals>.<genexpr>q  s       :g') :s   TFzunzip doesn't support -tz{}

**Unzip Output**
{})zunrecognized option: tzinvalid option -- t)r  r)   r6   r7   r   r  r   r   r   r  r   r  r   check_outputSTDOUTCalledProcessErroroutputdecodeanyr  r  format)	r   r  r1  r  r  r0  r   msgr:  s	   &       @r#   test_unzip_zipfileTestArchives.test_unzip_zipfile]  s]    "//1GGLL;	X"9eXHG  	)f"45w/0 D'*!!(++
4''
8I8IJ ,+ X 00 4**++9+=3  : 333  :    MM"<=2		#**S'2334 ,++sH   DG&DD	G*;F?(F?4F?:G?GGG	c                    V P                  4       p\        P                  P                  VR 4      pV P	                  \
        \        VR4       R# )r  r_  N)r   r)   r6   r7   r   
ValueErrorr   )r   r   r  s   &  r#   test_make_archiveTestArchives.test_make_archivey  s5    GGLL3	*lIuEr%   c           	        \         '       d<   \        P                  ! ^ 4      ^ ,          p\        P                  ! ^ 4      ^ ,          pMR;rV P                  4       w  r4\        P                  P                  V P                  4       R4      p\        VRW4VVR7      pV P                  \        P                  P                  V4      4       \        VRW44      pV P                  \        P                  P                  V4      4       \        VRW4W!R7      pV P                  \        P                  P                  V4      4       \        VRW4RRR7      pV P                  \        P                  P                  V4      4       R# )	r   r  r  r  ownergroupr  	kjhkjhkjgoihohohN)UID_GID_SUPPORTgrpgetgrgidpwdgetpwuidr  r)   r6   r7   r   r   r   r  )r   rM  rL  r  r1  r  rf   s   &      r#   test_make_archive_owner_group*TestArchives.test_make_archive_owner_group~  s    ?LLOA&ELLOA&E""E!//1GGLL;	9eXu!&(s+,9eX@s+,9eX!&5s+,9eX!,I?s+,r%   Requires grp and pwd supportc                T   V P                  4       w  r\        P                  P                  V P	                  4       R 4      p\
        P                  ! ^ 4      ^ ,          p\        P                  ! ^ 4      ^ ,          p\        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        \        VRVRWTR7      pRRR4       RRR4       V P                  \        P                  P                  X4      4       \        P                   ! V4      p VP#                  4        F;  pV P%                  VP&                  ^ 4       V P%                  VP(                  ^ 4       K=  	  VP+                  4        R#   + '       g   i     L; i  + '       g   i     L; i  TP+                  4        i ; i)r  r  r  rK  N)r  r)   r6   r7   r   rQ  rR  rS  rT  r   r  r  r   r   r  r  r:   
getmembersr   uidgidrW  )	r   r  r1  r  rM  rL  archive_namer  members	   &        r#   test_tarfile_root_owner$TestArchives.test_tarfile_root_owner  s    "//1GGLL;	Q"Q"!!(++XX'	7Hf.3BL .6+
 	|45 ,,|,	!,,.  Q/  Q/ / MMO .6X++ MMOs1   F(E/	9FAF /E?:FF	F'c           	       a a \         P                  ! 4       oVV 3R  lp\        RV. R4        \        ;_uu_ 4        S P	                  \
        4      ;_uu_ 4        \        RR4       RRR4       RRR4       S P                  \         P                  ! 4       S4       \        R4       R#   + '       g   i     LJ; i  + '       g   i     LU; i  \        R4       i ; i)c                    < SP                  R V4       SP                  V R4       SP                  \        P                  ! 4       S4       \	        4       hr  basename)r  r   r)   rr   RuntimeError)r  r1  kwcurrent_dirr   s   &&,r#   archiver<TestArchives.test_make_archive_cwd_default.<locals>.archiver  sA    Z,Y
3RYY[+6. r%   r_  xxx filerc  N)	r)   rr   r   r  r   rd  r   r   r   )r   rg  rf  s   f @r#   test_make_archive_cwd_default*TestArchives.test_make_archive_cwd_default  s    iik	! 	 xZ@	-&&|44 U3 5  RYY[+6%e,	 54 
 &e,s:   C B<B)	'B</-C )B94B<<C	C Cc           
     P  a aaaa \         P                  ! 4       oS P                  4       oVVV 3R  lp. oVV3R lp\        RV. R4        \        P
                  ! \         RV4      ;_uu_ 4       oS P                  \        4      ;_uu_ 4        \        RRSR7       RRR4       RRR4       S P                  \         P                  ! 4       S4       S P                  SSS.4       \        R4       R#   + '       g   i     L^; i  + '       g   i     Li; i  \        R4       i ; i)c                    < SP                  R V4       SP                  V \        P                  P	                  SR4      4       SP                  \        P
                  ! 4       S4       \        4       hrb  )r  r   r)   r6   r7   rr   rd  r  r1  re  rf  r  r   s   &&,r#   rg  4TestArchives.test_make_archive_cwd.<locals>.archiver  sP    Z,Y[*(MNRYY[(3. r%   c                 :   < SP                  V 4       S! V 4       R # r(   r   )r6   r  
orig_chdirs   &r#   _chdir2TestArchives.test_make_archive_cwd.<locals>._chdir  s    KKtr%   r_  ri  chdirrc  r  N)r)   rr   r   r   r   r[  r   rd  r   r   r   )r   rg  rr  rf  r  rq  r  s   f  @@@@r#   test_make_archive_cwd"TestArchives.test_make_archive_cwd  s    iik<<>	!
 	 	 xZ@	-""2w77:&&|44 UXF 5 8 RYY[+6THk#:;%e, 54 87 &e,s=   $D /DC2	D$AD 2D=DD	D D%c           
       a aa \         P                  ! 4       oS P                  4       oVVV 3R  lpRVn        \	        RV. R4        \
        ;_uu_ 4        S P                  \        4      ;_uu_ 4        \        RRSR7       RRR4       RRR4       S P                  \         P                  ! 4       S4       \        R4       R#   + '       g   i     LJ; i  + '       g   i     LU; i  \        R4       i ; i)c                    < SP                  V R 4       SP                  VR,          S4       SP                  \        P                  ! 4       S4       \        4       h)rc  r  )r   r)   rr   rd  rn  s   &&,r#   rg  FTestArchives.test_make_archive_cwd_supports_root_dir.<locals>.archiver  sE    Y
3R
^X6RYY[+6. r%   Tr_  ri  rc  ru  N)r)   rr   r   supports_root_dirr   r  r   rd  r   r   r   )r   rg  rf  r  s   f @@r#   'test_make_archive_cwd_supports_root_dir4TestArchives.test_make_archive_cwd_supports_root_dir  s    iik<<>	!
 &*"xZ@	-&&|44 UXF 5  RYY[+6%e,	 54 
 &e,s<   C* C3C	C
-C* CCC'	"C* *C7c           
        V P                  4       p\        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        V P	                  \        R R4      R4       V P                  \        P                  P                  R4      4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)testr  ztest.tarN
r   r   r  r  r   r   r   r)   r6   r  r   r  s   & r#   test_make_tarfile_in_curdir(TestArchives.test_make_tarfile_in_curdir  sl    <<>!!(++XX\&%8*EOOBGGNN:67 .6++XX+++#   B.AB		B.B+&B..B?	c           
        V P                  4       p\        P                  ! V4      ;_uu_ 4        \        ;_uu_ 4        V P	                  \        R R4      R4       V P                  \        P                  P                  R4      4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  r  ztest.zipNr  r  s   & r#   test_make_zipfile_in_curdir(TestArchives.test_make_zipfile_in_curdir  sn     <<>!!(++XX\&%8*EOOBGGNN:67 .6++XX+++r  c                   V P                  \        \        R ^4       V P                  \        \        R R ^4       V P                  \        \        R R RR.4       \        R R R.R4       \        4        UUu. uF  w  rVNK	  	  pppV P	                  R V4       \        R 4       \        4        UUu. uF  w  rVNK	  	  pppV P                  R V4       R# u uppi u uppi )r_  c                      \         # r(   xrA   r%   r#   <lambda>;TestArchives.test_register_archive_format.<locals>.<lambda>       Qr%   c                      \         # r(   r  rA   r%   r#   r  r    r  r%   c                      \         # r(   r  rA   r%   r#   r  r    s    qr%   ri  N)rR  r!  )rR  r!  r   )r   r   r   r   r"  r   r  )r   rg   paramsformatss   &   r#   test_register_archive_format)TestArchives.test_register_archive_format  s    )%<eQG)%<eY	)%<eY!9-	/ 	 y6(JG,?,AB,ALD4,ABeW%!%(,?,AB,ALD4,AB( C Cs   8C2Cc                   V P                  \        P                  \         R 24       R EF  pV P	                  VR7      ;_uu_ 4        V P                  4       p\        P                  P                  VR4      pV P                  \        4      ;_uu_ 4       p\        \        RW1R7       RRR4       V P                  XP                  P                  \        P                  4       V P                  VP                  P                   V4       V P#                  \        P                  P%                  \         R 24      4       \&        P(                  ! VR7      w  rV\        P*                  ! V4       V P                  \,        4      ;_uu_ 4       p\        \        RWaR7       RRR4       V P                  VP                  P                  \        P.                  4       V P                  VP                  P                   V4       V P#                  \        P                  P%                  \         R 24      4       RRR4       EK  	  R#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     EKT  ; i)r  r  nonexistingr  Nr   FTr   r   rt   r   subTestr   r)   r6   r7   r   r   r   r   r   r    ENOENTr   r   r   rp   ri  rW  r   ENOTDIRr   r  rL  nonexisting_filer   tmp_fdtmp_files   &      r#   test_make_tarfile_rootdir_nodir,TestArchives.test_make_tarfile_rootdir_nodir  s   	((VHD/:$Gg..,,.#%77<<#G &&'899R 0@R :  !3!3U\\B  !6!68HI  6($!@A $,#3#3#@  &&'9::b J ;  !3!3U]]C  !6!6A  6($!@A# /. %
 :99 ;: /..?   AI,I)C#I,IBI,I	I,I)$I,,I>c                   V P                  \        P                  \         R 24       R EF  pV P	                  VR7      ;_uu_ 4        V P                  4       p\        P                  P                  VR4      pV P                  \        4      ;_uu_ 4       p\        \        RW1R7       RRR4       V P                  XP                  P                  \        P                  4       V P                  VP                  P                   V4       V P#                  \        P                  P%                  \         R 24      4       \&        P(                  ! VR7      w  rV\        P*                  ! V4       V P                  \,        4      ;_uu_ 4       p\        \        RWaR7       RRR4       V P                  VP                  P                  \        P.                  4       V P                  VP                  P                   V4       V P#                  \        P                  P%                  \         R 24      4       RRR4       EK  	  R#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     EKT  ; i)r  r  r  r  Nr   r  r  r  s   &      r#   test_make_zipfile_rootdir_nodir,TestArchives.test_make_zipfile_rootdir_nodir$  s    		((VHD/:$Gg..,,.#%77<<#G &&'899R 0@R :  !3!3U\\B  !6!68HI  6($!@A $,#3#3#@  &&'9::b J ;  !3!3U]]C  !6!6A  6($!@A# /. %
 :99 ;: /..r  c                    V P                   ! VR  3/ VB  V P                   ! V\        3/ VB  V P                   ! V\        3/ VB  R# )c                     V # r(   rA   r6   s   &r#   r  3TestArchives.check_unpack_archive.<locals>.<lambda>@  s    r%   N)#check_unpack_archive_with_converterr   )r   rB  r"   s   &&,r#   check_unpack_archive!TestArchives.check_unpack_archive>  sN    00%	1)/	100H	( &	(00LVLr%   c                @   V P                  4       w  rE\        V4      pVP                  R 4       \        P                  P                  V P                  4       R4      p\        WqWE4      pV P                  4       p	\        V! V4      V! V	4      3/ VB  V P                  \        V	4      V4       V P                  4       p
\        V! V4      V! V
4      3RV/VB  V P                  \        V
4      V4       V P                  \        P                  4      ;_uu_ 4        \        V! \        4      3/ VB  RRR4       V P                  \        4      ;_uu_ 4        \        V! \        4      3RR/VB  RRR4       R#   + '       g   i     LP; i  + '       g   i     R# ; i)r  r  rB  Nr_  )r  re   rj  r)   r6   r7   r   r   r   r   r   r   	ReadErrorr   rG  )r   rB  	converterr"   r  r1  expectedr  r   r  tmpdir3s   &&&,       r#   r  0TestArchives.check_unpack_archive_with_converterE  sB   !//1H% GGLL;		8F ,,.y*Ig,>I&I'*H5 ,,.y*Ig,> 	!v 	!	!'*H5v//009V,77 1z**9V,EUEfE +* 10***s   E9F9F		F	c                R    V P                  VR R7       V P                  VRR7       R# )fully_trustedfilterdataN)r  )r   rB  s   &&r#   check_unpack_tarball!TestArchives.check_unpack_tarball]  s(    !!&!A!!&!8r%   c                (    V P                  R 4       R# )r  Nr  r~  s   &r#   test_unpack_archive_tar$TestArchives.test_unpack_archive_tara  s    !!%(r%   c                (    V P                  R 4       R# )r  Nr  r~  s   &r#   test_unpack_archive_gztar&TestArchives.test_unpack_archive_gztard      !!'*r%   c                (    V P                  R 4       R# )bztarNr  r~  s   &r#   test_unpack_archive_bztar&TestArchives.test_unpack_archive_bztarh  r  r%   c                (    V P                  R 4       R# )zstdtarNr  r~  s   &r#   test_unpack_archive_zstdtar(TestArchives.test_unpack_archive_zstdtarl  s    !!),r%   z(AIX MAXDATA must be 0x20000000 or largerc                (    V P                  R 4       R# )xztarNr  r~  s   &r#   test_unpack_archive_xztar&TestArchives.test_unpack_archive_xztarp  s     	!!'*r%   c                    V P                  R 4       V P                  \        4      ;_uu_ 4        V P                  R RR7       RRR4       R#   + '       g   i     R# ; i)r  r  r  N)r  r   r   r~  s   &r#   test_unpack_archive_zip$TestArchives.test_unpack_archive_zipu  sC    !!%(y))%%eF%; *)))s   AA	c                  a  \        4       pV 3R  lp\        RRR.VR	.4       \        RR4       S P                  \        \        RR.V4       \        R4       \        RR.V4       S P                  RR.R3\        4       4       S P                  RR.R3\        4       4       \        R4       S P                  \        4       V4       R# )
c                 t   < SP                  V^4       SP                  V R4       SP                  VR4       R# )rR  	stuff.booxxN)r   )r   extract_dirextrar   s   &&&r#   _boo/TestArchives.test_unpack_registry.<locals>._boo  s3    UA&X{3[$/r%   Booz.booz.b2r  r  Boo2 N)r  rR  )	r   r	   r   r   r
   r   r"  r  r   )r   r  r  s   f  r#   test_unpack_registry!TestArchives.test_unpack_registry{  s    $&	0
 	uvuotl^L{D) 	-)?!(D	* 	!'vx6vx,.@.BC%&2.0B0DE 	!(+-w7r%   rA   N)r  )3r   r   r   r   r  r  r   requires_zlibr  r  r  r  r  r   whichr  r&  r)  r,  r2  rD  rH  rU  rP  r^  rj  rv  r|  r  r  r  r  r  r  r  r  r  r  requires_bz2r  requires_zstdr  requires_lzmar  r   r   r  r  r  r   r   r   s   @r#   r  r  O  s     " '8 '8R H H8% e,68*18 *1X %9 %9N H H: # # e,6888 80 g.8:4: 42F
 - -6 *HI J *-"-.-&8 8 8) B. B B2MF09) + + + + - - __S---/YZ+ [ + < <
8 8r%   r  c                      a  ] tR tRt o ]P
                  ! ]! ]R4      R4      R 4       t]P
                  ! ]	R4      ]P
                  ! ]! ]
R4      R4      R 4       4       tR	tV tR
# )TestMisci  
disk_usagez)disk_usage not available on this platformc                8   \         P                  ! \        P                  P	                  \
        4      4      pR F"  pV P                  \        W4      \        4       K$  	  V P                  VP                  ^ 4       V P                  VP                  ^ 4       V P                  VP                  ^ 4       V P                  VP                  VP                  4       V P                  VP                  VP                  4       \         P                  ! \
        4       R# )rB   N)rB   usedfree)r   r  r)   r6   r  r  r   r   r   assertGreaterrB   r  assertGreaterEqualr  )r   usagerW  s   &  r#   test_disk_usageTestMisc.test_disk_usage  s     !!"''//(";<-D!!'%"6< .5;;*5::q)

A.UZZ85;;

3 	(#r%   rW  chownzrequires os.chownc           	     |  a  S P                  4       p\        P                  ! VR 7      p\        P                  P                  VR4      p\        VR4       \        P                  ! W#4       S P                  \        4      ;_uu_ 4        \        P                  ! V4       RRR4       S P                  \        4      ;_uu_ 4        \        P                  ! VRR7       RRR4       S P                  \        4      ;_uu_ 4        \        P                  ! VRR7       RRR4       S P                  \        4      ;_uu_ 4        \        P                  ! VR4       RRR4       S P                  \        4      ;_uu_ 4        \        P                  ! VR	4       RRR4       \        P                  ! 4       p\        P                  ! 4       pRV 3R
 llp\        P                  ! W$V4       V! W$V4       \        P                  ! W$4       V! W$4       \        P                  ! W$R7       V! W$4       \        P                  ! W%R7       V! W%R7       \        P                  ! WV4       V! WV4       \        P                  ! W4       V! W4       \        P                  ! WR7       V! W4       \        P                  ! WR7       V! WR7        \         P"                  ! V4      ^ ,          p\$        P&                  ! V4      ^ ,          p\        P                  ! W'V4       V! W$V4       \        P                  ! WV4       V! WV4       \        P*                  ! V\        P,                  4      p	S P/                  \        P0                  V	4       \        P                  P3                  V4      p
\        P                  P3                  V4      p\        P                  ! WWYR7       V! W$V4       \        P                  ! WV	R7       V! W$4       \        P                  ! WV	R7       V! W%R7       \        P                  ! WWYRR7       V! W$V4       \        P                  ! WWYRR7       V! W$V4       \        P                  ! W4RR7       V! W$4       \        P                  ! WV	RR7       V! W%R7       \        P                  ! WWYRR7       V! W$V4       S P                  \        4      ;_uu_ 4        \        P                  ! W$VR7       RRR4       S P                  \4        4      ;_uu_ 4        \        P                  ! RWEV	R7       RRR4       S P                  \        4      ;_uu_ 4        \        P                  ! W)R7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELz; i  + '       g   i     ELQ; i  \(         d     ELi ; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)r   
chown_linkztesting chown functionNznon-existing username)userznon-existing groupname)rM     spamgQ	@c                    < \         P                  ! V 4      pVe   SP                  WP                  4       Ve   SP                  W#P                  4       R # R # r(   )r)   r  r   st_uidst_gid)r6   rZ  r[  sr   s   &&& r#   check_chown(TestMisc.test_chown.<locals>.check_chown  sC    A  hh/  hh/ r%   )r[  r   )rM  r   T)r   rE  FrD  )rM  r   rE  missingfile)NN)r   rp   r   r)   r6   r7   r>   r   r   rG  r   r  LookupErrorr   getuidgetgidrS  rT  rQ  rR  KeyErrorr:   r`  r   rW  rc  r   )r   r  r   linknamerZ  r[  r  r  rM  dirfdrc  baselinknames   f           r#   
test_chownTestMisc.test_chown  s    ,,.??w/77<<6H67


8&z**LL" + {++LL(?@ , {++LL)AB , y))LL7+ * y))LL4( * iikiik	0 	XC(H3'X#H"X(H"X)H&W3'G#&W"G!W'G!W(G%
	+<<$Q'DLL%a(E
 LL/s+LL.c*-%(77##H-ww''1XC6H3'X51H"X7H&XCtLH3'XCuMH3'XD9H"\UERH&\4PH3'y))LLw7 * 011LL? 2 z**LL0 +*e +** ,++ ,++ *)) *))D  		< *)) 21 +**sr   VV!V5 W	=W
:W1 .X,X+X*V	!V2	5W		W	W.	1X ?X X	X'	*X;	rA   N)r   r   r   r   r  r  ro   r   r  rP  r)   r  r   r   r   s   @r#   r  r    ss     6DF$F$ *HIW-/BCZ1 D JZ1r%   r  c                   0  a  ] tR tRt o R t]! ]P                  4      tR t	R t
R tR tR t]P                  ! ]P"                  R8g  R	4      R
 4       t]P                  ! ]P"                  R8H  R4      R 4       t]P                  ! ]P"                  R8H  R4      R 4       t]P,                  R 4       tR tR t]P                  ! ]P"                  R8H  R4      R 4       tR tR tR tR tR tR t ]P                  ! ]P"                  R8H  R4      R 4       t!]P                  ! ]P"                  R8H  R4      R 4       t"]P                  ! ]P"                  R8H  R4      R 4       t#]P                  ! ]P"                  R8H  R4      R 4       t$]P                  ! ]P"                  R8H  R4      R 4       t%]P                  ! ]P"                  R8H  R4      R 4       t&]P                  ! ]P"                  R8H  R4      R  4       t']P                  ! ]P"                  R8H  R4      R! 4       t(]P                  ! ]P"                  R8H  R4      R" 4       t)]P                  ! ]P"                  R8H  R4      R# 4       t*]P                  ! ]P"                  R8H  R4      R$ 4       t+R%t,V t-R&# )'	TestWhichi	  c                   V P                  R R7      p\        P                  P                  V\        R,           4      p\        P
                  ! V4       \        P                  P                  V\        R,           4      V n        \        P
                  ! V P                  4       \        P                  P                  V\        R,           4      V n        \        P
                  ! V P                  4       \        R,           V n        \        P                  P                  V P                  V P                  4      V n	        V P                  V P                  4       V P                  V n        \        P                  V n        RV n        R# )Tmp)r   z-basedirz-dirz-dir2z.Exez.EXEN)r   r)   r6   r7   r   r   rm   	other_dirfilefilepathr>   env_pathr  ext)r   temp_dirr1  s   &  r#   setUpTestWhich.setUp		  s    <<u<-77<<&:*=>
77<<&6/:
h0@A
  VO	TXXtyy9'iir%   c                J    \        V4       \        P                  ! VR 4       R# )i  N)r>   r)   r  )r   r6   s   &&r#   r>   TestWhich.create_file	  s    D
ur%   c                    V P                  \        P                  P                  V4      \        P                  P                  V4      4       R # r(   )r   r)   r6   normcase)r   r  r  s   &&&r#   assertNormEqualTestWhich.assertNormEqual 	  s0    ))&12773C3CH3MNr%   c                    \         P                  ! V P                  V P                  R 7      pV P	                  WP
                  4       R# r  N)r   r  r  rm   r   r	  r   r)  s   & r#   
test_basicTestWhich.test_basic#	  s,    \\$))$((3]]+r%   c                    \         P                  ! V P                  V P                  R 7      pV P	                  WP                  4       R# r  )r   r  r	  r  r   r  s   & r#   test_absolute_cmdTestWhich.test_absolute_cmd(	  s.     \\$--dnn=]]+r%   c                d   \         P                  P                  V P                  4      w  r\         P                  P	                  W P
                  4      p\        P                  ! VR 7      ;_uu_ 4        \        P                  ! W0P                  R 7      pV P                  WC4       RRR4       \        P                  ! V P                  R 7      ;_uu_ 4        \        P                  ! W1R 7      pV P                  V4       RRR4       R#   + '       g   i     Ll; i  + '       g   i     R# ; ir  )r)   r6   r   rm   r7   r  r   r  r   r  r  r   assertIsNone)r   r1  tail_dirr  r)  s   &    r#   test_relative_cmdTestWhich.test_relative_cmd.	  s      WW]]4884'',,x3!!x00gNN;BR) 1 !!txx00g5Bb! 10	 10 100s   43D)DD	D/	r  ztest is for non win32c                   \         P                  ! V P                  R 7      ;_uu_ 4        \        P                  ! V P
                  V P                  R 7      pV P                  V4       RRR4       R#   + '       g   i     R# ; ir  )r   r  rm   r   r  r  r  r  r  s   & r#   test_cwd_non_win32TestWhich.test_cwd_non_win32;	  sN     !!txx00diidnn=Bb! 1000s   >A22B	ztest is for win32c                R   \         P                  P                  V P                  4      p\        P
                  ! V P                  R 7      ;_uu_ 4        \        P                  P                  RRR7      ;_uu_ 4        \        P                  ! V P                  V P                  R 7      pV P                  V\         P                  P                  V P                  V P                  4      4       RRR4       \        P                  P                  RRR7      ;_uu_ 4        \        P                  ! V P                  V P                  R 7      pV P!                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     L-; i  + '       g   i     R# ; i)r  shutil._win_path_needs_curdirTreturn_valueNF)r)   r6   r  rm   r   r  r  r4  r5  r   r  r  r  r   r7   r  r  )r   r1  r)  s   &  r#   test_cwd_win32TestWhich.test_cwd_win32D	  s     77??488,!!txx00$$%DSW$XX\\$))$..A  RWW\\$++tyy%IJ Y $$%DSX$YY\\$))$..A!!"% Z 10XX ZY 100s=   *F=A1E/	.1F>F	F/E?:FFFF&	c                   \         P                  P                  V P                  V P                  4      pV P                  V4       \        P                  P                  R RR7      ;_uu_ 4        \        P                  ! V P                  R7      ;_uu_ 4        \        P                  ! V P                  V P                  R7      pV P                  V\         P                  P                  V P                  V P                  4      4       RRR4       \        P                  ! V P                  R7      ;_uu_ 4        \        P                  ! V P                  V P                  R7      pV P                  V\         P                  P                  V P                  V P                  4      4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     L-; i  + '       g   i     R# ; i)r&  Tr'  r  N)r)   r6   r7   r  r  r>   r  r4  r5  r   r  rm   r   r  r   r  )r   other_file_pathr)  s   &  r#   *test_cwd_win32_added_before_all_other_path4TestWhich.test_cwd_win32_added_before_all_other_pathR	  s#    '',,t~~tyyA)]]  !@t TT%%48844\\$))$..A  RWW\\$++tyy%IJ 5 %%4>>::\\$))$((;  RWW\\$++tyy%IJ ;	 UT44 ;:	 UTTs>   /*G$A1F>	
1G$;A1G	,G$>G	G$G!G$$G5	c                   \         P                  ! V P                  \        P                  4       \         P
                  ! V P                  \         P                  4      '       d   V P                  R 4       \        P                  ! V P                  V P                  \         P                  R7      pV P                  V4       R# )zcan't set the file read-onlyr6   r\   N)r)   r  r	  r  r  accessW_OKr  r   r  r  rm   r  r  s   & r#   test_non_matching_mode TestWhich.test_non_matching_mode_	  sl     	-99T]]BGG,,MM89\\$))$((A"r%   c           	        \         P                  P                  V P                  4      w  r\        P
                  ! VR 7      ;_uu_ 4        \        P                  ! V P                  VR 7      pV P                  V\         P                  P                  W P                  4      4       RRR4       R#   + '       g   i     R# ; ir  )r)   r6   r   rm   r   r  r   r  r  r   r7   )r   r1  r  r)  s   &   r#   test_relative_pathTestWhich.test_relative_pathh	  sp    WW]]4884!!x00diih7BRh		!BC 1000s   AB11C	c                l    \         P                  ! R V P                  R7      pV P                  V4       R# )zfoo.exer  N)r   r  rm   r  r  s   & r#   test_nonexistent_fileTestWhich.test_nonexistent_filen	  s$    \\)$((3"r%   zpathext check is Windows-onlyc                    \         P                  ! V P                  R R V P                  R7      pV P	                  WP
                  R R V P                  ,           4       R # )Nr  )r   r  r  rm   r   r	  r  r  s   & r#   test_pathext_checkingTestWhich.test_pathext_checkings	  sD    
 \\$))CR.txx8]]3B/$((:;r%   c                   \         P                  ! 4       ;_uu_ 4       pV P                  VR &   \        P                  ! V P
                  4      pV P                  W P                  4       RRR4       R#   + '       g   i     R# ; iPATHN)r   EnvironmentVarGuardr
  r   r  r  r   r	  r   envr)  s   &  r#   test_environ_pathTestWhich.test_environ_path{	  sS    **,,--CKdii(BR/ -,,,s   AA33B	c                   \         P                  ! 4       ;_uu_ 4       pR VR&   \        P                  P	                  RV P
                  RR7      ;_uu_ 4        \        P                  ! \        RV P
                  4      ;_uu_ 4        \         P                  ! V P
                  4      ;_uu_ 4        \        P                  ! V P                  4      pV P                  V4       RRR4       RRR4       RRR4       RRR4       R#   + '       g   i     L*; i  + '       g   i     L5; i  + '       g   i     L@; i  + '       g   i     R# ; i)r  rA  
os.confstrTr(  createdefpathN)r   rB  r  r4  r5  rm   r   r[  r)   r  r   r  r  r  rC  s   &  r#   test_environ_path_empty!TestWhich.test_environ_path_empty	  s    **,,CK$$\,0 % 2 2""2y$((;;%%dhh//\\$)),!!"% 0 <2 -,
 0/ <;2 2 -,,sS   :D=/D*	)D02D"D*D*	2D=DDD'"D*	*D:5D==E	c                   V P                   p\        P                  R 8X  d+   \        P                  P                  V P                  V4      p\        P                  ! 4       ;_uu_ 4       p\        P                  VR&   \        P                  P                  RV P                  RR7      ;_uu_ 4        \        P                  ! \        RV P                  4      ;_uu_ 4        \         P"                  ! V P                   4      pV P%                  V4       \        P&                  ! V P                  4      ;_uu_ 4        \         P"                  ! V P                   4      pV P)                  W14       RRR4       RRR4       RRR4       RRR4       R#   + '       g   i     L*; i  + '       g   i     L5; i  + '       g   i     L@; i  + '       g   i     R# ; i)r  rA  rH  TrI  rK  N)r  r   r  r)   r6   r7   r  r   rB  pathsepr  r4  r5  rm   r   r[  r   r  r  r  r   )r   expected_cwdrD  r)  s   &   r#   test_environ_path_cwdTestWhich.test_environ_path_cwd	  s&   yy<<7"77<<\BL **,,**CK$$\,0 % 2 2""2y$((;;\\$)),!!"% ))$((33dii0B$$R6 4 <2 -, 43 <;2 2 -,,sV   )AG1/F4	 AF!:2F,F!4F4	<GFF!!F1,F4	4G?GG	c                   \         P                  ! 4       ;_uu_ 4       pVR  \        P                  P	                  R\
        RR7      ;_uu_ 4        \        P                  ! \        RV P                  4      ;_uu_ 4        \        P                  ! V P                  4      pRRR4       RRR4       V P                  XV P                  4       \        P                  P	                  RV P                  RR7      ;_uu_ 4        \        P                  ! \        RR4      ;_uu_ 4        \        P                  ! V P                  4      pRRR4       RRR4       V P                  W P                  4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lc; i  + '       g   i     Ln; i  + '       g   i     R# ; i)rA  rH  T)r   rJ  rK  NrI  r  )r   rB  r  r4  r5  rG  r   r[  r)   rm   r   r  r  r   r	  rC  s   &  r#   test_environ_path_missing#TestWhich.test_environ_path_missing	  s4   **,,F $$\z,0 % 2 2""2y$((;;\\$)), <2 R/ $$\,0 % 2 2""2y"55\\$)), 62 R/ -, <;2 2 652 2 -,,sl   2G/F	?!E; F	(AG %F4	%!F!F4	#G;FF	FG!F1,F4	4G?GG	c           	        \         P                  P                  V P                  4      p\        P
                  ! V P                  R 7      ;_uu_ 4        \        P                  ! 4       ;_uu_ 4       pV P                  VR&   \        P                  ! V P                  RR 7      pV P                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  rA  r  N)r)   r6   r  rm   r   r  rB  r
  r   r  r  r  )r   r1  rD  r)  s   &   r#   test_empty_pathTestWhich.test_empty_path	  s    77??488,!!txx00**,,--CKdiib1Bb! - 10,, 100s%   C1AC	4CCCC*	c                    \         P                  ! 4       ;_uu_ 4       pVR  \        P                  ! V P                  4      pV P                  V4       RRR4       R#   + '       g   i     R# ; ir@  )r   rB  r   r  r  r  rC  s   &  r#   test_empty_path_no_PATH!TestWhich.test_empty_path_no_PATH	  sI    **,,Fdii(Bb! -,,,s   5AA.	ztest specific to Windowsc           	        R pV P                  \        4      pW P                  V4      ,           p\        P                  P	                  V P
                  V4      pV P                  V4       \        P                  ! 4       ;_uu_ 4       pWR&   V P                  \        P                  ! W P
                  R7      V4       V P                  \        P                  ! W0P
                  R7      V4       RRR4       R#   + '       g   i     R# ; i).xyzPATHEXTr  Nto_text_typer  r)   r6   r7   rm   r>   r   rB  r   r   r  r   r  cmdcmdextr	  rD  s   &     r#   test_pathextTestWhich.test_pathext	  s    (((--77<<&1"**,, 	NV\\#HH=xHV\\&xx@(K -,,,   A'C88D		c           	     (   R pV P                  \        4      pW P                  V4      ,           p\        P                  P	                  V P
                  V4      pV P                  V4       \        P                  ! 4       ;_uu_ 4       pVR,           VR&   V P                  \        P                  ! W P
                  R7      V4       V P                  \        P                  ! W0P
                  R7      V4       RRR4       R#   + '       g   i     R# ; i)r]  ;r^  r  Nr_  ra  s   &     r#   test_pathext_with_empty_str%TestWhich.test_pathext_with_empty_str	  s    (((--77<<&1"**,, 3YC	NV\\#HH=xHV\\&xx@(K -,,,s   A/D  D	c           	        R pV P                  \        4      pW P                  V4      ,           p\        P                  P	                  V P
                  V4      pV P                  V4       \        P                  ! 4       ;_uu_ 4       pWR&   V P                  \        P                  ! W P
                  R7      V4       V P                  \        P                  ! W0P
                  R7      V4       RRR4       R#   + '       g   i     R# ; i)z.foo.barr^  r  Nr_  ra  s   &     r#   $test_pathext_with_multidot_extension.TestWhich.test_pathext_with_multidot_extension	  s    (((--77<<&1"**,, 	NV\\#HH=xHV\\&xx@(K -,,,rf  c           	        V P                  \        4      pWP                  R 4      ,           p\        P                  P	                  V P
                  V4      pV P                  V4       \        P                  ! 4       ;_uu_ 4       pRVR&   V P                  \        P                  ! WP
                  R7      4       V P                  \        P                  ! W P
                  R7      4       RVR&   V P                  \        P                  ! WP
                  R7      V4       V P                  \        P                  ! W P
                  R7      W0P                  R 4      ,           4       RVR&   V P                  \        P                  ! WP
                  R7      V4       V P                  \        P                  ! W P
                  R7      W0P                  R 4      ,           4       RRR4       R#   + '       g   i     R# ; i)r  r]  r^  r  z.xyz;.z.xyz;..N)r`  r  r)   r6   r7   rm   r>   r   rB  r  r   r  r   )r   rb  cmddotr	  rD  s   &    r#    test_pathext_with_null_extension*TestWhich.test_pathext_with_null_extension	  sT   (((--77<<#."**,,#C	Nfll3XX>?fll6AB%C	NV\\#HH=xHV\\&xx@%(9(9#(>>@&C	NV\\#HH=xHV\\&xx@%(9(9#(>>@ -,,,s   EG--G>	c           	     &   R pV P                  \        4      pW P                  V4      ,           pV P                  R4      p\        P                  P	                  V P
                  V4      pV P                  V4       \        P                  ! 4       ;_uu_ 4       pVR,           VR&   V P                  \        P                  ! W P
                  R7      V4       V P                  \        P                  ! W0P
                  R7      V4       V P                  \        P                  ! W$,           V P
                  R7      4       V P                  \        P                  ! W4,           V P
                  R7      4       RRR4       R#   + '       g   i     R# ; i)r]  r  r^  r  N)r`  r  r)   r6   r7   rm   r>   r   rB  r   r   r  r  )r   r  rb  rc  dotr	  rD  s   &      r#   $test_pathext_extension_ends_with_dot.TestWhich.test_pathext_extension_ends_with_dot	  s   (((--$77<<&1"**,, 3YC	NV\\#HH=xHV\\&xx@(Kfll39488DEfll6<dhhGH -,,,s   CE??F	c                2   R pV P                  \        4      pW P                  V4      ,           p\        P                  P	                  V P
                  V4      pV P                  V4       \        P                  ! 4       ;_uu_ 4       p\        P                  ! V P
                  4      VR&   WR&   V P                  \        P                  ! V4      V4       V P                  \        P                  ! V4      V4       RRR4       R#   + '       g   i     R# ; i)r]  rA  r^  N)r`  r  r)   r6   r7   rm   r>   r   rB  fsdecoder   r   r  ra  s   &     r#   %test_pathext_applied_on_files_in_path/TestWhich.test_pathext_applied_on_files_in_path
  s    (((--77<<&1"**,,++dhh/CK 	NV\\#.9V\\&18<	 -,,,s   A4DD	c                   \         P                  P                  R RR7      ;_uu_ 4       pV P                  \        P
                  ! R\        P                  4      4       VP                  R4       VP                  4        V P                  \        P
                  ! R^ 4      4       VP                  4        RRR4       \         P                  P                  R RR7      ;_uu_ 4       pV P                  \        P
                  ! R\        P                  4      4       VP                  R4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z&_winapi.NeedCurrentDirectoryForExePathTr'  dontcareNF)r  r4  r5  r   r   _win_path_needs_curdirr)   X_OKassert_called_once_with
reset_mockassert_not_calledr   )r   need_curdir_mocks   & r#   test_win_path_needs_curdir$TestWhich.test_win_path_needs_curdir
  s    ]]  !IX\ ]]aqOOF99*bggNO44Z@'')OOF99*aHI..0 ^ ]]  !IX] ^^brV:::rwwOP44Z@ _^ ^] _^^s   BD7'AE
7E	
E	c                   V P                   pV P                  \        P                  ! WP                  R 7      V P
                  4       V P                  \        P                  ! WP                  \        P                  R7      V P
                  4       WP                  R4      ,           p\        P                  P                  V P                  V4      pV P                  V4       V P                  \        P                  ! WP                  R 7      V P
                  4       V P                  \        P                  ! WP                  \        P                  R7      V P
                  4       V P                  \        P                  ! W P                  R 7      V4       V P                  \        P                  ! W P                  \        P                  R7      V4       R# r  r0  z.comN)r  r  r   r  rm   r	  r)   F_OKr`  r6   r7   r>   )r   rb  cmd2r,  s   &   r#   $test_same_dir_with_pathext_extension.TestWhich.test_same_dir_with_pathext_extension"
  s!   iiV\\#HH=t}}MV\\#HH277K!]]	, &&v..'',,txx6) 	V\\#HH=t}}MV\\#HH277K!]]	,V\\$XX>PV\\$XXBGGL,	.r%   c                   V P                   R R pV P                  \        P                  ! WP                  R7      V P
                  4       V P                  \        P                  ! WP                  \        P                  R7      V P
                  4       \        P                  P                  V P                  V4      pV P                  V4       V P                  \        P                  ! WP                  R7      V P
                  4       V P                  \        P                  ! WP                  \        P                  R7      V4       V P                  \        P                  ! V P                   V P                  R7      V P
                  4       V P                  \        P                  ! V P                   V P                  \        P                  R7      V P
                  4       R # Nr  r0  r<  )r  r  r   r  rm   r	  r)   r  r6   r7   r>   )r   rb  r,  s   &  r#   'test_same_dir_without_pathext_extension1TestWhich.test_same_dir_without_pathext_extension6
  s$   iinV\\#HH=t}}MV\\#HH277K!]]	, '',,txx5) 	V\\#HH=t}}MV\\#HH277K,	.V\\$))$((CT]]SV\\$))$((Q!]]	,r%   c                n   V P                   p\        P                  P                  \        P                  ! V P
                  4      \        P                  ! V P                  4      .4      pV P                  \        P                  ! WR 7      V P                  4       V P                  \        P                  ! W\        P                  R7      V P                  4       WP                  R4      ,           p\        P                  P                  V P
                  V4      pV P                  V4       V P                  \        P                  ! WR 7      V4       V P                  \        P                  ! W\        P                  R7      V4       V P                  \        P                  ! W2R 7      V4       V P                  \        P                  ! W2\        P                  R7      V4       \        P                  P                  \        P                  ! V P                  4      \        P                  ! V P
                  4      .4      pV P                  \        P                  ! WR 7      V P                  4       V P                  \        P                  ! W\        P                  R7      V P                  4       R# r  )r  r)   rO  r7   rw  r  rm   r  r   r  r	  r  r`  r6   r>   r   )r   rb  search_pathr  r,  s   &    r#   %test_dir_order_with_pathext_extension/TestWhich.test_dir_order_with_pathext_extensionK
  s   iijjoor{{4>>'B'){{488'<'> ? 	V\\#@$--PV\\#bggN!]]	, &&v..'',,t~~t<) 	V\\#@/RV\\#bggN,	. 	V\\$A?SV\\$rwwO,	. jjoor{{488'<'){{4>>'B'D Ec<dmmLc"''J	(r%   c                   V P                   R R p\        P                  P                  \        P                  ! V P
                  4      \        P                  ! V P                  4      .4      pV P                  \        P                  ! WR7      V P                  4       V P                  \        P                  ! W\        P                  R7      V P                  4       \        P                  P                  V P
                  V4      pV P                  V4       V P                  \        P                  ! WR7      V P                  4       V P                  \        P                  ! W\        P                  R7      V4       V P                  \        P                  ! V P                   VR7      V P                  4       V P                  \        P                  ! V P                   V\        P                  R7      V P                  4       \        P                  P                  \        P                  ! V P                  4      \        P                  ! V P
                  4      .4      pV P                  \        P                  ! WR7      V P                  4       V P                  \        P                  ! W\        P                  R7      V P                  4       R # r  )r  r)   rO  r7   rw  r  rm   r  r   r  r	  r  r6   r>   )r   rb  r  r,  s   &   r#   (test_dir_order_without_pathext_extension2TestWhich.test_dir_order_without_pathext_extensioni
  s   iinjjoor{{4>>'B'){{488'<'> ? 	V\\#@$--PV\\#bggN!]]	, '',,t~~s;) 	V\\#@$--PV\\#bggN,	. 	V\\$))+FVV\\$))+BGGT!]]	, jjoor{{488'<'){{4>>'B'D EV\\#@$--PV\\#bggN!]]	,r%   )r  rm   r
  r  r  r	  r  N).r   r   r   r   r  staticmethodr)   rw  r`  r>   r  r  r  r   r  r  r   r  r#  r)  r-  r   r  r3  r6  r9  r=  rE  rL  rQ  rT  rW  rZ  rd  ri  rl  rp  rt  rx  r  r  r  r  r  r   r   r   s   @r#   r  r  	  s    "  ,LO,
," 002"2" 0,.
&.
& 0,.	K.	K ## $D
 08:<:<0	&7&0$"" 02LM	L N	L 02LM	L N	L 02LM	L N	L 02LM@ N@$ 02LMI NI 02LM
= N
= 02LM
A N
A 02LM. N.& 02LM, N,( 02LM( N(: 02LM, N,r%   r  c                   J   a  ] tR tRt o R t]! ]P                  4      tRt	V t
R# )TestWhichBytesi
  c                   \         P                  V 4       \        P                  ! V P                  4      V n        \        P                  ! V P
                  4      V n        \        P                  ! V P                  4      V n        \        P                  ! V P                  4      V n        \        P                  ! V P                  4      V n        \        P                  ! V P                  4      V n	        R # r(   )
r  r  r)   r   rm   r  r	  r  r  r  r~  s   &r#   r  TestWhichBytes.setUp
  s    ;;txx(KK		*	DMM2T^^4kk$++.;;txx(r%   )r  rm   r  r  r	  r  N)r   r   r   r   r  r  r)   r   r`  r   r   r   s   @r#   r  r  
  s     )  ,Lr%   r  c                     a  ] tR tRt o R tR tR tR tR tR t	R t
]R	 4       t]R
 4       tR t]R 4       tR t]R 4       tR t]P(                  ! ]P,                  P.                  R4      R 4       tR tR tR tR t]P<                  ]R 4       4       t]P<                  ]R 4       4       t ]P<                  ]R 4       4       t!]P<                  ]R 4       4       t"R t#R t$]R 4       t%]R 4       t&R t']R 4       t(]P<                  R  4       t)]P<                  R! 4       t*]PV                  ]P(                  ! ],! ]R"4      ;'       d    ],! ]-R#4      ;'       d
    ],! ]-R$4      R%4      R& 4       4       t.R't/V t0R(# ))TestMovei
  c                F   R pV P                  4       V n        V P                  4       V n        \        P                  P                  V P                  V4      V n        \        P                  P                  V P                  V4      V n        \        V P                  R4       R# )r   r  N)	r   r  r  r)   r6   r7   r  r  r>   )r   r   s   & r#   r  TestMove.setUp
  sc    ||~||~T\\8<T\\8<DMM7+r%   c                   \        VR 4      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! W4       \        VR 4      ;_uu_ 4       pV P	                  XVP                  4       4       RRR4       V P                  \        P                  P                  V4      4       R#   + '       g   i     L; i  + '       g   i     LS; irU   N)	r:   rZ   r   mover   r   r)   r6   r   )r   rw   rx   real_dstrQ   contentss   &&&&  r#   _check_move_fileTestMove._check_move_file
  s    #t__vvxH C(D!!QXqvvx0 ",- _ "!s   B1!C1C	C	c                *   \        \        P                  ! V4      4      p\        P                  ! W4       V P                  V\        \        P                  ! V4      4      4       V P                  \        P                  P                  V4      4       R # r(   )	r`   r)   ra   r   r  r   r   r6   r   )r   rw   rx   r  r  s   &&&& r#   _check_move_dirTestMove._check_move_dir
  sY    "**S/*C6"**X*>#?@,-r%   c                h    V P                  V P                  V P                  V P                  4       R # r(   )r  r  r  r~  s   &r#   test_move_fileTestMove.test_move_file
  s     dmmT]]DMMJr%   c                h    V P                  V P                  V P                  V P                  4       R # r(   )r  r  r  r  r~  s   &r#   test_move_file_to_dirTestMove.test_move_file_to_dir
  s     dmmT\\4==Ir%   c                |    \        V P                  4      pV P                  WP                  V P                  4       R # r(   )r   r  r  r  r  )r   rw   s   & r#   "test_move_file_to_dir_pathlike_src+TestMove.test_move_file_to_dir_pathlike_src
  s(    t}}%c<<?r%   c                |    \        V P                  4      pV P                  V P                  WP                  4       R # r(   )r   r  r  r  r  r   rx   s   & r#   "test_move_file_to_dir_pathlike_dst+TestMove.test_move_file_to_dir_pathlike_dst
  s(    t||$dmmS--@r%   c                &    V P                  4        R # r(   )r  r~  s   &r#   test_move_file_other_fs TestMove.test_move_file_other_fs
  s     	r%   c                &    V P                  4        R # r(   )r  r~  s   &r#   test_move_file_to_dir_other_fs'TestMove.test_move_file_to_dir_other_fs
  s     	""$r%   c                    \         P                  ! V P                  4       R 7      p V P                  V P                  W4       \
        P                  ! V4       R#   \
        P                  ! T4       i ; irh  )rp   r   r   r  r  r   r   r   r  s   & r#   test_move_dirTestMove.test_move_dir
  sL    //dlln5	&  w@W%IW%s   A A3c                &    V P                  4        R # r(   )r  r~  s   &r#   test_move_dir_other_fsTestMove.test_move_dir_other_fs
  s     	r%   c           
         V P                  V P                  V P                  \        P                  P                  V P                  \        P                  P                  V P                  4      4      4       R # r(   )r  r  r  r)   r6   r7   rc  r~  s   &r#   test_move_dir_to_dirTestMove.test_move_dir_to_dir
  sF    T\\4<<GGLLrww'7'7'EF	Hr%   c                &    V P                  4        R # r(   )r  r~  s   &r#   test_move_dir_to_dir_other_fs&TestMove.test_move_dir_to_dir_other_fs
  s     	!!#r%   c           
     0   V P                  V P                  \        P                  P                  ,           V P
                  \        P                  P                  V P
                  \        P                  P                  V P                  4      4      4       R # r(   )r  r  r)   r6   sepr  r7   rc  r~  s   &r#   test_move_dir_sep_to_dir!TestMove.test_move_dir_sep_to_dir
  sS    T\\BGGKK7GGLLrww'7'7'EF	Hr%   zrequires os.path.altsepc           
     0   V P                  V P                  \        P                  P                  ,           V P
                  \        P                  P                  V P
                  \        P                  P                  V P                  4      4      4       R # r(   )r  r  r)   r6   altsepr  r7   rc  r~  s   &r#   test_move_dir_altsep_to_dir$TestMove.test_move_dir_altsep_to_dir
  sS    T\\BGGNN:DLLGGLLrww'7'7'EF	Hr%   c                    \        V P                  4       V P                  \        P                  \        P
                  V P                  V P                  4       R # r(   )r>   r  r   r   r   r  r  r  r~  s   &r#   "test_existing_file_inside_dest_dir+TestMove.test_existing_file_inside_dest_dir
  s2    DMM"&,,T]]DLLQr%   c                    \         P                  P                  V P                  R 4      pV P	                  \
        P                  \
        P                  V P                  V4       R# r9  N)r)   r6   r7   r  r   r   r   r  r  s   & r#   test_dont_move_dir_in_itself%TestMove.test_dont_move_dir_in_itself
  s:    ggll4<</&,,T\\3Gr%   c           	        \         P                  ! \        4        R F}  w  r\         P                  P	                  \        V4      p\         P                  P	                  \        V4      pV P                  \        P                  ! W4      RV: RV: R2R7       K  	  \        P                  ! \        4       R#   \        P                  ! \        4       i ; i)srcdir)_destinsrc() wrongly concluded that dst (z) is not in src ()rC  N))r  zsrcdir/dest)
r)   r   r   r6   r7   r   r   
_destinsrcr   r   rq  s   &  r#   test_destinsrc_false_negative&TestMove.test_destinsrc_false_negative
  s    
	%7ggll63/ggll63/ 1 1# ;>A3"H   I 8 V$IV$   BB; ;Cc           	        \         P                  ! \        4        R F}  w  r\         P                  P	                  \        V4      p\         P                  P	                  \        V4      pV P                  \        P                  ! W4      RV: RV: R2R7       K  	  \        P                  ! \        4       R#   \        P                  ! \        4       i ; i)r  r  z) is in src (r  r  N))r  zsrc/dest)r  z
srcdir.new)
r)   r   r   r6   r7   r   r   r  r   r   rq  s   &  r#   test_destinsrc_false_positive&TestMove.test_destinsrc_false_positive   s    
	%Nggll63/ggll63/  !2!23!<9<c!C ! D O V$IV$r  c                   \         P                  P                  V P                  R 4      p\         P                  ! V P
                  V4       \        P                  ! WP                  4       V P                  \         P                  P                  V P                  4      4       V P                  \         P                  P                  V P
                  V P                  4      4       R# r  )r)   r6   r7   r  r   r  r   r  r  r   rc   samefiler  s   & r#   test_move_file_symlinkTestMove.test_move_file_symlink  s     ggll4<</


4==#&C't}}56((FGr%   c                   R p\         P                  P                  V P                  V4      p\         P                  ! V P
                  V4       \        P                  ! W P                  4       \         P                  P                  V P                  V4      pV P                  \         P                  P                  V4      4       V P                  \         P                  P                  V P
                  V4      4       R# r  )r)   r6   r7   r  r   r  r   r  r  r   rc   r  )r   r   rx   
final_links   &   r#   test_move_file_symlink_to_dir&TestMove.test_move_file_symlink_to_dir  s     ggll4<<2


4==#&C&WW\\$,,9
z23((
CDr%   c                N   \         P                  P                  V P                  R 4      p\         P                  P                  V P                  R4      p\         P                  ! W4       \         P                  P                  V P
                  R4      p\        P                  ! W#4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  V4      \         P                  P                  V4      4       R# r:  r9  r;  N)r)   r6   r7   r  r   r  r   r  r   rc   r   realpathr   rw   rx   r  s   &   r#   test_move_dangling_symlink#TestMove.test_move_dangling_symlink   s     ggll4<</ggll4<</


377<<f5C"x01))#.0@0@0JKr%   c                >   \         P                  P                  V P                  R 4      p\         P                  P                  V P                  R4      p\         P                  ! V4       \         P
                  ! W4       \         P                  P                  V P                  R4      p\        P                  ! W#4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  W4      4       R# r  )r)   r6   r7   r  r   r   r  r   r  r   rc   r  r  s   &   r#   test_move_dir_symlinkTestMove.test_move_dir_symlink+  s     ggll4<</ggll4<</



377<<f5C"x01((78r%   c           	        \         P                  ! V P                  V P                  4      pV P	                  V\
        P                  P                  V P                  \
        P                  P                  V P                  4      4      4       R # r(   )	r   r  r  r  r   r)   r6   r7   rc  r  s   & r#   test_move_return_valueTestMove.test_move_return_value7  sT    [[5T\\277+;+;DMM+JK	Mr%   c                   \         P                  ! V P                  \        P                  P                  V P                  R 4      4      pV P                  V\        P                  P                  V P                  R 4      4       R# r  )r   r  r  r)   r6   r7   r  r   r  s   & r#    test_move_as_rename_return_value)TestMove.test_move_as_rename_return_value<  sL    [[T\\5(IJRWW\\$,,>?r%   c                   a . oV3R  lp\         P                  ! V P                  V P                  VR7       V P	                  \        S4      ^4       R# )c                 ,   < SP                  W34       R # r(   r   rw   rx   moveds   &&r#   r  7TestMove.test_move_file_special_function.<locals>._copyC      LL#$r%   r  N)r   r  r  r  r   r   r   r  r  s   & @r#   test_move_file_special_function(TestMove.test_move_file_special_function@  s9    	%DMM4<<uEUQ'r%   c                  a . oV3R  lp\         P                  ! \        P                  P	                  V P
                  R4      4       \         P                  ! \        P                  P	                  V P
                  R4      4       \        P                  ! V P
                  V P                  VR7       V P                  \        S4      ^4       R# )c                 ,   < SP                  W34       R # r(   r   r  s   &&r#   r  6TestMove.test_move_dir_special_function.<locals>._copyK  r  r%   r  child1r  N)r   r  r)   r6   r7   r  r   r  r  r   r   r   s   & @r#   test_move_dir_special_function'TestMove.test_move_dir_special_functionH  s{    	%##BGGLLw$GH##BGGLLx$HIDLL$,,eDUQ'r%   c                b   V P                  4       V n        \        P                  P	                  \        P                  P                  V P                  4      \        P                  P                  V P                  4      P                  4       4      pV P                  V P                  V4        \        P                  ! V P                  V4       V P                  \        P                  P                  V4      4       \        P                  ! V4       R #   \        P                  ! T4       i ; ir(   )r   r  r)   r6   r7   r  rc  upperr=  r   r  r   rb   r  r  s   & r#   test_move_dir_caseinsensitive&TestMove.test_move_dir_caseinsensitiveR  s     ||~'',,-  .4468 	DLL'2	KKg.OOBGGMM'23HHWBHHWs   /AD D.c                   \         P                  P                  V P                  R 4      p\         P                  P                  V P                  R 4      p\         P
                  ! V P                  VRR7       \        P                  ! W!4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  V P                  V4      4       V P                  \         P                  P                  V4      4       \         P
                  ! V P                  VRR7       V P                  \        P                  4      ;_uu_ 4        \        P                  ! W!4       RRR4       V P                  \         P                  P                  V P                  V4      4       V P                  \         P                  P                  V4      4       R#   + '       g   i     Ly; i)	linktodirTr#  N)r)   r6   r7   r  r  r   r   r  r   rc   r  r   r   r   r   )r   rx   rw   r  s   &&  r#   "_test_move_symlink_to_dir_into_dir+TestMove._test_move_symlink_to_dir_into_dird  s&   ggll4<<577<<k:


4<<$?Cx01((x@A,- 	

4<<$?v||,,KK! -((x@As+, -,s   -G55H	c                <    V P                  V P                  4       R # r(   )r  r  r~  s   &r#   !test_move_symlink_to_dir_into_dir*TestMove.test_move_symlink_to_dir_into_dirv  s    //=r%   c                    \         P                  P                  V P                  R 4      p\         P                  ! V P
                  VRR7       V P                  V4       R# )otherlinktodirTr#  N)r)   r6   r7   r  r   r  r  r  s   & r#   ,test_move_symlink_to_dir_into_symlink_to_dir5TestMove.test_move_symlink_to_dir_into_symlink_to_dirz  s=    ggll4<<)9:


4<<$?//4r%   r  SF_IMMUTABLE	UF_OPAQUEzrequires lchflagsc                v    \         P                  ! \        4       \         P                  ! \        \        P
                  4       V P                  \        \        P                  \        \        4       V P                  \        \         P                  ! 4       9   4       \         P                  ! \        \        P                  4       \        P                  ! \         P                   P#                  \        R 4      4       \         P                  ! \        \        P
                  4       V P                  \        \        P                  \        \        4       V P                  \        \         P                  ! 4       9   4       \         P                   P%                  \        4      '       dD   \         P                  ! \        \        P                  4       \        P&                  ! \        4       \         P                   P%                  \        4      '       dF   \         P                  ! \        \        P                  4       \        P&                  ! \        4       R# R#   \         P                   P%                  \        4      '       dD   \         P                  ! \        \        P                  4       \        P&                  ! \        4       \         P                   P%                  \        4      '       dE   \         P                  ! \        \        P                  4       \        P&                  ! \        4       i i ; i)r  N)r)   r   
TESTFN_SRCr  r  r  r   r  r   r  
TESTFN_DSTr   ra   r  r   r  r6   r7   r   r   r~  s   &r#   test_move_dir_permission_denied(TestMove.test_move_dir_permission_denied  s   	-HHZ KK
D$5$56 ov{{J
SZ2::<78 KK
DNN3''Z(IJKK
D$5$56 ov{{J
SZ2::<78ww~~j))J7  ,ww~~j))J7  , * ww~~j))J7  ,ww~~j))J7  , *s   E?I BL83AL8)r  r  r  r  N)1r   r   r   r   r  r  r  r  r  r  r  r1   r  r  r  r  r  r  r  r  r  r)   r6   r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  ro   r  r  r   r   r   s   @r#   r  r  
  s@    ,..KJ@
A
   % %&  H
 $ $H )BCH DHR
H

%
% ""H  #H ""E  #E ""L  #L ""9  #9M
@ ( ( ( ($ - -" ""> #> ""5 #5
 ''Z0 8 8$T>:8 8$T;7,.-	. (
-r%   r  c                      a  ] tR tRt o  ! R R]4      tR t]P                  ! ]	R4      R 4       t
]P                  ! ]	R4      R 4       t]P                  ! ]	R4      R 4       tR	tV tR
# )TestCopyFilei  c                   H   a  ] tR tRt o RtRtRtR	R ltR tR t	R t
RtV tR# )
TestCopyFile.Fauxi  FNc                    Wn         W n        R # r(   )_raise_in_exit_suppress_at_exit)r   raise_in_exitsuppress_at_exits   &&&r#   __init__TestCopyFile.Faux.__init__  s    "/%5"r%   c                    R # )r  rA   )r   r!   s   &*r#   rZ   TestCopyFile.Faux.read  s    r%   c                    R V n         R# r/  )_enteredr~  s   &r#   	__enter__TestCopyFile.Faux.__enter__  s	     DMr%   c                t    WV3V n         V P                  '       d   R V n        \        R4      hV P                  # )TCannot close)_exited_withr$  _raisedr   r%  )r   exc_typeexc_valexc_tbs   &&&&r#   __exit__TestCopyFile.Faux.__exit__  s9     (6 9D"""#n--)))r%   )r-  r2  r$  r3  r%  r  )r   r   r   r   r-  r2  r3  r(  rZ   r.  r7  r   r   r   s   @r#   Fauxr"    s-     	6		!	* 	*r%   r9  c           	     2   RR lp\         P                  ! \        RV4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P
                  ! RR4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rV   c                 *    V R 8X  d   \        R4      hR# )srcfilezCannot open "srcfile"NrS  )r   r\   s   &&r#   _open4TestCopyFile.test_w_source_open_fails.<locals>._open  s    9$566 %r%   r:   r<  destfileNrV   )r   r[  r   r   r   r  )r   r=  s   & r#   test_w_source_open_fails%TestCopyFile.test_w_source_open_fails  s]    	
 vvu55""7++	:6 , 65++ 655s#   BA2	 B2B=BB	zskipped on macOSc                  a V P                  4       oRV3R llp\        P                  ! \        RV4      ;_uu_ 4        \        P                  ! RR4       RRR4       V P                  SP                  4       V P                  SP                  ^ ,          \        J 4       V P                  SP                  ^,          P                  R4       R#   + '       g   i     L; i)rV   c                 >   < V R 8X  d   S# V R8X  d   \        R4      hR# )r<  r?  Cannot open "destfile"NrS  )r   r\   r<  s   &&r#   r=  2TestCopyFile.test_w_dest_open_fails.<locals>._open  s)    9$:%677 &r%   r:   r<  r?  Nr@  )rE  )r9  r   r[  r   r  r   r-  r2  r   r   r!   )r   r=  r<  s   & @r#   test_w_dest_open_fails#TestCopyFile.test_w_dest_open_fails  s    ))+	 vvu55OOIz2 6((),,Q/7:;--a0554	6	 65s   CC 	c                X  aa V P                  4       oV P                  R 4      oRVV3R llp\        P                  ! \        RV4      ;_uu_ 4        \        P                  ! RR4       RRR4       V P                  SP                  4       V P                  SP                  4       V P                  SP                  4       V P                  SP                  ^ ,          \        J 4       V P                  SP                  ^,          P                  R4       R#   + '       g   i     L; i)Tc                 ,   < V R 8X  d   S# V R8X  d   S# R# r<  r?  NrA   r   r\   r?  r<  s   &&r#   r=  3TestCopyFile.test_w_dest_close_fails.<locals>._open  "    9$:% &r%   r:   r<  r?  Nr@  )r1  )r9  r   r[  r   r  r   r-  r3  r2  r   r   r!   r   r=  r?  r<  s   & @@r#   test_w_dest_close_fails$TestCopyFile.test_w_dest_close_fails  s    ))+99T?	 	 vvu55OOIz2 6(()))*((),,Q/7:;--a055*	, 65s   DD)	c           	       aa V P                  R 4      oV P                  4       oRVV3R llp\        P                  ! \        RV4      ;_uu_ 4        V P	                  \
        4      ;_uu_ 4        \        P                  ! RR4       RRR4       RRR4       V P                  SP                  4       V P                  SP                  4       V P                  SP                  4       V P                  SP                  ^ ,          RJ 4       V P                  SP                  4       R#   + '       g   i     L; i  + '       g   i     L; i)Tc                 ,   < V R 8X  d   S# V R8X  d   S# R# rK  rA   rL  s   &&r#   r=  5TestCopyFile.test_w_source_close_fails.<locals>._open  rN  r%   r:   r<  r?  Nr@  )r9  r   r[  r   r   r   r  r   r-  r   r3  r2  rO  s   & @@r#   test_w_source_close_fails&TestCopyFile.test_w_source_close_fails  s     ))D/99;	 	 vvu55""7++	:6 , 6 	(()))*))*,,Q/478( ,+ 65s$   D</D)	D<)D94D<<E	rA   N)r   r   r   r   objectr9  rA  r  r  r  rG  rP  rU  r   r   r   s   @r#   r   r     sv     *v *$7 __U./6 06" __U./, 0,( __U./) 0)r%   r   c                      a  ] tR tRt o Rt]R 4       t]R 4       tR t]	P                  R 4       tR tR tR tR	 t]P"                  ! ]P&                  R
8g  R4      R 4       tRtV tR# )TestCopyFileObji  c                :    \        \        V P                  4       R # r(   )rS   r   FILESIZEclss   &r#   
setUpClassTestCopyFileObj.setUpClass  s    -r%   c                n    \         P                  ! \        4       \         P                  ! \        4       R # r(   )r   rt   r   r  r\  s   &r#   tearDownClassTestCopyFileObj.tearDownClass  s     !r%   c                :    \         P                  ! \        4       R # r(   r   rt   r  r~  s   &r#   tearDownTestCopyFileObj.tearDown      !r%   c           	   #     "   \        \        R 4      ;_uu_ 4       p\        \        R4      ;_uu_ 4       pW3x  RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i5irU   rF   Nr:   r   r  rq  s   &  r#   	get_filesTestCopyFileObj.get_files  J     &$3gt$$j  %  $$  2   A3AA	A
A3AAA0	*	A3c           	     $   \        VR 4      ;_uu_ 4       p\        VR 4      ;_uu_ 4       pV P                  VP                  4       VP                  4       4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir  )r:   r   rZ   )r   rw   rx   fsrcfdsts   &&&  r#   assert_files_eqTestCopyFileObj.assert_files_eq  sT    #t__c4D  diik: ! _  __s"   A>/A+	A>+A;6A>>B	c                    V P                  4       ;_uu_ 4       w  r\        P                  ! W4       R R R 4       V P                  \        \
        4       R #   + '       g   i     L,; ir(   )rk  r   copyfileobjrr  r   r  rq  s   &  r#   test_contentTestCopyFileObj.test_content  s?    ^^#s( VW- s   AA&	c                    V P                  4       ;_uu_ 4       w  r\        P                  ! W4       R R R 4       R #   + '       g   i     R # ; ir(   )rk  r   ru  rq  s   &  r#   test_file_not_closed$TestCopyFileObj.test_file_not_closed  s0    ^^#s( s	   <A	c                H   V P                  4       ;_uu_ 4       w  r\        P                  ! W4       V P                  VP	                  4       V P
                  4       V P                  VP	                  4       V P
                  4       R R R 4       R #   + '       g   i     R # ; ir(   )rk  r   ru  r   tellr[  rq  s   &  r#   test_file_offset TestCopyFileObj.test_file_offset$  sd    ^^#s(SXXZ7SXXZ7 s   A-BB!	r  zWindows onlyc                ,   \         P                  P                  R 4      ;_uu_ 4       p\        P                  ! \
        \        4       RRR4       V P                  XP                  ^ ,          ^,          R4       \        P                  ! \        P                  ! 4       RR7      ;_uu_ 4       pVP                  R4       RRR4       XP                  pV P                  \         P"                  V4       \         P                  P                  R 4      ;_uu_ 4       p\        P                  ! V\        4       RRR4       V P                  VP                  ^ ,          ^,          ^4       \        P                  ! \        P                  ! 4       RR7      ;_uu_ 4       p RRR4       VP                  pV P                  \         P"                  V4       \         P                  P                  R 4      ;_uu_ 4       p\        P                  ! V\        4       RRR4       V P%                  V\        4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL/; i  + '       g   i     L; i  + '       g   i     Lw; i)zshutil._copyfileobj_readintoNFrl   s   fooi   )r  r4  r5  r   r  r   r  r   	call_argsrp   rq   r)   rr   r;   rg   r   r   rt   rr  )r   mrQ   rr  s   &   r#   test_win_implTestCopyFileObj.test_win_impl*  s    ]]  !?@@AOOFG, A
 	Q*O< ((RYY[GG1GGFO H	((%0]]  !?@@AOOE7+ AQ*A. ((RYY[GG1 H	((%0]]  !?@@AOOE7+ A 	UG,3 A@@ HGG A@@
 HG A@s;    H4-III08J4I	I	I-	0J 	J	rA   Ni    )r   r   r   r   r[  classmethodr^  ra  re  
contextlibcontextmanagerrk  rr  rv  ry  r}  r  r  r)   rg   r  r   r   r   s   @r#   rY  rY    s     H. . " "" ! !
;
.
"8 __RWW_n5- 6-r%   rY  c                      a  ] tR tRt o RtRtRtRt]R 4       t	]R 4       t
R t]P                  R 4       tR	 tR
 tR tR tR tR tR tR tR tRtV tR# )_ZeroCopyFileTestiI  z#Tests common to all zero-copy APIs.r%   r  c                    \        \        V P                  4       \        \        R 4      ;_uu_ 4       pVP	                  4       V n        RRR4       R#   + '       g   i     R# ; ir  )rS   r   r[  r:   rZ   FILEDATA)r]  rQ   s   & r#   r^  _ZeroCopyFileTest.setUpClassO  s;    -&$1668CL  s   AA$	c                :    \         P                  ! \        4       R # r(   )r   rt   r   r\  s   &r#   ra  _ZeroCopyFileTest.tearDownClassV  s     r%   c                :    \         P                  ! \        4       R # r(   rd  r~  s   &r#   re  _ZeroCopyFileTest.tearDownZ  rg  r%   c           	   #     "   \        \        R 4      ;_uu_ 4       p\        \        R4      ;_uu_ 4       pW3x  RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i5iri  rj  rq  s   &  r#   rk  _ZeroCopyFileTest.get_files]  rm  rn  c                    \        R 4      h)zmust be implemented in subclass)r   )r   r!   r"   s   &*,r#   zerocopy_fun_ZeroCopyFileTest.zerocopy_func  s    !"CDDr%   c                    V P                  4        V P                  4        V P                  4        V P                  4        R # r(   )re  ra  r^  r  r~  s   &r#   reset_ZeroCopyFileTest.resetf  s*    

r%   c           	        V P                  4       ;_uu_ 4       w  rV P                  W4       R R R 4       V P                  \        \        RR7      V P
                  4       V P                  4       ;_uu_ 4       w  r\        P                  P                  R4      ;_uu_ 4       p\        P                  ! \        \        4       R R R 4       R R R 4       R #   + '       g   i     L; i  + '       g   i     L-; i  + '       g   i     R # ; i)NTr[   zshutil.copyfileobj)rk  r  r   r]   r  r  r  r4  r5  r   r  r   )r   rw   rx   r  s   &   r#   test_regular_copy#_ZeroCopyFileTest.test_regular_copyn  s    ^^#c' 748$--H^^#$$%9::a0 ; 	 
 ;: s/   C8*C:" C'	C:C$	'C72C::D	c           	        V P                  V P                  4       V P                  4       ;_uu_ 4       w  rV P                  \        \
        34      ;_uu_ 4        V P                  W4       R R R 4       R R R 4       V P                  \        \        RR7      V P                  4       R #   + '       g   i     LE; i  + '       g   i     LP; i)NTr  )r   r  rk  r   r   r   r  r   r]   r   r  rq  s   &  r#   test_same_file _ZeroCopyFileTest.test_same_filex  s    

#^^#""G->#?@@!!#+ A  	6$7G A@ s#   &B<B)	,B<)B94B<<C	c                F   \         P                  ! \        P                  ! 4       R 7      pV P	                  \
        4      ;_uu_ 4       p\        P                  ! VR4       RRR4       V P                  XP                  P                  V4       R#   + '       g   i     L8; i)r   newN)rp   r   r)   rr   r   r   r   r  r   r   r   )r   rg   r   s   &  r#   test_non_existent_src'_ZeroCopyFileTest.test_non_existent_src  s`    299;/011ROOD%( 2..5 21s   BB 	c           	       aa \         R ,           o\         R,           oV P                  V3R l4       V P                  V3R l4       \        S4       \        SR4      ;_uu_ 4       p\        SR4      ;_uu_ 4       pV P	                  W4       RRR4       RRR4       V P                  \        SRR7      R	4       R#   + '       g   i     L7; i  + '       g   i     LB; i)
rw   rx   c                  0   < \         P                  ! S 4      # r(   r   rt   ru   s   r#   r  3_ZeroCopyFileTest.test_empty_file.<locals>.<lambda>      	 0 0 9r%   c                  0   < \         P                  ! S 4      # r(   r  rv   s   r#   r  r    r  r%   rU   rF   NTr  r%   )r   r   r>   r:   r  r   r]   r   rw   rx   rv   ru   s   &  @@r#   test_empty_file!_ZeroCopyFileTest.test_empty_file  s    5.5.9:9:G'4  Cgt$$!!#+ % ! 	748#> %$ ! s$   &C;B<	C<CCC	c                
   \         P                  P                  V P                  \        R 7      ;_uu_ 4        V P                  \        \        P                  \        \        4       RRR4       R#   + '       g   i     R# ; i)r   N)
r  r4  r5  
PATCHPOINTZeroDivisionErrorr   r   r  r   r  r~  s   &r#   test_unhandled_exception*_ZeroCopyFileTest.test_unhandled_exception  s_    ]]  -> ! @ @/$oovw@@ @ @ @s   /A11B	c                   \         P                  P                  V P                  \	        \
        P                  R 4      R7      ;_uu_ 4        V P                  4       ;_uu_ 4       w  rV P                  \        4      ;_uu_ 4        V P                  W4       RRR4       RRR4       RRR4       R#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R# ; iyor   N)r  r4  r5  r  r   r    EINVALrk  r   r   r  rq  s   &  r#   test_exception_on_first_call._ZeroCopyFileTest.test_exception_on_first_call  s     ]]  -4U\\4-H ! J J!!Zc&&'899%%c/ : "J J :9 "!J J Js<   C% C	B1C	C1C<C	CCC(	c           
        \         P                  P                  V P                  \	        \
        P                  R 4      R7      ;_uu_ 4        V P                  4       ;_uu_ 4       w  rV P                  \        V P                  W4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir  )
r  r4  r5  r  r   r    ENOSPCrk  r   r  rq  s   &  r#   test_filesystem_full&_ZeroCopyFileTest.test_filesystem_full  s     ]]  -4U\\4-H ! J J!!Zc!!'4+<+<cG "J J!!J J Js$   B.%$B		B.B+&B..B?	rA   Ni   )r   r   r   r   __doc__r[  r  r  r  r^  ra  re  r  r  rk  r  r  r  r  r  r  r  r  r  r   r   r   s   @r#   r  r  I  s     - HHJ5 5 ! !" ! !
E H6?@0H Hr%   r  c                   N   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
tV tR# )_ZeroCopyFileLinuxTesti  Nc                   \         P                  ! V P                  4      ;_uu_ 4       p\        \        R 4      ;_uu_ 4       pV P                  \        4      ;_uu_ 4        V P                  W4       RRR4       \        P                  ! W4       RRR4       RRR4       V P                  \        \        RR7      V P                  4       R#   + '       g   i     Lc; i  + '       g   i     LX; i  + '       g   i     Lc; i)rF   NTr  )ioBytesIOr  r:   r  r   r   r  r   ru  r   r]   rq  s   &  r#   test_non_regular_file_src0_ZeroCopyFileLinuxTest.test_non_regular_file_src  s    ZZ&&#gt$$&&'899%%c/ :""3, % ' 	748$--H	 :9 %$ '&s;   C3C 	 C2C 	C3CC 	 C0+C33D	c                   \        \        R 4      ;_uu_ 4       p\        P                  ! 4       ;_uu_ 4       pV P	                  \
        4      ;_uu_ 4        V P                  W4       RRR4       \        P                  ! W4       VP                  ^ 4       V P                  VP                  4       V P                  4       RRR4       RRR4       R#   + '       g   i     Ls; i  + '       g   i     L-; i  + '       g   i     R# ; ir  )r:   r   r  r  r   r   r  r   ru  seekr   rZ   r  rq  s   &  r#   test_non_regular_file_dst0_ZeroCopyFileLinuxTest.test_non_regular_file_dst  s    &$3&&'899%%c/ :""3,  T]];   99   s;   C8C%	C'AC%	 C8C"C%	%C50C88D		c                N  aa VV3R  lp. o\        V P                  4      o\        P                  P	                  V P                  RVR7      ;_uu_ 4        V P                  4       ;_uu_ 4       w  r#V P                  \        4      ;_uu_ 4       pV P                  W#4       RRR4       RRR4       RRR4       V P                  XP                  P                  \        P                  4       R#   + '       g   i     LV; i  + '       g   i     La; i  + '       g   i     Ll; i)c                  z   < S'       g   SP                  R 4       S! V / VB # \        \        P                  R4      h)Nr  )rd   r   r    EBADF)r!   r"   r  orig_syscalls   *,r#   syscallE_ZeroCopyFileLinuxTest.test_exception_on_second_call.<locals>.syscall  s3    D!#T4V44ekk400r%   T)rJ  r   N)evalr  r  r4  r5  rk  r   r   r  r   r   r    r  )r   r  rw   rx   r   r  r  s   &    @@r#   test_exception_on_second_call4_ZeroCopyFileLinuxTest.test_exception_on_second_call  s    	1 DOO,]]  -4 ! 6 6!!Zc&&w//2%%c/ 0 "6 	++U[[9 0/ "!6 6s<   D. D	C. D	(D.C>9D	DDD$	c           	     |   \         P                  P                  R \        R7      ;_uu_ 4       pV P	                  4       ;_uu_ 4       w  r#V P                  W#4       RRR4       RRR4       V P                  \        \        RR7      V P                  4       R#   + '       g   i     LE; i  + '       g   i     LP; i)os.fstatr   NTr  )
r  r4  r5  r   rk  r  r   r]   r  r  r   r  rw   rx   s   &   r#   test_cant_get_size)_ZeroCopyFileLinuxTest.test_cant_get_size  sz     ]]   AAQ!!Zc!!#+ " B 	748$--H "! BAs#   B+B	B+B(#B++B;	c           	        \         P                  P                  4       pRVn        \         P                  P	                  RVR7      ;_uu_ 4       pV P                  4       ;_uu_ 4       w  r4V P                  W44       RRR4       RRR4       V P                  \        \        RR7      V P                  4       R#   + '       g   i     LE; i  + '       g   i     LP; i)i   r  r'  NTr  i  )r  r4  Mockst_sizer5  rk  r  r   r]   r  r  r   r4  r  rw   rx   s   &    r#   test_small_chunks(_ZeroCopyFileLinuxTest.test_small_chunks  s    
 }}!!# ]]  $ ??1!!Zc!!#+ " @ 	748$--H "! @?s$   C(B9	<C9C	CC	c           	        \         P                  P                  4       pV P                  R,           Vn        \         P                  P                  RVR7      ;_uu_ 4       pV P                  4       ;_uu_ 4       w  r4V P                  W44       RRR4       RRR4       V P                  \        \        RR7      V P                  4       R#   + '       g   i     LE; i  + '       g   i     LP; i)d   r  r'  NTr  i  @)r  r4  r  r[  r  r5  rk  r  r   r]   r  r  r  s   &    r#   test_big_chunk%_ZeroCopyFileLinuxTest.test_big_chunk  s    
 }}!!#}}(9:]]  $ ??1!!Zc!!#+ " @ 	748$--H "! @?s$    C9C
	C
CCC-	c           	     8   \         P                  P                  V P                  \        R 7      ;_uu_ 4       pV P                  \        \        P                  \        \        4       VP                  ^ ,          V P                  ,          pV P                  V\        P                  P                  \        4      4       \         P"                  ! \        4       \%        \        R4       V P'                  \         P"                  \        R,           4       V P                  \        \        P                  \        \        R,           4       VP                  ^ ,          V P                  ,          pV P                  VR4       RRR4       R#   + '       g   i     R# ; i)r   s   hello3Ni   )r  r4  r5  r  r  r   r   r  r   r  r  BLOCKSIZE_INDEXr   r)   r6   getsizer   rt   r>   r   )r   r  	blocksizes   &  r#   test_blocksize_arg)_ZeroCopyFileLinuxTest.test_blocksize_arg  s   ]]  -> ! @ @CD/$oovw@At';';<I Y(?@W%*OOI,,gm</$oow#GAt';';<IY0@ @ @ @s   EFF	rA   )r   r   r   r   r  r  r  r  r  r  r  r  r   r   r   s   @r#   r  r    s6     OI<:$III1 1r%   r  zos.sendfile() not supported_USE_CP_COPY_FILE_RANGEc                   4   a  ] tR tRt o Rt^tR tR tRtV t	R# )TestZeroCopySendfilei
  zos.sendfilec                .    \         P                  ! W4      # r(   )r   _fastcopy_sendfiler   rp  rq  s   &&&r#   r  !TestZeroCopySendfile.zerocopy_fun  s    ((44r%   c                    \         P                  P                  V P                  \	        \
        P                  R 4      R7      ;_uu_ 4       pV P                  4       ;_uu_ 4       w  r#V P                  \        4      ;_uu_ 4        \        P                  ! W#4       RRR4       RRR4       RRR4       \         P                  P                  V P                  4      ;_uu_ 4       p\        P                  ! \        \        4       RRR4       R\        n        R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     LV; i  R\        n        i ; i)r  r   NT)r  r4  r5  r  r   r    ENOTSOCKrk  r   r   r   r  r  r   r  _USE_CP_SENDFILEr  s   &   r#   test_file2file_not_supported1TestZeroCopySendfile.test_file2file_not_supported  s    
	+$$OO ' = % ? ?BC^^%%#**+<==11#; > &? $$T__550 6 '+F# >= &%? ? 65 '+F#sl   AE' E& D.	DD.	%E-9E' & EE' D+&D.	.D>9EE	E' E$	E' 'E4rA   N)
r   r   r   r   r  r  r  r  r   r   r   s   @r#   r  r  
  s       JO5+ +r%   r  z"os.copy_file_range() not supportedc                   4   a  ] tR tRt o Rt^tR tR tRtV t	R# )TestZeroCopyCopyFileRangei)  zos.copy_file_rangec                .    \         P                  ! W4      # r(   )r   _fastcopy_copy_file_ranger  s   &&&r#   r  &TestZeroCopyCopyFileRange.zerocopy_fun.  s    //;;r%   c                N  aa \          R 2o\          R2oV P                  V3R l4       V P                  V3R l4       \        SR4      ;_uu_ 4         RRR4       \        SR4      ;_uu_ 4       p\        SR4      ;_uu_ 4       pV P                  \        P
                  4      ;_uu_ 4        V P                  W4       RRR4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     L5; i  + '       g   i     L@; i  + '       g   i     R# ; i)rw   rx   c                  0   < \         P                  ! S 4      # r(   r  r  s   r#   r  ;TestZeroCopyCopyFileRange.test_empty_file.<locals>.<lambda>4  r  r%   c                  0   < \         P                  ! S 4      # r(   r  r  s   r#   r  r  5  r  r%   rF   NrU   )r   r   r:   r   r   r   r  r  s   &  @@r#   r  )TestZeroCopyCopyFileRange.test_empty_file1  s    HC.HC.9:9:'4   ! '4  Cgt)<)< ""6#;#;<<!!#+ = *=   !  =< *=)<   sH   C1D(D 	.C- D 	DC*	-C=8D 	 DDD$	rA   N)
r   r   r   r   r  r  r  r  r   r   r   s   @r#   r  r  )  s     %JO<, ,r%   r  z
macOS onlyc                   *   a  ] tR tRt o RtR tRtV tR# )TestZeroCopyMACOSi@  zposix._fcopyfilec                L    \         P                  ! W\        P                  4      # r(   )r   _fastcopy_fcopyfileposix_COPYFILE_DATArq  s   &&&r#   r  TestZeroCopyMACOS.zerocopy_funD  s    ))#E4H4HIIr%   rA   N)r   r   r   r   r  r  r   r   r   s   @r#   r  r  @  s     #JJ Jr%   r  c                   \  a  ] tR tRt o R tR tR t]P                  ! ]	P                  ! ]P                  P                  4       4      R4      ]P                  ! 4       ]P                  ! ]! ]	R4      R4      R 4       4       4       t]P$                  ! ]P&                  R	4      R
 4       tRtV tR# )TestGetTerminalSizeiH  c                    \         P                  ! 4       pV P                  VP                  ^ 4       V P                  VP                  ^ 4       R# )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.
N)r   get_terminal_sizer  columnslines)r   rM   s   & r#   test_does_not_crash'TestGetTerminalSize.test_does_not_crashI  s:     '')a0

A.r%   c                   \         P                  ! 4       ;_uu_ 4       pRVR&   VR \        P                  ! 4       pRRR4       V P	                  XP
                  R4       \         P                  ! 4       ;_uu_ 4       pVR RVR&   \        P                  ! 4       pRRR4       V P	                  VP                  R4       R#   + '       g   i     L; i  + '       g   i     LA; i)z.Check if environment variables have precedence777COLUMNSLINESNi	  888ix  )r   rB  r   r  r   r	  r
  r   rD  rM   s   &  r#   test_os_environ_first)TestGetTerminalSize.test_os_environ_firstS  s     **,,"C	NG++-D - 	s+**,,I CL++-D - 	S) -, -,s   C=CC	C$	c                &   \         P                  ! 4       ;_uu_ 4       pR VR&   RVR&   \        P                  ! 4       pRRR4       V P	                  XP
                  ^ 4       V P	                  VP                  ^ 4       R#   + '       g   i     LJ; i)r_  r  yyyr  N)r   rB  r   r  r  r	  r
  r  s   &  r#   test_bad_environ$TestGetTerminalSize.test_bad_environb  sk    **,,"C	N CL++-D - 	a0

A. -,s    B  B	z
not on ttyr  zneed os.get_terminal_size()c                
    \         P                  ! RR.4      P                  4       P                  4       p\        X^,          4      \        V^ ,          4      3p\        P                  ! 4       ;_uu_ 4       pVP                  RR4       \        P                  ! 4       pRRR4       V P                  VX4       R#   \        \
        \         P                  3 d    T P                  R4        Li ; i  + '       g   i     L[; i)zCheck if stty returns the same results ignoring env

This test will fail if stdin and stdout are connected to
different terminals with different sizes. Nevertheless, such
situations should be pretty rare.
sttyrM   zstty invocation failedr  r  N)r   r<  r@  r   r   r  r>  r  r   r   rB  unsetr   r  r   )r   rM   r  rD  r  s   &    r#   test_stty_match#TestGetTerminalSize.test_stty_matchj  s    	4**FF+;<CCEKKMD QL#d1g,/**,,IIgy)--/F - 	6* "?--/ 	4MM23	4
 -,s   4B; 7(C2;1C/.C/2D	zWASI has no /dev/nullc                Z   \         P                  ! 4       ;_uu_ 4       pVP                  R R4       \        P                  ! \
        RR4      ;_uu_ 4        \        P                  ! RR7      pRRR4       V P                  XP                  ^
4       V P                  VP                  ^4       \        \        P                  RRR7      ;_uu_ 4       p\        P                  ! \
        RV4      ;_uu_ 4        \        P                  ! R	R7      pRRR4       RRR4       V P                  VP                  ^4       V P                  VP                  ^(4       RRR4       R#   + '       g   i     L; i  + '       g   i     Lm; i  + '       g   i     Lx; i  + '       g   i     R# ; i)
r  r  
__stdout__N)fallbackwrW   rX   )
      )   r  )r   rB  r  r   r[  r   r   r  r   r	  r
  r:   r)   devnull)r   rD  rM   rQ   s   &   r#   test_fallback!TestGetTerminalSize.test_fallback  s   **,,IIgy) ""3d;;//B <T\\2.TZZ, bjj#88A""3a88//B 9 9 T\\2.TZZ, -, <; 98 98 -,,sU   7FE 	-A$F%F	6E3F	A F E0+F3F>F	FFF*	rA   N)r   r   r   r   r  r  r  r  r  r)   isattyr   r  rs   r   requires_subprocessro   r  r  is_wasir&  r   r   r   s   @r#   r  r  H  s     /*/ 3>>#8#8#:;\J  "%8968+8 # K+( __W__&=>- ?-r%   r  c                   *   a  ] tR tRt o RtR tRtV tR# )PublicAPITestsi  z>Ensures that the correct values are exposed in the public API.c                   V P                  \        R 4       . ROp\        \        R4      '       g   \        P                  R8X  d   VP                  R4       T P                  \        \        P                  4      \        V4      4       V P                  \        4      ;_uu_ 4        ^ RIHp RRR4       R#   + '       g   i     R# ; i)__all__statvfsr  r  )	ExecErrorN)ru  r  r>  rR  r  r  r  r  r   r   r  r   r   r   r   r   r	   r   r   r  r  r  r  r   )assertHasAttrr   ro   r)   rg   rd   r   r  r.  assertWarnsDeprecationWarningr0  )r   
target_apir0  s   &  r#   test_module_all_attribute(PublicAPITests.test_module_all_attribute  s    69-<
 2y!!RWW_l+V^^,c*o>011( 2111s   &B77C	rA   N)r   r   r   r   r  r5  r   r   r   s   @r#   r,  r,    s     H) )r%   r,  __main__)r%   )F)Yr  unittest.mockr   rp   r   r  r)   os.pathr    r/   r   rI   rK   r  r  r   r   r   r   r   r   r	   r
   r   r   r   r   r  r   r  ImportErrorr  r   test.supportr   test.support.os_helperr   r   r  r  r  r  r  r  r  r   rQ  rS  rP  r   r4  r5  AssertionErrorr  r$   r1   r>   rS   r]   re   r{   SUPPORTS_SENDFILEr   r   TestCaser   r  r7  r  r  r)  r  r  r  r   rY  rW  r  r  r  r  r  r  r  r  r  r,  r   mainrA   r%   r#   <module>rA     s       
  	        	6 6 6 6    " 3
3,f_
f_
)
,,
!
!'
*	ll2%O ==z"#>?  AL	)$
&: 01 	 	s"8,, s"l^28X.. ^2@~?x** ~?BD	88X.. D	8Nm1x** m1` 	,(++ , ,D
-Y 
-J-x** J-ZY)8$$ Y)xG-h'' G-T`H `HF[1. [1| 
&&(EF	F$=uE+183D3D + F G+: 
V335YZ, 68I8I , [,, 
UL)J)8+<+< J *JK-(++ K-\)X&& )( zMMO ]l  E"  O
  Gs6   "M "
M -M" 	MM	MM"	M/.M/