+
    Bi@                       ^ 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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 ^ RIHt ^ RIH t  ^ RIH!t! ^ RIH"t" ^ RIH#t# ^ RI$H%t%  ^ RI&t& ^ RI(t( ^ RI)t) ^ RI*t*]*PV                  ! 4        U u. uF  q PX                  NK  	  up t- ^ RI/t/^ R	I/H0t0H1t1  ^ RI3t3^ R
I4H5t5 ^ RIH6t6 ^ RI7H8t8 Rt9]:! ]	R4      '       d   ]	Pv                  ! 4       ^ 8H  t9]:! ]R4      '       dC   ]Px                  Pz                  '       d'   ]Px                  Pz                  P}                  R4      t?MRt?]PH                  P}                  R4      ;'       d    ]	P                  ! 4       ^ 8H  tAR tBRR ltC]P                  ! ]PH                  P}                  R4      R4      tER tF ! R R]P                  4      tH ! R R]P                  4      tI ! R R]P                  4      tJ ! R R]P                  4      tK^ RIHLtL  ! R  R!]LP                  4      tN ! R" R#]P                  4      tO]P                  ! ]:! ]	R$4      R%4       ! R& R']O4      4       tQ ! R( R)]O4      tR]P                  ! ]:! ]	R$4      R%4       ! R* R+]Q4      4       tS ! R, R-]P                  4      tT]P                  ! ]:! ]	R.4      R/4       ! R0 R1]P                  4      4       tU ! R2 R3]P                  4      tV]P                  ! ]P                  R44       ! R5 R6]P                  4      4       tX ! R7 R8]P                  4      tY]P                  ! ]:! ]	R94      R:4       ! R; R<]P                  4      4       tZ]P                  ! R=4      ^8H  ;'       g3    ]P                  ! R>4      ^8H  ;'       g    ]P                  ! R?4      ^8H  t\]P                  ! ]\R@4      ]P                  ! ]PH                  RA8H  RB4       ! RC RD]P                  4      4       4       t]]P                  RRE l4       t_]P                  ! ]:! ]	RF4      RG4       ! RH RI]P                  4      4       t`]P                  ! ]PH                  RJ8H  RK4       ! RL RM]P                  4      4       ta]P                  ! ]P                  RN4       ! RO RP]P                  4      4       tb]P                  ! ]:! ]	RQ4      RR4       ! RS RT]P                  4      4       tc]P                  ! ]PH                  RJ8H  RU4       ! RV RW]P                  4      4       td]P                  ! ]PH                  RJ8H  RU4       ! RX RY]P                  4      4       te]P                  ! ]PH                  RJ8H  RK4       ! RZ R[]P                  4      4       tf]P                  ! ]PH                  RJ8H  RK4       ! R\ R]]P                  4      4       tg]P                  ! ]	P                  R^8H  R_4       ! R` Ra]P                  4      4       ti]P                  ! ]:! ]	Rb4      Rc4       ! Rd Re]P                  4      4       tj]P                  ! ]PH                  RJ8H  RK4      ] P                   ! Rf Rg]P                  4      4       4       tl]P                  ! ]PH                  RJ8H  RK4       ! Rh Ri]P                  4      4       tm]P                  ! ]PH                  RJ8H  RK4       ! Rj Rk]P                  4      4       tn] P                   ! Rl Rm]P                  4      4       to ! Rn Ro]P                  4      tp ! Rp Rq]P                  4      tq]P                  ! 4        ! Rr Rs]P                  4      4       ts]P                  ! 4        ! Rt Ru]P                  4      4       tt]P                  ! Rv4      ]P                  ! ]:! ]	Rw4      Rx4       ! Ry Rz]P                  4      4       4       tv]P                  ! ]:! ]	R{4      ;'       d
    ]:! ]	R|4      R}4       ! R~ R]P                  4      4       tw]P                  ! ]:! ]	R4      R4       ! R R]P                  4      4       tyR tz]P                  ! ]z! 4       R4      ]P                  ! ^^^'4       ! R R]P                  4      4       4       t|]P                  ! ]:! ]	R4      R4       ! R R]P                  4      4       t}]P                  ! ]:! ]	R4      R4      ]P                  ! ^^4       ! R R]P                  4      4       4       t~]P                  ! ]:! ]	R4      R4      ]P                  ! ^^^4       ! R R]P                  4      4       4       t]P                  ! ]:! ]	R4      R4      ]P                  ! ]PH                  R8H  R4      ]P                  ! ^^^4       ! R R]P                  4      4       4       4       t ! R R]P                  4      t ! R R]P                  4      t]P                  ! 4        ! R R]P                  4      4       t]P                  ! ]:! ]	R4      R4       ! R R]P                  4      4       t ! R R]P                  4      t]P                  ! ]:! ]	R4      R4      ]P                  ! ]EP                  R4      ]P                  ! ]PH                  RJ8H  R4       ! R R]P                  4      4       4       4       t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t]EP                  ! 4        ! R R]P                  4      4       t]:! ]	R4      '       d    ! R R]4      t]R8X  d   ]EP"                  ! 4        R# R#   ]' d    Rt& EL8i ; i  ]' d    Rt( ELCi ; i  ]' d    Rt) ELNi ; iu up i   ]'].3 d    . t- EL6i ; i  ]' d    Rt/]Pd                  ;t0t1 ELGi ; i  ]' d    Rt3 ELRi ; i)    N)support)import_helper)	os_helper)socket_helper)infinite_recursion)warnings_helper)win32_is_iot)INT_MAXPY_SSIZE_T_MAXassert_python_ok)
unix_shell)FakePathFgeteuidthread_infolinuxthreadsfreebsdc                 Z    \         P                  ! \        \        V 4      R V ,          4      # )zrequires os.%s)unittest
skipUnlesshasattrosnames   &#/usr/lib/python3.14/test/test_os.pyrequires_os_funcr   \   s"    wr402BT2IJJ    c                     \        V R ^ 4      ;_uu_ 4       pVP                  V4       RRR4       R#   + '       g   i     R# ; i)xbN)openwrite)filenamecontentfps   && r   create_filer%   `   s.    	ha	 	 B
 
!	 	 	 s	   2A	aixz%on AIX, splice() only accepts socketsc                  D    \         P                  P                  R 4       R # N)asyncioevents_set_event_loop_policy r   r   tearDownModuler-   j   s    NN))$/r   c                   2   a  ] tR t^nt o R tR tR tRtV tR# )	MiscTestsc                \    \         P                  ! 4       pV P                  V\        4       R # r(   )r   getcwdassertIsInstancestrselfcwds   & r   test_getcwdMiscTests.test_getcwdo   s    iikc3'r   c           
        R p\         P                  R8X  d   Rp^pRpVRV\        V4      ,
          ,          ,           p\        P                  ! 4       ;_uu_ 4       p\
        P                  ! V4      ;_uu_ 4       pTp \        P                  ! 4       pV P                  Wv4       V\        V4      \        \        P                  P                  4      ,           ,
          pV^ 8:  d   Ml\        V4      V8  d   V^ 8  d   VRV p\        P                  P                  WS4      p \        P                  ! V4       \        P                  ! V4       TpK  \&        P(                  '       d   \+        R\        V4       24       RRR4       RRR4       R#   \         d     KM  \          d,   p	T	P"                  \"        P$                  8X  d    Rp	?	K|  h Rp	?	ii ; i  + '       g   i     L`; i  + '       g   i     R# ; i)i  vxworks  python_test_dir_aNz!Tested current directory length: )sysplatformlentempfileTemporaryDirectoryr   
change_cwdr   r1   assertEqualpathsepjoinmkdirchdirFileNotFoundErrorOSErrorerrnoENAMETOOLONGr   verboseprint)
r5   min_lendirlendirnametmpdirrE   expectedr6   needexcs
   &         r   test_getcwd_long_pathMiscTests.test_getcwd_long_paths   sw     <<9$G$SFS\$9:;((**f%%f--))+C$$S3"c#hRWW[[1A&ABDqy7|d*tax")%4.77<<6D"   $H???=c#hZHIC . +*( -  " "99(:(::!!	"1 .- +**sm   G*:B'G	",FG	(G	?G*GG	G(G)GG	GGG	G'"G**G;	c                    \         P                  ! 4       pV P                  V\        4       V P	                  \         P
                  ! V4      \         P                  ! 4       4       R # r(   )r   getcwdbr2   bytesrD   fsdecoder1   r4   s   & r   test_getcwdbMiscTests.test_getcwdb   s<    jjlc5)S)299;7r   r,   N)	__name__
__module____qualname____firstlineno__r7   rW   r]   __static_attributes____classdictcell____classdict__s   @r   r/   r/   n   s     (7Jr8 8r   r/   c                     a  ] tR t^t o R t]tR t]P                  ! ]	P                  R4      R 4       t]	P                  R 4       tR tR t]P                   ! ]! ]R4      R	4      ]P                   ! ]! ]R
4      R4      ]P                  ! ]	P&                  R4      R 4       4       4       tR t]	P                  ]P                   ! ]]8  R4      ]	P0                  ! ]^
,           ^RR7      R 4       4       4       t]	P                  ]P                   ! ]]8  R4      ]	P0                  ! ]^
,           ^RR7      R 4       4       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$]P                   ! ]! ]R4      R4      R  4       t%]P                   ! ]! ]R4      R4      R! 4       t&]P                   ! ]! ]R4      R4      R" 4       t']P                   ! ]! ]R#4      R$4      R% 4       t(]P                   ! ]! ]R#4      R$4      ])R& 4       4       t*]P                   ! ]! ]R#4      R$4      ])R' 4       4       t+]P                   ! ]! ]R#4      R$4      ])R( 4       4       t,R)t-V t.R*# )+	FileTestsc                    \         P                  P                  \        P                  4      '       d'   \         P
                  ! \        P                  4       R # R # r(   )r   rE   lexistsr   TESTFNunlinkr5   s   &r   setUpFileTests.setUp   s2    77??9++,,IIi&&' -r   c                F   \         P                  ! \        P                  \         P                  \         P
                  ,          4      p\         P                  ! V4       V P                  \         P                  ! \        P                  \         P                  4      4       R # r(   )
r   r    r   rk   O_CREATO_RDWRclose
assertTrueaccessW_OKr5   fs   & r   test_accessFileTests.test_access   sQ    GGI$$bjj&:;
		)"2"2BGG<=r   zWASI does not support dup.c                l   \         P                  ! \        P                  \         P                  \         P
                  ,          4      p\         P                  ! V4      p ^ pW!^,           8w  dQ   \         P                  ! V4       V^,          pV^
8  d   V P                  R4       T\         P                  ! V4      r!K]   \         P                  ! V4       \         P                  ! W^,           4       V P                  \        \         P                  VR4       R#   \         P                  ! T4       i ; i)r   z%couldn't allocate two consecutive fds   aN)r   r    r   rk   rq   rr   duprs   skipTest
closerangeassertRaisesrK   r!   )r5   firstsecondretriess   &   r   test_closerangeFileTests.test_closerange   s     	(("**RYY*>? 
	GAI%1R<MM"IJ &vv & HHV
eQY''288UD9 HHVs    AD D3c                    \         P                  p\        P                  ! V4      pV P	                  \
        \        P                  V^ 4       \        P                  ! V4      pV P                  W#4       R# r   N)	r   rk   r>   getrefcountr   	TypeErrorr   renamerD   )r5   rE   oldnews   &   r   test_renameFileTests.test_rename   sO    ood#)RYYa8ood#"r   c                   \        \        P                  R 4      ;_uu_ 4       pVP                  R4       VP	                  4        VP                  4       p\        P                  ! V^ ^ 4       \        P                  ! V^4      pV P                  \        V4      \        4       V P                  VR4       RRR4       R#   + '       g   i     R# ; i)w+b   spamN)r    r   rk   r!   flushfilenor   lseekreadrD   typer[   )r5   fobjfdss   &   r   	test_readFileTests.test_read   s    )""E**dJJwJJLBHHRAAAT!We,Q( +***s   BB??C	c           	     ,   \        \        P                  R 4      ;_uu_ 4       pVP                  R4       VP	                  4        VP                  4       p\        P                  ! V^ ^ 4       \        ^4      p\        P                  ! W#4      pV P                  \        V4      \        4       V P                  V^4       V P                  VR,          R4       RVR&   \        P                  ! W#4      pV P                  \        V4      \        4       V P                  V^ 4       V P                  \        V4      R4       \        P                  ! W#4      pV P                  V^ 4       V P                  \        V4      R4       V P                  \        P                  ! V\        4       4      ^ 4       \        P                  ! V^ ^ 4       V P                  \        P                  ! V\        4       4      ^ 4       RRR4       R#   + '       g   i     R# ; i)r   r   N   Ns   notspamNNNN)r    r   rk   r!   r   r   r   r   	bytearrayreadintorD   r   intr[   )r5   r   r   bufferr   s   &    r   test_readintoFileTests.test_readinto   sv   )""E**dJJwJJLBHHRAq\FB'AT!Wc*Q"VBZ1 #F1IB'AT!Wc*Q"U6]J7B'AQ"U6]J7 R[[Y[91= HHRAR[[Y[91=9 +***s   GHH	get_blocking-needs os.get_blocking() and os.set_blocking()piperequires os.pipe()z$set_blocking does not work correctlyc                   \         P                  ! 4       w  r \         P                  ! VR 4       V P                  \        4      ;_uu_ 4        \         P
                  ! V\        ^4      4       RRR4       \         P                  ! VR4       V P                  \         P
                  ! V\        ^4      4      ^4       V P                  \        4      ;_uu_ 4        \         P
                  ! V\        ^4      4       RRR4       \         P                  ! V4       RpV P                  \         P
                  ! V\        ^4      4      ^ 4       V P                  \         P
                  ! V\        ^4      4      ^ 4       \         P                  ! V4       Ve   \         P                  ! V4       R# R#   + '       g   i     ELJ; i  + '       g   i     L; i  \         P                  ! T4       Te   \         P                  ! T4       i i ; i)FNr   )
r   r   set_blockingr   BlockingIOErrorr   r   r!   rD   rs   )r5   rws   &  r   test_readinto_non_blocking$FileTests.test_readinto_non_blocking  sO    wwy	OOAu%""?33Ay|, 4 HHQ R[[IaL91= ""?33Ay|, 4 HHQKAR[[IaL91=R[[IaL91= HHQK} ' 433 43 HHQK} s=   4G !F/.A,G !G;B G /G 	:	G G	G 3H	c                   \        \        P                  R 4      ;_uu_ 4       pVP                  R4       VP	                  4        VP                  4       p\        P                  ! V^ ^ 4       R\        4       ^3 Fm  pV P                  R\        V4       24      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P                  ! W#4       RRR4       RRR4       Ko  	  V P                  R4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P                  ! V\        ^4      4       RRR4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ! V4       RRR4       \        ^4      p\        P                  ! W$4      pV P                  V^4       V P                  VR4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EK  ; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r   r   testzbad buffer Nzdoesn't work on file objects)r    r   rk   r!   r   r   r   r   r[   subTestr   r   r   r   r   rD   )r5   r   r   bad_argr   r   s   &     r   test_readinto_badargFileTests.test_readinto_badarg&  s   )""E**dJJwJJLBHHRA"EGR0\\KW"?@@**955B0 6 A@ 1
 <==&&y11KKil3 2 >
 ""9--B . q\FB'AQ"VW-/ +* 655 A@@
 21 >=
 .-! +**s   A?I "G2 GG2%I H	"!HH	%I 0H-	AI G/)	G22H=
I HH	H*%I -H=8I  I	zneeds INT_MAX < PY_SSIZE_T_MAXF)sizememusedry_runc                   V P                  \        P                  \        P                  4       \	        \        P                  R 4       \        \        P                  R4      ;_uu_ 4       p\        P                  ! VP                  4       V4      pRRR4       V P                  XR 4       R#   + '       g   i     L$; i)   testrbN)

addCleanupr   rl   rk   r%   r    r   r   r   rD   )r5   r   r$   datas   &&  r   test_large_readFileTests.test_large_read@  s{     		(()*:*:;I$$g. )""D))R77299;-D *
 	w' *)s   +&B--B=	c                   V P                  \        P                  \        P                  4       \	        \        P                  R 4       \        \        ^
,           4      p\        \        P                  R4      ;_uu_ 4       p\        P                  ! VP                  4       V4      pRRR4       V P                  X^4       V P                  VR,          R 4       R#   + '       g   i     L=; i)r   r   Nr   )r   r   rl   rk   r%   r   r
   r    r   r   r   rD   )r5   r   r   r$   lengths   &&   r   test_large_readintoFileTests.test_large_readintoT  s     		(()*:*:;I$$g.
 7R<()""D))R[[f5F *
 	#W- *)s   &CC,	c                   \         P                  ! \        P                  \         P                  \         P
                  ,          4      pV P                  \        \         P                  VR 4       \         P                  ! VR4       \         P                  ! V\        R4      4       \         P                  ! V\        R4      4       \         P                  ! V4       \        \        P                  R4      ;_uu_ 4       pV P                  VP                  4       P                  4       . RO4       RRR4       R#   + '       g   i     R# ; i)beanss   bacon
s   eggs
s   spam
r   N)s   bacons   eggsr   )r   r    r   rk   rq   O_WRONLYr   r   r!   r   
memoryviewrs   rD   r   
splitlines)r5   r   r   s   &  r   
test_writeFileTests.test_writej  s    WWY%%rzzBKK'?@)RXXr7;
Z 
Yy)*
Z	*+
)""D))TTYY[335,. *)))s   >1D99E
	c                x    \         P                  ! V\         P                  R R7      pV P                  V^ 4       R# )T)creationflagsshellN)
subprocesscallCREATE_NEW_CONSOLErD   )r5   argsretcodes   &* r   write_windows_consoleFileTests.write_windows_consolev  s0    //$$77	
 	!$r   win32z$test specific to the Windows consolec                    R pV P                  \        P                  RV4       V P                  \        P                  RRV4       R# )zprint('x' * 100000)-cz-uN)r   r>   
executabler5   codes   & r   test_write_windows_console$FileTests.test_write_windows_console~  s7     %""3>>4>""3>>4tDr   c                    \         P                  ! \        P                  \         P                  4      p\         P
                  ! V.VO5R R/ pVP                  4        R# )encodingutf-8N)r   r    r   rk   O_RDONLYfdopenrs   )r5   r   r   rx   s   &*  r   fdopen_helperFileTests.fdopen_helper  s=    WWY%%r{{3IIb242'2		r   c                (   \         P                  ! \        P                  \         P                  \         P
                  ,          4      p\         P                  ! V4       V P                  4        V P                  R 4       V P                  R ^d4       R# )r   N)r   r    r   rk   rq   rr   rs   r   r5   r   s   & r   test_fdopenFileTests.test_fdopen  sZ    WWY%%rzz"))';<
33$r   c                r   \         P                  R ,           pV P                  \         P                  \         P                  4       V P                  \         P                  V4       \	        \         P                  R4       \	        VR4       \
        P                  ! \         P                  V4       V P                  \        \
        P                  \         P                  4       \        VRRR7      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)z.2   1   2r   r   r   1N)r   rk   r   rl   r%   r   replacer   rJ   statr    rD   r   )r5   TESTFN2rx   s   &  r   test_replaceFileTests.test_replace  s    ""T)	(()*:*:;	(('2I$$d+GT"


9##W-+RWWi6F6FG'311QQVVXs+ 2111s   :!D%%D6	c                    \         P                  ! \        \         P                  R RR7      p\         P                  ! V4       R# )  N)rE   flagsmodedir_fd)r   r    __file__r   rs   rw   s   & r   test_open_keywordsFileTests.test_open_keywords  s(    GG5
r   c                    \         P                  ! \        R 4      p V! R\        P                  RRR7       R#   \
        \        3 d     R# i ; i)symlinktargetFN)srcdsttarget_is_directoryr   )r   get_attributer   r   rk   NotImplementedErrorrK   )r5   r   s   & r   test_symlink_keywordsFileTests.test_symlink_keywords  sG    ''I6	i&6&6$)$8#W- 		s   9 AAcopy_file_rangeztest needs os.copy_file_range()c                    V P                  \        4      ;_uu_ 4        \        P                  ! ^ ^R4       RRR4       R#   + '       g   i     R# ; ir   Ni)r   
ValueErrorr   r  rm   s   &r   #test_copy_file_range_invalid_values-FileTests.test_copy_file_range_invalid_values  s4    z**q!S) +***   AA	c                   \         P                  R ,           pRp\        \         P                  V4       V P                  \         P                  \         P                  4       \        \         P                  R4      pV P                  VP                  4       VP                  4       p\        VR4      pV P                  \         P                  V4       V P                  VP                  4       VP                  4       p \        P                  ! WF^4      pV P                  V\        ^ ^4      4       \        VR4      ;_uu_ 4       pV P                  VP                  4       VRV 4       RRR4       R#   + '       g   i     R# ; i  \         d=   pTP                  \        P                   8w  d   h T P#                  T4        Rp?R# Rp?ii ; i).3
   0123456789r   r   N)r   rk   r%   r   rl   r    rs   r   r   r  assertInrangerD   r   rK   rL   ENOSYSr~   )	r5   r   r   in_filein_fdout_fileout_fdies	   &        r   test_copy_file_rangeFileTests.test_copy_file_range  sG   ""T)I$$d+	(()*:*:;y''.& '	(('2'"	;""5!4A MM!U1a[)gt$$  bq: %$$$  	 ww%,,&MM!	s$   ?F $E44F	G1G

Gc                   \         P                  R ,           pRp^p^p^p\        \         P                  V4       V P                  \         P                  \         P                  4       \        \         P                  R4      pV P                  VP                  4       VP                  4       p\        VR4      pV P                  \         P                  V4       V P                  VP                  4       VP                  4       p	 \        P                  ! WyVVVR7      p
V P                  V
\        ^ V^,           4      4       \        VR4      ;_uu_ 4       pVP                  4       pRRR4       V P                  XRV RV,          4       V P                  WR W$WJ,            4       R#   + '       g   i     LJ; i  \         d=   pTP                  \        P                   8w  d   h T P#                  T4        Rp?R# Rp?ii ; i).4r  r   r   )
offset_src
offset_dstN    )r   rk   r%   r   rl   r    rs   r   r   r  r  r  r   rD   rK   rL   r  r~   )r5   TESTFN4r   bytes_to_copyin_skipout_seekr  r  r  r  r  r   r  s   &            r   test_copy_file_range_offset%FileTests.test_copy_file_range_offset  s   ""T)I$$d+	(()*:*:;y''.& '	(('2'"	6""5-.5.68A MM!U1mAo67gt$$||~ % T)8_gh.>? T)_!')46 %$  	 ww%,,&MM!	s$   F< F))F9	<H1G>>Hspliceztest needs os.splice()c                    V P                  \        4      ;_uu_ 4        \        P                  ! ^ ^R4       RRR4       R#   + '       g   i     R# ; ir  )r   r  r   r%  rm   s   &r   test_splice_invalid_values$FileTests.test_splice_invalid_values  s2    z**IIaC  +***r  c                ,  aa \         P                  R ,           pRp\        \         P                  V4       V P                  \         P                  \         P                  4       \        \         P                  R4      pV P                  VP                  4       VP                  4       p\        P                  ! 4       w  ooV P                  V3R l4       V P                  V3R l4        \        P                  ! VS^4      pV P                  V\        ^ ^4      4       V P                  \        P                  ! S^d4      VRV 4       R#   \         d=   pTP                   \         P"                  8w  d   h T P%                  T4        Rp?R# Rp?ii ; i)r  r  r   c                  0   < \         P                  ! S 4      # r(   r   rs   read_fds   r   <lambda>'FileTests.test_splice.<locals>.<lambda>       1r   c                  0   < \         P                  ! S 4      # r(   r+  write_fds   r   r.  r/         2r   N)r   rk   r%   r   rl   r    rs   r   r   r   r%  r  r  rD   r   rK   rL   r  r~   )	r5   r   r   r  r  r  r  r-  r3  s	   &      @@r   test_spliceFileTests.test_splice	  s     ""T)I$$d+	(()*:*:;y''.& GGI1223	>		%1-A MM!U1a[)RWWWc2D!H=  	 ww%,,&MM!	s   ,E F1FFc                R  a
a \         P                  R ,           pRp^p^p\        \         P                  V4       V P                  \         P                  \         P                  4       \        \         P                  R4      pV P                  VP                  4       VP                  4       p\        P                  ! 4       w  o
oV P                  V
3R l4       V P                  V3R l4        \        P                  ! VSW4R7      pV P                  V\        ^ V^,           4      4       \        P                  ! S
^d4      pV P                  WWDV,            4       R#   \         d=   p	T	P                   \         P"                  8w  d   h T P%                  T	4        Rp	?	R# Rp	?	ii ; i)r  r  r   c                  0   < \         P                  ! S 4      # r(   r+  r,  s   r   r.  1FileTests.test_splice_offset_in.<locals>.<lambda>:  r0  r   c                  0   < \         P                  ! S 4      # r(   r+  r2  s   r   r.  r9  ;  r4  r   )r  N)r   rk   r%   r   rl   r    rs   r   r   r   r%  r  r  r   rD   rK   rL   r  r~   )r5   r  r   r   r!  r  r  r  r   r  r-  r3  s   &         @@r   test_splice_offset_inFileTests.test_splice_offset_in*  s7    ""T)I$$d+	(()*:*:;y''.& GGI1223	<		%=MA MM!U1mAo67777C(D T	#:;  	 ww%,,&MM!	s   0E F&*1F!!F&c                (  aa \         P                  R ,           pRp^p^p\        \         P                  V4       V P                  \         P                  \         P                  4       \
        P                  ! 4       w  ooV P                  V3R l4       V P                  V3R l4       \
        P                  ! SV4       \        VR4      pV P                  \         P                  V4       V P                  VP                  4       VP                  4       p \
        P                  ! SWcVR7      pV P                  V\        ^ V^,           4      4       \        VR4      ;_uu_ 4       pVP                  4       p	RRR4       V P                  X	RV RV,          4       V P                  WR VRV 4       R#   + '       g   i     LE; i  \          d=   p
T
P"                  \"        P$                  8w  d   h T P'                  T
4        Rp
?
R# Rp
?
ii ; i)	r  r  c                  0   < \         P                  ! S 4      # r(   r+  r,  s   r   r.  2FileTests.test_splice_offset_out.<locals>.<lambda>\  r0  r   c                  0   < \         P                  ! S 4      # r(   r+  r2  s   r   r.  r?  ]  r4  r   r   )r  r   Nr  )r   rk   r%   r   rl   r   r   r!   r    rs   r   r%  r  r  r   rD   rK   rL   r  r~   )r5   r  r   r   r"  r  r  r  r  r   r  r-  r3  s   &          @@r   test_splice_offset_out FileTests.test_splice_offset_outP  s    ""T)I$$d+	(()*:*:;GGI1223
4 '	(('2'"	8		'6XNA MM!U1mAo67gt$$||~ % T)8_gh.>? T)_d2Ah7 %$  	 ww%,,&MM!	s$   G
 )F77G	
H1HHr,   N)/r_   r`   ra   rb   rn   tearDownry   r   skipIfr   is_wasir   cpython_onlyr   r   r   r   r   r   is_emscriptenr   r   r
   r   
bigmemtestr   r   r   r   r>   r?   r   r   r   r   r   r  r	  r  r#  r'  requires_splice_piper5  r;  rA  rc   rd   re   s   @r   rh   rh      s    ( H>
 __5::* # #)>> ^4DFV,.BC__W**,RS T DF6.4  >19;Wr\!UC( D; (  >19;Wr\!UC. D; . 
.% 0?AEAE
%,
 %679Z[* \* %679Z[; \;B %679Z[*6 \*6X X.0HI! J! X.0HI>  J>> X.0HI"<  J"<H X.0HI'8  J'8r   rh   c                   z  a  ] tR tRt o R tR tR tR tR t]	P                  ! ]! ]R4      R4      R	 4       t]	P                  ! ]! ]R4      R
4      R 4       t]	P                  ! ]P                   R8H  R4      R 4       t]	P                  ! ]P                   R8H  R4      ]	P                  ! ]! ]R4      R4      R 4       4       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RtV tR# )StatAttributeTestsi}  c                    \         P                  V n        V P                  \         P                  V P                  4       \        V P                  R 4       R# )   ABCN)r   rk   fnamer   rl   r%   rm   s   &r   rn   StatAttributeTests.setUp~  s5    %%
	(($**5DJJ'r   c           	        \         P                  ! V4      pV P                  V\        P                  ,          ^4       V P                  VP                  ^4       \        V4      p\        \        4       F  pVR,          R8X  g   K  VP                  4       pVP                  R4      '       d   R pMR pV P                  V! \        W%4      4      V\        \        V4      ,          4       V P                  WS4       K  	  RP                  4        FJ  p\        \        W$4      R,          4      p\        W$R,           4      R	,          pV P                  Wx^R
7       KL  	   \        VP                  R,          4      pVP                  R	,          pV P                  Wx^R
7        V^,           V P!                  R4        ^Vn        V P!                  R4        ^Vn        V P!                  R4        ^Vn        V P!                  R4        \         P,                  ! R4      p	V P!                  R4        \         P,                  ! R4      p	R#   \         d     Li ; i  \"         d     Li ; i  \         d     Li ; i  \        \(        3 d     Li ; i  \         d     Li ; i  \(         d     Li ; i  \(         d     R# i ; i)   :NrQ  NST_TIMEc                     \        V 4      # r(   )r   xs   &r   trunc7StatAttributeTests.check_stat_attributes.<locals>.trunc  s
    Q-r   c                     V # r(   r,   rU  s   &r   rW  rX    s    (r   zst_atime st_mtime st_ctimei _nsi'  deltaNo exception raisedN
   r         rQ  r               	   r_              )r   r   rD   ST_SIZEst_sizedirlowerendswithgetattrr  splitr   assertAlmostEqualst_birthtimest_birthtime_nsAttributeErrorfail
IndexErrorst_modest_rdevr   parrotstat_result)
r5   rN  resultmembersr   attrrW  floatynanosecondyresult2s
   &&        r   check_stat_attributes(StatAttributeTests.check_stat_attributes  sk    	-q1+ f+IDBx5 zz|==((/*  wv'<!="(t)<"=?d,  1668D.78F!&,75@K""6a"@ 9	A,,v56F 00E9K ""6a"@	3KII+,
	FNII+,	FNII+,	FMII+,
	nnU+GII+,
	nn%IJGO  		  		  		 	* 		  		  		  		s~   /I "I =I* I; /J 'J# 0J4 III'&I'*I87I8;JJJ J #J10J14KKc                <    V P                  V P                  4       R # r(   )r  rN  rm   s   &r   test_stat_attributes'StatAttributeTests.test_stat_attributes  s    ""4::.r   c                     V P                   P                  \        P                  ! 4       4      pV P                  X4       R#   \         d&    T P                  R T P                   ,          4        LBi ; i)z#cannot encode %a for the filesystemN)rN  encoder>   getfilesystemencodingUnicodeEncodeErrorr~   r  )r5   rN  s   & r   test_stat_attributes_bytes-StatAttributeTests.test_stat_attributes_bytes  s^    	NJJ%%c&?&?&ABE 	""5) " 	NMM?$**LM	Ns   .A -A32A3c                   \         P                  ! V P                  4      p\        \        P
                  ^,           4       F  pV P                  RV 24      ;_uu_ 4        \        P                  ! W4      pV P                  RV4       V^8  d   V P                  RV4       \        P                  ! V4      pV P                  W4       RRR4       K  	  R#   + '       g   i     K  ; i)ra  z	protocol s   stat_results   cos
stat_result
N)r   r   rN  r  pickleHIGHEST_PROTOCOLr   dumpsr  loadsrD   r5   r}  protop	unpickleds   &    r   test_stat_result_pickle*StatAttributeTests.test_stat_result_pickle  s    $622Q67E	%122LL/na019MM"7;"LLO	  3 32 8222s    A)CC(statvfsztest needs os.statvfs()c                   \         P                  ! V P                  4      pV P                  VP                  V^,          4       Rp\        V4       F.  w  r4V P                  \        VRV,           4      W,          4       K0  	  V P                  \        VP                  \        4      4       V P                  \        V4      ^
4        ^Vn        V P                  R4        ^Vn        V P                  R4        \         P                  ! R4      pV P                  R4        \         P                  ! R4      pR#   \         d     Lgi ; i  \         d     L_i ; i  \          d     LHi ; i  \          d     R# i ; i)rQ  f_r]  N)
bsizefrsizeblocksbfreebavailfilesffreefavailflagnamemaxr^  r`  )r   r  rN  rD   f_bfree	enumeraterq  rt   
isinstancef_fsidr   r@   rw  rv  r{  statvfs_resultr   )r5   r}  r~  valuememberr  s   &     r   test_statvfs_attributes*StatAttributeTests.test_statvfs_attributes  sI   DJJ' 	3:&w/MEWVTF];V]K 0 	
6==#67 	Vb)	FNII+,	FMII+,
	''.GII+,
	''(LMG%  		  		  		  		sH   D: !E :'E "E- :EEEEE*)E*-E<;E<need os.statvfs()c                d   \         P                  ! V P                  4      p\        \        P
                  ^,           4       Fk  p\        P                  ! W4      pV P                  RV4       V^8  d   V P                  RV4       \        P                  ! V4      pV P                  W4       Km  	  R# )ra  s   statvfs_results   cos
statvfs_result
N)
r   r  rN  r  r  r  r  r  r  rD   r  s   &    r   test_statvfs_result_pickle-StatAttributeTests.test_statvfs_result_pickle  s~     DJJ'622Q67EV+AMM+Q/qy6:QIV/ 8r   r   Win32 specific testsc                     \         P                  ! R 4       R#   \         d    T P                  R4        R# \         d   pT P                  R4        Rp?R# Rp?ii ; i)zc:\pagefile.syszc:\pagefile.sys does not existzCould not stat pagefile.sysN)r   r   rJ   r~   rK   rw  r5   r  s   & r   test_1686475StatAttributeTests.test_1686475  sI    	5GG&'  	=MM;< 	5II344	5s     AAAAAr   r   c                "   \         P                  ! 4       w  r \         P                  ! V4       \         P                  ! V4       \         P                  ! V4       V P	                  \
        4      ;_uu_ 4       p\         P                  ! V4       R R R 4       V P                  XP                  P                  \        P                  4       R #   \         P                  ! T4       \         P                  ! T4       i ; i  + '       g   i     Lw; ir(   )
r   r   r   rs   r   rK   rD   	exceptionrL   EBADF)r5   r   r   ctxs   &   r   
test_15261StatAttributeTests.test_15261%  s     wwy	GGAJHHQKHHQKw''3GGAJ (,,ekk:	 HHQKHHQK''s   C 8C>.C;>D	c                    V P                  VR 4       V P                  \        VP                  \        4      4       T P                  ^ VP                  u;8*  ;'       d    R8*  4       R# u 4       R# )st_file_attributes    N)assertHasAttrrt   r  r  r   )r5   r}  s   &&r   check_file_attributes(StatAttributeTests.check_file_attributes3  sQ    6#78
6#<#<cBCV66DD*DEDEr   z$st_file_attributes is Win32 specificc                0   \         P                  ! V P                  4      pV P                  V4       V P	                  VP
                  \        P                  ,          ^ 4       \        P                  R,           p\         P                  ! V4       V P                  \         P                  V4       \         P                  ! V4      pV P                  V4       V P	                  VP
                  \        P                  ,          \        P                  4       R# )r   rn  N)r   r   rN  r  rD   r  FILE_ATTRIBUTE_DIRECTORYr   rk   rH   r   rmdir)r5   r}  rR   s   &  r   test_file_attributes'StatAttributeTests.test_file_attributes8  s     $""6*%%(E(EE	
 ""U*
'*!""6*%%(E(EE))	+r   c                   \         P                  P                  \         P                  R ,          V P                  R,           4      pV P                  \        P                  V4       \        VR4       ^p\        P                  ! RVRR.VR7       \         P                  ! V4      pV P                  VP                  ^ 4       V P                  \         P                  P                  V4      4       R# )TEMP_accessrM  z
icacls.exez/denyz*S-1-5-32-545:(S)r   N)r   rE   rG   environrN  r   r   rl   r%   r   
check_callr   assertNotEqualrm  rt   isfile)r5   rN  DETACHED_PROCESSr}  s   &   r   test_access_denied%StatAttributeTests.test_access_deniedM  s     RZZ/i1GH	((%0E6"  5'+>?*		
 FNNA.u-.r   c                   R \         P                  P                  \         P                  ! 4       4      ^ ,          ,           p\         P                  ! V4      pV P                  VP                  \        P                  4       R# )z//./N)r   rE   
splitdriver1   r   rD   ry  S_IFBLK)r5   rN  r}  s   &  r   test_stat_block_device)StatAttributeTests.test_stat_block_devicec  sM     ++BIIK8;;6r   )rN  N)r_   r`   ra   rb   rn   r  r  r  r  r   r   r   r   r  r  r>   r?   r  r  r  r  r  r  rc   rd   re   s   @r   rK  rK  }  sy    (
HT/*	4 Y/1JK) L)V Y/,.	0.	0 02HI5 J5 02HIV,.BC
; D J
;F
 0?A+A+& 02HI/ J/* 02HI7 J7r   rK  c                     a  ] tR tRt o R tR tRR ltR t]R 4       t	R t
R	 t]P                  ! ]P                  ]P                   9   R
4      R 4       t]P                  ! ]P                  ]P$                  9   R4      R 4       t]P                  ! ]P                  ]P(                  9   R4      R 4       tR tR tR tR tR tR tR tR t]P>                  R 4       t Rt!V t"R# )
UtimeTestsil  c                L   \         P                  V n        \        P                  P                  V P                  R 4      V n        V P                  \         P                  V P                  4       \        P                  ! V P                  4       \        V P                  4       R# )f1N)r   rk   rR   r   rE   rG   rN  r   rmtreerH   r%   rm   s   &r   rn   UtimeTests.setUpm  s]     ''WW\\$,,5
	(($,,7
DJJr   c                    \         P                  ! V4      pVP                  V^,          8g  ;'       g5    VP                  V^,          8g  ;'       g    VP                  V^	,          8g  # )re  )r   r   st_atimest_mtimest_ctime)r5   r"   sts   && r   support_subsecondUtimeTests.support_subsecondu  s[     WWX1% * *KK2a5(* *KK2a5(	+r   Nc                   V'       g   V P                   pV P                  V4      pV'       d   R pRpMRpRpV! W$V34       \        P                  ! V4      p\        P
                  '       d   RpV P                  VP                  VR,          RR7       V P                  VP                  VR,          RR7       V P                  VP                  VR	R7       V P                  VP                  VR	R7       R# V'       dL   V P                  VP                  VR,          RR7       V P                  VP                  VR,          RR7       MFV P                  VP                  VR,          4       V P                  VP                  VR,          4       V P                  VP                  V4       V P                  VP                  V4       R# )
i8Z;l   
o] gh㈵>&.>r[  gư>N    rT l    P9 g     @)rN  r  r   r   r   rG  rs  r  r  st_atime_nsst_mtime_nsrD   )r5   set_timer"   r  atime_nsmtime_nsr  r\  s   &&&     r   _test_utimeUtimeTests._test_utime}  si   zzH 228< "H!H !H Hh/0WWX    E""2;;4t"L""2;;4t"L""2>>8:"N""2>>8:"N &&r{{HtO4&P&&r{{HtO4&P  ho>  ho>R^^X6R^^X6r   c                .    R  pV P                  V4       R# )c                 4    \         P                  ! WR 7       R# nsNr   utimer"   r  s   &&r   r  'UtimeTests.test_utime.<locals>.set_time      HHX%r   Nr  r5   r  s   & r   
test_utimeUtimeTests.test_utime  s    	& 	"r   c                "    V R ,          R,           # )r  g&.>r,   r  s   &r   	ns_to_secUtimeTests.ns_to_sec  s    
 T	V##r   c                6   a  V 3R  lpS P                  V4       R# )c                    < Vw  r#SP                  V4      pSP                  V4      p\        P                  ! WV34       R # r(   r  r   r  r"   r  r  r  atimemtimer5   s   &&    r   r  2UtimeTests.test_utime_by_indexed.<locals>.set_time  s9    !#HNN8,ENN8,E HHXu~.r   Nr  r  s   f r   test_utime_by_indexed UtimeTests.test_utime_by_indexed  s    	/ 	"r   c                6   a  V 3R  lpS P                  V4       R# )c                    < Vw  r#SP                  V4      pSP                  V4      p\        P                  ! WV3R 7       R# ))timesNr  r  s   &&    r   r  0UtimeTests.test_utime_by_times.<locals>.set_time  s7    !#HNN8,ENN8,EHHXU^4r   Nr  r  s   f r   test_utime_by_timesUtimeTests.test_utime_by_times  s    	5 	"r   z9follow_symlinks support for utime required for this test.c                .    R  pV P                  V4       R# )c                 6    \         P                  ! WR R7       R# )F)r  follow_symlinksNr  r  s   &&r   r  9UtimeTests.test_utime_nofollow_symlinks.<locals>.set_time  s     HHXe<r   Nr  r  s   & r   test_utime_nofollow_symlinks'UtimeTests.test_utime_nofollow_symlinks  s    	= 	"r   z,fd support for utime required for this test.c                .    R  pV P                  V4       R# )c                     \        V R ^ 4      ;_uu_ 4       p\        P                  ! VP                  4       VR7       RRR4       R#   + '       g   i     R# ; i)wbr  N)r    r   r  r   )r"   r  r$   s   && r   r  *UtimeTests.test_utime_fd.<locals>.set_time  s8    ha((B , )(((   'AA	Nr  r  s   & r   test_utime_fdUtimeTests.test_utime_fd  s    	-
 	"r   z0dir_fd support for utime required for this test.c                .    R  pV P                  V4       R# )c                     \         P                  P                  V 4      w  r#\        P                  ! V4      ;_uu_ 4       p\         P
                  ! W4VR 7       RRR4       R#   + '       g   i     R# ; i))r   r  N)r   rE   rr  r   open_dir_fdr  )r"   r  rR   r   dirfds   &&   r   r  .UtimeTests.test_utime_dir_fd.<locals>.set_time  sF    GGMM(3MG&&w//53 0///s    A##A4	Nr  r  s   & r   test_utime_dir_fdUtimeTests.test_utime_dir_fd  s    	4
 	"r   c                D    R  pV P                  WP                  R7       R# )c                 4    \         P                  ! WR 7       R# r  r  r  s   &&r   r  1UtimeTests.test_utime_directory.<locals>.set_time  r  r   )r"   N)r  rR   r  s   & r   test_utime_directoryUtimeTests.test_utime_directory  s    	& 	LL9r   c                n   \         P                   ! 4       pV! V P                  4       V P                  V P                  4      '       g   R pMRp\        P                  ! V P                  4      pRVP
                  : RV: RVP
                  V,
          : 2pV P                  VP
                  VW5R7       R# )      ?g?zst_time=z
, current=z, dt=)r\  msgN)timerN  r  r   r   r  rs  )r5   r  currentr\  r  r+  s   &&    r   _test_utime_currentUtimeTests._test_utime_current  s    ))+ 	%%djj11E EWWTZZ ++wg(=?r{{G%* 	 	5r   c                6   a  V 3R  lpS P                  V4       R# )c                 H   < \         P                  ! SP                  4       R # r(   r   r  rN  r"   r5   s   &r   r  /UtimeTests.test_utime_current.<locals>.set_time  s    HHTZZ r   Nr.  r  s   f r   test_utime_currentUtimeTests.test_utime_current  s    	! 	  *r   c                6   a  V 3R  lpS P                  V4       R# )c                 J   < \         P                  ! SP                  R 4       R # r(   r2  r3  s   &r   r  3UtimeTests.test_utime_current_old.<locals>.set_time  s    HHTZZ&r   Nr5  r  s   f r   test_utime_current_old!UtimeTests.test_utime_current_old  s    	' 	  *r   c                "   \         P                   ! 4       pR pV P                  \        4      ;_uu_ 4       p\        P                  ! W!V34       RRR4       V P                  XP                  P                  V4       R#   + '       g   i     L8; i)nonexistentN)r,  r   rJ   r   r  rD   r  r"   )r5   nowr"   cms   &   r   test_utime_nonexistent!UtimeTests.test_utime_nonexistent  s^    iik 011RHHXSz* 2..9 21s   A>>B	c                   \         P                  R 8X  d   \        P                  P	                  \        P                  P                  V4      4      ^ ,          R,           p^ RIpVP                  P                  pVP                  R^d4      pVP                  VR^ RRRV\        V4      4      pV'       d   VP                  # R# R# )r   \N )r>   r?   r   rE   r  abspathctypeswindllkernel32create_unicode_bufferGetVolumeInformationWr@   r  )r5   rE   rootrG  rI  bufoks   &&     r   get_file_systemUtimeTests.get_file_system  s    <<7"77%%bggood&;<Q?$FD}}--H..r37C//dA04dD03SX?B yy   #r   c                $   V P                  V P                  4      R 8w  d   V P                  R4       Rp\        P                  ! V P
                  W34       V P                  \        P                  ! V P
                  4      P                  V4       R# )NTFSzrequires NTFSr  N)	rO  rR   r~   r   r  rN  rD   r   r  )r5   larges   & r   test_large_timeUtimeTests.test_large_time%  sc     -7MM/*
e^,,55u=r   c           	        V P                  \        4      ;_uu_ 4        \        P                  ! V P                  RRR7       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! V P                  ^^.4       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! V P                  R4       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! V P                  R	4       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! V P                  ^^.R7       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! V P                  RR7       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! V P                  R	R7       RRR4       \        P                  \        P                  9  dJ   V P                  \        4      ;_uu_ 4        \        P                  ! V P                  RRR7       RRR4       \        P                  \        P                  9  dt   \        V P                  R^ 4      ;_uu_ 4       pV P                  \
        4      ;_uu_ 4        \        P                  ! VP                  4       R4       RRR4       RRR4       \        P                  \        P                  9  dL   V P                  \        4      ;_uu_ 4        \        P                  ! V P                  R^ R7       RRR4       R# R#   + '       g   i     EL4; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELc; i  + '       g   i     EL/; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL); i  + '       g   i     EL5; i  + '       g   i     R# ; i)
rc  r  NFr  r  r   )rc  rc  )rc  )rc  rc  rc  )r   r  r   r  rN  r   supports_follow_symlinksr  supports_fdr    r   supports_dir_fd)r5   r$   s   & r   test_utime_invalid_arguments'UtimeTests.test_utime_invalid_arguments/  sv   z**HHTZZF3 +y))HHTZZ!Q( *y))HHTZZ& *y))HHTZZ+ *y))HHTZZQF+ *y))HHTZZD) *y))HHTZZI. * 882666""#677VUC 8882>>)djj$**b&&y11HHRYY[&1 2 + 882---""#677VA6 87 .- +**)))))))))))))))))) 877 211 +** 877s   $M-'$N0"N7"N)>%N=#O#O%;$O9)P!&P	-P!=$P5-M>	N	N&	)N:	=O	O"	%O6	9P
	P	P!!P2	5Q	c                `   R  pV P                  \        4      ;_uu_ 4        \        P                  ! V P                  V! ^*4      ^3R7       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ! V P                  V! R4      ^3R7       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ! V P                  V! R4      ^3R7       RRR4       R#   + '       g   i     L; i  + '       g   i     Lu; i  + '       g   i     R# ; i)c                 ,   a   ! V 3R  lR4      pV! 4       # )c                   .   <a  ] tR tRt o V3R ltRtV tR# )?UtimeTests.test_issue31577.<locals>.get_bad_int.<locals>.BadIntiP  c                    < S# r(   r,   )r   divmod_ret_vals   *r   
__divmod__JUtimeTests.test_issue31577.<locals>.get_bad_int.<locals>.BadInt.__divmod__Q  s	    ))r   r,   N)r_   r`   ra   rb   rd  rc   rd   )rf   rc  s   @r   BadIntra  P  s     * *r   rf  r,   )rc  rf  s   f r   get_bad_int/UtimeTests.test_issue31577.<locals>.get_bad_intO  s    * * 8Or   r  Nr,   )ra  rb  rQ  )r   r   r   r  rN  )r5   rg  s   & r   test_issue31577UtimeTests.test_issue31577K  s    	
 y))HHTZZ[_a$89 *y))HHTZZ[_a$89 *y))HHTZZ[%;Q$?@ *)	 *))))))s#   +C61+D	+D6D		D	D-	)rR   rN  r(   )#r_   r`   ra   rb   rn   r  r  r  staticmethodr  r  r  r   r   r   r  rY  r  rZ  r  r[  r"  r'  r.  r6  r;  rA  rO  rT  r\  r   rF  ri  rc   rd   re   s   @r   r  r  l  s     ++7Z# $ $	## R%@%@@*+#+# R^^3GI#I# R%7%77KM#M#:5,++:
!>78 A Ar   r  )mapping_testsc                     a  ] tR tRt o RtRtR tR tR tR t	]
P                  ! ];'       d    ]P                  P                  ]4      R4      ]
P                  ! ]! ]R	4      R
4      ]P$                  ! 4       R 4       4       4       t]
P                  ! ];'       d    ]P                  P                  ]4      R4      ]
P                  ! ]! ]R	4      R
4      ]P$                  ! 4       R 4       4       4       tR tR tR tR t]
P                  ! ]P2                  R4      R 4       t]P$                  ! 4       R 4       t]P8                  ! ^
^4      R 4       tR tR tR t R t!R t"R t#R t$R t%R t&R t'R t(R  t)R!t*V t+R# )"EnvironTestsi^  z8check that os.environ object conform to mapping protocolNc                   \        \        P                  4      V n        \        P                  '       d   \        \        P
                  4      V n        V P                  4       P                  4        F  w  rV\        P                  V&   K  	  R # r(   )	dictr   r  _EnvironTests__savesupports_bytes_environenvironb_EnvironTests__saveb
_referenceitemsr5   keyr  s   &  r   rn   EnvironTests.setUpb  sW    2::&$$$,DL//+113JC#BJJsO 4r   c                R   \         P                  P                  4        \         P                  P                  V P                  4       \         P
                  '       dJ   \         P                  P                  4        \         P                  P                  V P                  4       R # R # r(   )r   r  clearupdaterq  rr  rs  rt  rm   s   &r   rC  EnvironTests.tearDowni  s_    





$++&$$$KKKKt||, %r   c                    R RRRRR/# )KEY1VALUE1KEY2VALUE2KEY3VALUE3r,   rm   s   &r   ru  EnvironTests._referencep  s    x&BBr   c                ^    \         P                  P                  4        \         P                  # r(   )r   r  r{  rm   s   &r   _empty_mappingEnvironTests._empty_mappings  s    


zzr   zrequires a shellpopenzneeds os.popen()c                n   \         P                  P                  4        \         P                  P                  R R7       \         P                  ! R\
        ,          4      ;_uu_ 4       pVP                  4       P                  4       pV P                  VR 4       RRR4       R#   + '       g   i     R# ; i)World)HELLOz%s -c 'echo $HELLO'N)	r   r  r{  r|  r  r   r   striprD   )r5   r  r  s   &  r   test_update2EnvironTests.test_update2x  ss    
 	




(XX+j899UJJL&&(EUG, :999s   (1B##B4	c                   \         P                  ! R \        ,          4      ;_uu_ 4       p\        V4      pV P	                  \        V4      R4       V P	                  \        V4      R4       V P	                  \        V4      R4       V P                  \        \
        V4       RRR4       R#   + '       g   i     R# ; i)z %s -c 'echo "line1
line2
line3"'zline1
zline2
zline3
N)r   r  r   iterrD   nextr   StopIteration)r5   r  its   &  r   test_os_popen_iterEnvironTests.test_os_popen_iter  s    
 XX<"# $ $',eBT"Xy1T"Xy1T"Xy1mT26$ $ $ $s   A8B,,B=	c                    \         P                  P                  4        FC  w  rV P                  \	        V4      \
        4       V P                  \	        V4      \
        4       KE  	  R # r(   )r   r  rv  rD   r   r3   )r5   rx  vals   &  r   test_keyvalue_types EnvironTests.test_keyvalue_types  sC    

((*HCT#Y,T#Y, +r   c                    V P                  4       P                  4        F4  w  rV P                  \        P                  P                  V4      V4       K6  	  R # r(   )ru  rv  rD   r   r  getrw  s   &  r   
test_itemsEnvironTests.test_items  s;    //+113JCRZZ^^C0%8 4r   c                    \         P                  pRP                  R VP                  4        4       4      pV P	                  \        V4      RV R24       R# )z>Check that the repr() of os.environ looks like environ({...}).z, c              3   8   "   T F  w  rV: R V: 2x  K  	  R# 5i)z: Nr,   ).0rx  r  s   &  r   	<genexpr>-EnvironTests.test___repr__.<locals>.<genexpr>  s$      $
)
 gRy!)s   z	environ({z})N)r   r  rG   rv  rD   repr)r5   envformatted_itemss   &  r   test___repr__EnvironTests.test___repr__  sL    jj)) $
!iik$
 
 	cj0A$EFr   c                   \         P                  P                  \         P                  4      p. ROpR\         P                  P	                  V4      /p\         P
                  p \        V4      \         n        V P                  V\         P                  ! 4       4       V P                  V\         P                  ! RR7      4       V\         n        V P                  V\         P                  ! / 4      4       V P                  R\         P                  ! RR/4      4       V P                  V\         P                  ! V4      4       \         P                  '       d    \        P                  ! RR7      ;_uu_ 4        RRRR	/pRRR4       V P                  \        \         P                  X4       V P                  \         P                  ! RR
/4      R.4       V P                  \         P                  ! RR/4      R.4       V P                  \         P                  ! RR
/4      R.4       R# R#   T\         n        i ; i  + '       g   i     L; i  \         d     Li ; i)/montyrE  PATHNr  T)recordr      PATHr      abcabc)r  z/pythonrE  z/flying/circusrE  )r   defpathrr  pathseprG   r  rp  assertSequenceEqualget_exec_pathrr  warningscatch_warningsr   r  BytesWarning)r5   defpath_list	test_pathtest_envsaved_environ	mixed_envs   &     r   test_get_exec_pathEnvironTests.test_get_exec_path  s   zz''

3?	BJJOOI67

	'hBJ$$Y0@0@0BC$$Y0@0@T0JK&BJ 	  r/?/?/CD  (8(8&(EF  B,<,<X,FG$$$K,,D99!'gt <I : !!*b.>.>	J $$R%5%5w6G%H$$R%5%5w6F%G$$R%5%5vv6F%G# % 'BJ :9 s7   $A H, I 9H< I ,H9<I	I IIz#os.environb required for this test.c                   R p VP                  \        P                  ! 4       R4      pV\
        P                  R&   V P                  \
        P                  R,          V4       V P                  \
        P                  R,          X4       RpV\
        P                  R&   V P                  \
        P                  R,          V4       VP                  \        P                  ! 4       R4      pV P                  \
        P                  R,          V4       R#   \         d/    R\        P                  ! 4       : 2pT P	                  T4        EL#i ; i)	u   euro€surrogateescapez%U+20AC character is not encodable to unicodes   unicode   s   bytesr[   N)
r  r>   r  r  r~   r   r  rD   rs  decode)r5   r  value_bytesr+  	value_strs   &    r   test_environbEnvironTests.test_environb  s     	,,s'@'@'B'8:K !&

9I.6Z0+>  %HX.6LL!:!:!<>OP	G,i8 " 	))+.CMM#	s   %D 5EEc           	        R pRpRV: R2p\         P                  ! 4       ;_uu_ 4       pVP                  VR4       \        P                  ! W4       \
        P                  ! \        P                  RV.R\
        P                  RR7      pV P                  VP                  P                  4       \        V4      4       \        P                  ! V4       \
        P                  ! \        P                  RV.R\
        P                  RR7      pV P                  VP                  P                  4       \        R4      4       RRR4       R#   + '       g   i     R# ; i)PYTHONTESTVAR	testvaluez%import os; print(repr(os.environ.get(z)))Nr   T)checkstdouttext)r   EnvironmentVarGuardpopr   putenvr   runr>   r   PIPErD   r  rstripr  unsetenv)r5   r   r  r   r  procs   &     r   test_putenv_unsetenv!EnvironTests.test_putenv_unsetenv  s    6thcB**,,GGD$IId">>3>>4">d)3tEDT[[//14;?KK>>3>>4">d)3tEDT[[//14:> -,,,s   DE

E	c                   R FZ  pV P                  \        \        3\        P                  VR4       V P                  \        \        3\        P
                  V4       K\  	  R	 FN  pV P                  \        \        P                  VR4       V P                  \        \        P
                  V4       KP  	  \        P                  R8X  d}   RR,          pV P                  \        \        P                  VR4       V P                  \        \        P                  RV4       V P                  \        \        P
                  V4       R# R# )
rE  r  r   rV     r   XN)rE  z=namezna=mezname=)zname zna me)r   rK   r  r   r  r  r>   r?   )r5   r   longstrs   &  r   test_putenv_unsetenv_error'EnvironTests.test_putenv_unsetenv_error  s     4Dw
3RYYgNw
3R[[$G 4 )Dj"))T7Cj"++t< ) <<7" FlGj"))WcBj"))S'Bj"++w? #r   c                   R pV P                  V\        P                  4       V P                  \        4      ;_uu_ 4       p\        P                  V,           RRR4       V P                  XP                  P                  ^ ,          V4       V P                  VP                  P                  4       V P                  \        4      ;_uu_ 4       p\        P                  V RRR4       V P                  VP                  P                  ^ ,          V4       V P                  VP                  P                  4       R#   + '       g   i     L; i  + '       g   i     Lw; i)
missingkeyN)
assertNotInr   r  r   KeyErrorassertIsr  r   rt   __suppress_context__)r5   missingr@  s   &  r   test_key_typeEnvironTests.test_key_type  s    "**-x((BJJw )bll''*G499:x((B

7# )bll''*G499: )(
 )(s    D=E=E	E 	c                   \        V4      pR p\        V4       R\        P                  V&    \        V4       V P	                  \        P                  V,          R4       \        P                  V R#   \        P                  T i ; i)__new_key__test_environ_iterationN)r  r  r   r  rD   )r5   
collectioniteratornew_keys   &&  r   _test_environ_iteration$EnvironTests._test_environ_iteration  sg    
#X 7

7	$NRZZ02JK

7#

7#s   2A2 2Bc                D    V P                  \        P                  4       R # r(   )r  r   r  rm   s   &r   (test_iter_error_when_changing_os_environ5EnvironTests.test_iter_error_when_changing_os_environ)  s    $$RZZ0r   c                `    V P                  \        P                  P                  4       4       R # r(   )r  r   r  rv  rm   s   &r   .test_iter_error_when_changing_os_environ_items;EnvironTests.test_iter_error_when_changing_os_environ_items,  s    $$RZZ%5%5%78r   c                `    V P                  \        P                  P                  4       4       R # r(   )r  r   r  valuesrm   s   &r   /test_iter_error_when_changing_os_environ_values<EnvironTests.test_iter_error_when_changing_os_environ_values/  s    $$RZZ%6%6%89r   c                   \         '       d*   \        P                  P                  \         4      '       g   R # \        P
                  '       g   R # \        P                  ! \          RV R24      ;_uu_ 4       pVP                  4       P                  4       pR R R 4       V P                  VX4       R #   + '       g   i     L$; i)Nz -c 'echo $')
r   r   rE   existsr   has_subprocess_supportr  r   r  rD   )r5   varrT   r  r  s   &&&  r   _test_underlying_process_env)EnvironTests._test_underlying_process_env2  s}    
rww~~j99///XXKuA6775JJL&&(E 8 	5) 87s   8B33C	c                   R pRpV\         P                  V&   RRRRVR/p\        \         P                  4      pVP                  V4       \         P                  V,          pV P	                  WE4       V P                  RWQ,          4       VP                  4       pV P                  \        \         P                  P                  V4      4       V P                  RR4       V P                  W4       R# 	
_TEST_VAR_original_value_A_r   _B_23rE  N)r   r  rp  r|  assertDictEqualrD   rv  r  NotImplemented__or__r  r5   overridden_keyr  new_vars_dictrT   actualnew_vars_itemss   &      r   test_or_operatorEnvironTests.test_or_operator=  s    %)%3

>"UCE

#&m+X.f45&,,.nbjj&7&7&GH))%4)).Ir   c                   R pR\         P                  V&   RRRRVR/p\        \         P                  4      pVP                  V4       \         ;P                  V,          un        V P	                  V\         P                  4       V P	                  R\         P                  V,          4       V P                  RR4       V P                  VR4       R# )r  r  r  r   r  r  r  Nr   r  rp  r|  rD   r  )r5   r  r  rT   s   &   r   test_ior_operatorEnvironTests.test_ior_operatorP  s    %%5

>"UCE

#&


m#
2::.bjj89))%5)).#>r   c                   \         P                  P                  4       pV P                  \        4      ;_uu_ 4        ^R/p\         ;P                  V,          un        RRR4       V P                  \        4      ;_uu_ 4        R^/p\         ;P                  V,          un        RRR4       V P                  V\         P                  4       R#   + '       g   i     Ly; i  + '       g   i     LE; i)ra  r  N)r   r  copyr   r   rD   )r5   os_environ_copydict_with_bad_keydict_with_bad_vals   &   r   test_ior_operator_invalid_dicts,EnvironTests.test_ior_operator_invalid_dicts_  s    **//+y))!"E
JJ++J * y))!&
JJ++J *
 	"**5 *) *)s   "C"C"C	"C2	c                   R pR\         P                  V&   RRVR33p\        \         P                  4      pVP                  V4       \         ;P                  V,          un        V P	                  V\         P                  4       V P	                  R\         P                  V,          4       V P                  RR4       V P                  VR4       R# )r  r  r  r   r  N)r  r   )r  r  r  )r5   r  r  rT   s   &   r   $test_ior_operator_key_value_iterable1EnvironTests.test_ior_operator_key_value_iterablel  s    %%5

>"&~s6KL

#'


n$
2::.bjj89))%5)).#>r   c                   R pRpV\         P                  V&   RRRRVR/p\        V4      pVP                  \         P                  4       V\         P                  ,          pV P	                  WE4       V P                  W%V,          4       VP                  4       pV P                  \        \         P                  P                  V4      4       V P                  RR4       V P                  W4       R# r  )r   r  rp  r|  r	  rD   rv  r  r
  __ror__r  r  s   &      r   test_ror_operatorEnvironTests.test_ror_operator{  s    %)%3

>"UCE&

#+X.)?@&,,.nbjj&8&8&HI))%4)).Ir   c                   \        \        R 4      pR\        P                  R&   \        P                  ! RR4       V P	                  \        P                  R,          R4       V'       d(   V P	                  \        P
                  R,          R4       \        P                  ! 4        V P	                  \        P                  R,          R4       V'       d(   V P	                  \        P
                  R,          R4       \        P                  ! R4       V P	                  \        P                  R,          R4       V'       d(   V P	                  \        P
                  R,          R4       \        P                  ! 4        V P                  R\        P                  4       V'       d!   V P                  R\        P
                  4       V'       Ed   R\        P
                  R&   \        P                  ! RR4       V P	                  \        P
                  R,          R4       V P	                  \        P                  R,          R	4       \        P                  ! 4        V P	                  \        P
                  R,          R
4       V P	                  \        P                  R,          R4       \        P                  ! R4       V P	                  \        P
                  R,          R
4       V P	                  \        P                  R,          R4       \        P                  ! 4        V P                  R\        P
                  4       V P                  R\        P                  4       R# R# )rs  python_valuer  	new_values   test_envs   python_values	   new_values   python_value2
new_value2python_value2s
   new_value2N)	r   r   r  r  rD   rs  reload_environr  r  )r5   has_environbs   & r   test_reload_environ EnvironTests.test_reload_environ  s'   r:. "0

:
		*k*J/@R[[5G
J/=R[[5|D 	JJ/=R[[5|D
RZZ0["++6<'7BKK$IIj,/R[[57GHRZZ
3_ER[[5}ERZZ
3\B KK
#R[[5}ERZZ
3\B["++6Z4% r   )__save__saveb),r_   r`   ra   rb   __doc__	type2testrn   rC  ru  r  r   r   r   r   rE   r  r   r   requires_subprocessr  r  r  r  r  r  rr  r  r  requires_mac_verr  r  r  r  r  r  r  r  r  r  r  r#  r,  rc   rd   re   s   @r   rn  rn  ^  s    BI$-C
 BBz(B+-W-/AB  "- # C-- BBz(B+-W-/AB  "7 # C-7-
9
G'R 22>@9@9*   "? #?& b!$@ %@$;$19:	*J&?6?J&-5 -5r   rn  c                   z  a  ] tR tRt o RtRtR tR tR tRR lt	R	 t
R
 tR tR tR t]P                   ! ]! ]R4      R4      ]P&                  ! ]P*                  R8H  R4      R 4       4       t]P                   ! ]! ]R4      R4      ]P&                  ! ]P*                  R8H  R4      R 4       4       tR tR tRtV tR# )	WalkTestsi  zTests for os.walk().Fc                f    R V9   d   VP                  R 4      VR&   \        P                  ! V3/ VB # )r  followlinks)r  r   walk)r5   topkwargss   &&,r   r8  WalkTests.walk  s2    &$*JJ/@$AF=!wws%f%%r   c                   \         P                  P                  pV P                  \        P
                  \        P                  4       V! \        P                  R 4      V n        V! V P                  R4      V n        V! V P                  R4      V n	        V! V P                  R4      pV! VR4      pV! V P                  R4      V n
        V! V P                  R4      pV! VR4      pV! VR4      pV! VR4      V n        V! \        P                  R	4      pV! \        P                  R	R
4      pV! VR4      V n        V! VR4      p	V! VR4      p
\         P                  ! V P                  4       \         P                  ! V4       \         P                  ! V4       \         P                  ! V4       V P                  WEW3 FA  p\        VRRR7      ;_uu_ 4       pVP                  RV,           R,           4       RRR4       KC  	  \        P                   ! 4       '       d   \         P"                  ! \         P                  P%                  V4      V P                  4       \         P"                  ! RV P                  R4       \         P"                  ! V! RR4      V	R4       \         P"                  ! V! RR4      V
R4       VRR.. RO3V n        MVR.R.3V n        \         P(                  ! V^ 4        \         P*                  ! V4       \         P(                  ! V\,        P.                  4       \         P0                  ! V4       \         P2                  ! V4       V P&                  ^,          R R#   + '       g   i     EK  ; i  \4         d4    T P                  \         P(                  T\,        P.                  4        R# i ; i)TEST1SUB1SUB11SUB2SUB21tmp1tmp2tmp3linkTEST2tmp4broken_linkbroken_link2broken_link3rV  r   r   zI'm z" and proud of it.  Blame test_os.
NbrokenTtmp5:Nra  N)rH  rI  rJ  rD  )r   rE   rG   r   r   r  rk   	walk_path	sub1_path
sub11_path	tmp1_path	link_pathbroken_link_pathmakedirsr    r!   can_symlinkr   rF  	sub2_treechmodlistdirr   S_IRWXUrl   r  PermissionError)r5   rG   	sub2_path
sub21_path	tmp2_path	tmp3_path	tmp5_patht2_path	tmp4_pathbroken_link2_pathbroken_link3_pathrE   rx   s   &            r   rn   WalkTests.setUp  s   ww||	(()*:*:;& i..8dnnf5t~~w70	)W-
dnnf50	F+	V,	i0y''1))7F;	 $Y > N; N; 	DOO$
I
J
GNNI)NDdC'22a(MMN 32 O   ""JJrwww/@JJx!6!6=JJtFH-/@$GJJtGV,.?F''6):'(DN ('VH=DN
Q	&JJz" HHZ.IIi HHZ q!"%/ 322"  	@OOBHHj$,,?	@s    M*-M? *M<?:N=<N=c                   \        V P                  V P                  4      4      pV P                  \	        V4      ^4       V^ ,          ^,          ^ ,          R8g  pV^ ,          ^,          P                  4        V^^V,          ,
          ,          R,          P                  4        V^^V,          ,
          ,          ^,          P                  4        V P                  V^ ,          V P                  RR.R.34       V P                  V^V,           ,          V P                  R.R.34       V P                  V^V,           ,          V P                  . . 34       V P                  V^^V,          ,
          ,          V P                  4       R# )r   r>  r@  rB  r?  rC  N)	listr8  rM  rD   r@   sortrN  rO  rU  r5   allflippeds   &  r   test_walk_topdownWalkTests.test_walk_topdown  s&   499T^^,-S1% a&)A,&(Aq	AGOR %%'AGOQ$$&Q$..662BVH!MNQ[)DNNWIx+PQQ[)DOOR+DEQW_-t~~>r   Nc                   Vf   V P                   p. pV P                  V4       F3  w  r4pVP                  W4V34       RV9   g   K"  VP                  R4       K5  	  V P	                  \        V4      ^4       V P	                  V^ ,          V P                   R.R.34       V^,          R,          P                  4        V^,          ^,          P                  4        V P	                  V^,          V P                  4       R # )Nr>  r@  rB  re  )rM  r8  appendremoverD   r@   rg  rU  )r5   rM  ri  rL  dirsr  s   &&    r   test_walk_pruneWalkTests.test_walk_prune  s    I!%9!5DJJE*+~F# "6 	S1%Q$..6(VH!EFAr
Aq	Q0r   c                N    V P                  \        V P                  4      4       R # r(   )rq  r   rM  rm   s   &r   test_file_like_pathWalkTests.test_file_like_path1  s    Xdnn56r   c                   \        V P                  V P                  R R7      4      pV P                  \	        V4      ^V4       V^,          ^,          ^ ,          R8g  pV^,          ^,          P                  4        V^^V,          ,
          ,          R,          P                  4        V^^V,          ,
          ,          ^,          P                  4        V P                  V^,          V P                  RR.R.34       V P                  W,          V P                  . . 34       V P                  W^,           ,          V P                  R.R.34       V P                  V^^V,          ,
          ,          V P                  4       R# )	Ftopdownr>  r@  rB  r?  rC  Nre  )	rf  r8  rM  rD   r@   rg  rO  rN  rU  rh  s   &  r   test_walk_bottom_upWalkTests.test_walk_bottom_up4  s1   499T^^U9;<S1c* a&)A,&(Aq	AGOR %%'AGOQ$$&Q..66*:VHE	G//2r2	4q[)..7)fX>	@QW_-	)r   c                
   \         P                  ! 4       '       g   V P                  R 4       V P                  V P                  RR7      pV F=  w  r#pW P
                  8X  g   K  V P                  V. 4       V P                  VR.4        M	  V P                  R4       V P                  V P                  RR7      pV P                  '       d   V P                  \        \        V4       V P                  \        \        V4       R# )zneed symlink supportTrW  rG  z+Didn't follow symlink with followlinks=TrueN)r   rT  r~   r8  rM  rQ  rD   rw  rR  is_fwalkr   rJ   r  r  )r5   walk_itrL  rp  r  s   &    r   test_walk_symlinkWalkTests.test_walk_symlinkI  s    $$&&MM01 ))DNND)A!(D~~%  r*  1	 ") IICD))D114)H===/w?-w7r   c                   . pV P                  V P                  VP                  R 7      p\        V4      w  r4pV P	                  V. 4       Rp\
        P                  P                  W64      p\
        P                  P                  W6R,           4      p\
        P                  ! Wx4        V U	U
Uu. uF  w  rqNK	  	  pp
p	pV P                  V4       V P                  W|4       V P                  W4       V F:  pW8w  g   K  V P                  \
        P                  P                  W=4      V4       K<  	  \
        P                  ! W4       R# u upp
p	i   \
        P                  ! Y4       i ; i)onerrorr>  z.newN)r8  rM  rn  r  rD   r   rE   rG   r   rt   r  r  )r5   errorsr}  rL  rp  r  dir1path1path1newr   drx   rootsdir2s   &             r   test_walk_bad_dirWalkTests.test_walk_bad_dir\  s
   ))DNNFMM)B ME$T(77<<Vm4
		%"		'&-.g71QgE.OOF#U*X-<MM"'',,t":EB  IIh& / IIh&s$   (E .E
;?E ?3E 
E E)c                   V P                  R 4      pV P                  '       d   V P                  \        \        V4       V P                  \
        \        V4       V P                  R RR7      pV P                  '       d   V P                  \        \        V4       V P                  \
        \        V4       V P                  V P                  4      pV P                  \
        \        V4       V P                  V P                  RR7      pV P                  '       d   V P                  \        \        V4       V P                  \
        \        V4       R# )nonexistingTrW  N)r8  r|  r   rJ   r  r  rP  NotADirectoryError)r5   r}  s   & r   test_walk_bad_dir2WalkTests.test_walk_bad_dir2q  s    ))M*===/w?-w7))M4)@===/w?-w7))DNN+-w7))DNND)A===0$@-w7r   mkfifozrequires os.mkfifo()r:   z%fifo requires special path on VxWorksc                   \         P                  R ,           p\        P                  ! V4       V P	                  \        P
                  V4       V P                  V4      pV P                  \        \        V4       V P                  VRR7      pV P                  '       d   V P                  \        \        V4       V P                  \        \        V4       R# )z-pipeTrW  N)r   rk   r   r  r   rl   r8  r   r  r  r|  r  )r5   rE   r}  s   &  r   test_walk_named_pipeWalkTests.test_walk_named_pipe  s     ')
		$		4())D/-w7))D$)7===0$@-w7r   c                   \         P                  R ,           p\        P                  ! V4       V P	                  \
        P                  V4       \        P                  ! \        P                  P                  VR4      4       . pV P                  WP                  R7      p\        V4       V P                  \        \        V4       V P                  V. 4       . pV P                  WP                  R7      p\        V4      w  rEpV P                  WA4       V P                  V. 4       V P                  VR.4       VP!                  V4       VP#                  4        V P$                  '       d   V P                  \&        \        V4       V P                  \        \        V4       V P$                  '       d   V P                  V. 4       R# V P                  \)        V4      ^V4       V P+                  V^ ,          \&        4       R# )z-dirmypiper  N)r   rk   r   rH   r   shutilr  r  rE   rG   r8  rn  r  r   r  rD   extendr{  r|  r  r@   r2   )r5   rE   r  r}  rL  rp  r  s   &      r   test_walk_named_pipe2WalkTests.test_walk_named_pipe2  sl    &(
t,
		"'',,tX./))D--)8W-w7$))D--)8 ME$r"
+E===0$@-w7===VR(S[!V4!!&)-?@r   c                R   ^p\         P                  P                  \        P                  R4      p\         P                  P                  ! V.R.V,          O5!  p\         P
                  ! V4       \        ^d4       Uu. uF  q@P                  VRR7      NK  	  pp\        V^,           4       FU  pY6'       d   R.M. . 3pV F  pV P                  \        V4      V4       K   	  \         P                  P                  V4      pKW  	  \        ^d4       Uu. uF  q@P                  VRR7      NK  	  ppTp\        V^,           4       FU  pY6V8  d   R.M. . 3pV F  pV P                  \        V4      V4       K   	  \         P                  P                  VR4      pKW  	  R# u upi u upi )   deepr  Frw  TN)r   rE   rG   r   rk   rS  r  r8  rD   r  rR   )	r5   depthbaser  jitersr  rT   r  s	   &        r   test_walk_many_open_files#WalkTests.test_walk_many_open_files  sP   ww||I,,f5GGLL.#u.
A9>sDA4/Duqy!AAC52r2H  b84 "A	 " 9>c
C
14.
Cuqy!AIC52r:H  b84 Q$A	 " E Ds   >FF$c                H   ^2p\         P                  ! \         P                  P                  ! V P                  .R.V,          O5!  4       \        V^,
          4      ;_uu_ 4        \        V P                  V P                  4      4      pRRR4       V P                  ^ ,          pX F.  w  rEpWC8X  g   K  VP                  4        VP                  4        K0  	  . pV P                  p\        V4       F8  p	\         P                  P                  VR4      pVP                  VR.. 34       K:  	  VR,          ^,          P                  4        RV P                  R.R.3V P                  . . 3.RV P                  .RV/p
V^ ,          ^,          pV P                  VR.3.pV F  pVP                  W,          4       K  	  V P!                  \#        V4      V^,           4       V P!                  \%        V4      . R	O4       V P!                  W+4       R#   + '       g   i     EL; i)
2   r  Nr>  r?  rC  r@  rB  re  )r>  r@  r  )r   rS  rE   rG   rM  r   rf  r8  rU  rg  r  rn  r{  rN  rO  r  rD   r@   sorted)r5   r  ri  rZ  rL  rp  r  	d_entriesd_path_sectionsrT   r  s   &            r   test_walk_above_recursion_limit)WalkTests.test_walk_above_recursion_limit  s   
BGGLLBC55=BC	**tyy01C + NN1%	!$D 		

 "%
 	uAWW\\&#.FfseR01  	"a  'VH5"b) T^^$
 1vay^^TF845AOOHK(  	S519-'<='G +**s   %%HH!	)rR  rQ  rO  rN  rU  rP  rM  r(   )r_   r`   ra   rb   r0  r|  r8  rn   rk  rq  rt  ry  r~  r  r  r   r   r   r   rD  r>   r?   r  r  r  r  rc   rd   re   s   @r   r5  r5    s     H&
C&J?"1&7)*8&'*8& X.0FG__S\\Y.;=8= H8 X.0FG__S\\Y.;=A= HA:%*&( &(r   r5  fwalkzTest needs os.fwalk()c                      a  ] tR tRt o RtRtR tR tR tR t	R t
R	 t]P                  ! ]P                  R
4      R 4       t]P                  ! ]P                  R
4      R 4       tRtRtV tR# )
FwalkTestsi  zTests for os.fwalk().Tc              +  T   "   V P                   ! V3/ VB  F  w  r4rVW4V3x  K  	  R # 5ir(   )r  )r5   r9  r:  rL  rp  r  root_fds   &&,    r   r8  FwalkTests.walk  s.     *.**S*CF*C&Du%% +Ds   &(c                .    \         P                  ! V/ VB # r(   )r   r  r5   r   r:  s   &*,r   r  FwalkTests.fwalk  s    xx(((r   c           	        VP                  4       pVP                  4       p\        P                  ! R^R7       F  w  r4VP                  W4R7       VP                  W4R7       / p\        P
                  ! R/ VB  F  w  rgp\        V4      \        V4      3WV&   K   	  V P                  ! R/ VB  FC  w  rgrV P                  We4       V P                  WV,          \        V4      \        V4      34       KE  	  K  	  R# )z
compare with walk() results.
repeat)rx  r7  )rx  r  NTFr,   )
r  	itertoolsproductr|  r   r8  setr  r  rD   )
r5   walk_kwargsfwalk_kwargsrx  r  rT   rL  rp  r  rootfds
   &&&       r   _compare_to_walkFwalkTests._compare_to_walk  s     "&&(#((*(1(9(9-PQ(R$GwLQH%'WW%;{%;!E"%d)SZ!8 &< .2ZZ-G,-G)Ed-  #d)SZ1HI .H )Sr   c                L    R \         P                  /pV P                  W4       R# )r9  N)r   rk   r  )r5   r:  s   & r   test_compare_to_walkFwalkTests.test_compare_to_walk  s     ))*f-r   c                "    \         P                  ! R \         P                  4      pR\        P                  /pVP                  4       pWR&   V P                  W#4       \         P                  ! V4       R#   \         P                  ! X4       i ; i).r9  r   N)r   r    r   r   rk   r  r  rs   )r5   r   r  r  s   &   r   test_dir_fdFwalkTests.test_dir_fd  sf    	bkk*B )"2"23K&++-L%'"!!+<HHRLBHHRLs   AA6 6Bc           	        \         P                  ! R^R7       F  w  r\        P                  VR3pV P                  ! VRV/  Fz  w  rErg\
        P                  ! V4       \
        P                  ! V4       V P                  \        \
        P                  ! V4      4      \        V4      \        V4      ,          4       K|  	  K  	  R# )Tr  Nr  r  )r  r  r   rk   r  r   fstatr   rD   r  rW  )r5   rx  r  r   rL  rp  r  r  s   &       r   test_yields_correct_dir_fd%FwalkTests.test_yields_correct_dir_fd  s    (1(9(9-PQ(R$G##Wd2D-1ZZ-_-_)E   RZZ%7!8#d)c%j:PQ .` )Sr   z,dup return value is unpredictable on Androidc                \   \         P                  ! ^4      p\         P                  ! V4       \        R4       F)  pV P	                  \
        P                  4       F  pK  	  K+  	  \         P                  ! ^4      pV P                  \         P                  V4       V P                  WA4       R# )ra     N)	r   r}   rs   r  r  r   rk   r   rD   )r5   minfdr  rV  newfds   &    r   test_fd_leakFwalkTests.test_fd_leak*  su     q	
sAZZ	 0 01 2  q	%(&r   c                .   R  pR F  pV! 4       pV P                  \        P                  VR7      pV P                  V! 4       V4       \	        V4       V P                  V! 4       V4       VP                  4        V P                  V! 4       V4       K  	  R# )c                  ^    \         P                  ! ^4      p \         P                  ! V 4       V # ra  )r   r}   rs   )r   s    r   getfd.FwalkTests.test_fd_finalization.<locals>.getfd?  s    BHHRLIr   rw  NFT)r  r   rk   rD   r  assertGreaterrs   )r5   r  rx  old_fdr  s   &    r   test_fd_finalizationFwalkTests.test_fd_finalization:  sx    
	 %GWFI,,g>BUWf-Huw/HHJUWf- %r   Nr,   )r_   r`   ra   rb   r0  r|  r8  r  r  r  r  r  r   rD  r   
is_androidr  r  r  rc   rd   re   s   @r   r  r    s     H&)J$.
R __J'' __J..  !%r   r  c                   *   a  ] tR tRt o RtR tRtV tR# )BytesWalkTestsiP  Tests for os.walk() with bytes.c              +  
  "   R V9   d   VP                  R 4      VR&   \        P                  ! \        P                  ! V4      3/ VB  F  w  r4p\        P                  ! V4      p\        \        \        P                  V4      4      p\        \        \        P                  V4      4      pWgV3x  \        \        \        P                  V4      4      VR&   \        \        \        P                  V4      4      VR&   K  	  R# 5i)r  r7  r   N)r  r   r8  fsencoder\   rf  map)	r5   r9  r:  brootbdirsbfilesrL  rp  r  s	   &&,      r   r8  BytesWalkTests.walkR  s     &$*JJ/@$AF=!$&GGBKK,<$G$G E&;;u%DBKK/0DR[[&12Eu%%CT23E!HSe45F1I %Hs   DDr,   N)r_   r`   ra   rb   r0  r8  rc   rd   re   s   @r   r  r  P  s     )	6 	6r   r  c                   .   a  ] tR tRt o RtRR ltRtV tR# )BytesFwalkTestsi]  r  c              /    "   \         P                  ! \         P                  ! V4      .VO5/ VB  F  w  rErg\         P                  ! V4      p\	        \        \         P                  V4      4      p	\	        \        \         P                  V4      4      p
WW3x  \	        \        \         P                  V	4      4      VR &   \	        \        \         P                  V
4      4      VR &   K  	  R# 5i)r   N)r   r  r  r\   rf  r  )r5   r9  r   r:  r  r  r  topfdrL  rp  r  s   &&*,       r   r  BytesFwalkTests.fwalk`  s     +-88BKK4D+Vt+Vv+V'E&;;u%DBKK/0DR[[&12Eu,,CT23E!HSe45F1I ,Ws   C)C+r,   N)r  )r_   r`   ra   rb   r0  r  rc   rd   re   s   @r   r  r  ]  s     )6 6r   r  c                   V  a  ] tR tRt o R tR t]P                  ! ]P                  R4      R 4       t
]P                  ! ]P                  R4      R 4       t]P                  ! ]P                  R4      R 4       tR t]P                  ! ]P                   R	8H  R
4      R 4       tR tRtV tR# )MakedirTestsij  c                N    \         P                  ! \        P                  4       R # r(   r   rH   r   rk   rm   s   &r   rn   MakedirTests.setUpk  s    
!!"r   c           
        \         P                  p\        P                  P	                  VR RR4      p\        P
                  ! V4       \        P                  P	                  VR RRR4      p\        P
                  ! V4       V P                  \        \        P
                  \        P                  4       \        P                  P	                  VR RRRR\        P                  4      p\        P
                  ! V4       \        P                  P	                  VR \        P                  RRRRR4      p\        P
                  ! V4       R# r  r  dir3dir4dir5dir6N)	r   rk   r   rE   rG   rS  r   rK   curdir)r5   r  rE   s   &  r   test_makedirMakedirTests.test_makedirn  s    ww||D&&&9
Dww||D&&&&A
D 	'2;;		:ww||D&&&&&"))T
Dww||D&"))VVV"F,
Dr   zWASI's umask is a stub.c                   \         P                  ! ^4      ;_uu_ 4        \         P                  p\        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  ! VR4       V P                  \        P                  P                  V4      4       V P                  \        P                  P                  V4      4       \        P                  R8w  do   V P                  \        P                  ! V4      P                  R,          R4       V P                  \        P                  ! V4      P                  R,          R4       RRR4       R#   + '       g   i     R# ; i)rb  r  r  im  ntr   i  N)r   
temp_umaskrk   r   rE   rG   rS  rt   r  isdirr   rD   r   ry  )r5   r  parentrE   s   &   r   	test_modeMakedirTests.test_mode}  s     !!%((##DWW\\$/F77<</DKKe$OOBGGNN401OOBGGMM$/0ww$  !6!6!>F  !8!85!@%H )(((s   EE00F	c                N   \         P                  P                  \        P                  R 4      pRp\         P
                  ! ^4      p\         P                  ! W4       V P                  \        \         P                  W4       V P                  \        \         P                  WRR7       \         P                  ! VRRR7       \         P                  ! WRR7       \         P
                  ! V4       \         P                  ! \         P                  P                  R4      RR7       R# )	r  r   Fexist_oki  T)r   r  /N)
r   rE   rG   r   rk   umaskrS  r   rK   rF  )r5   rE   r   old_masks   &   r    test_exist_ok_existing_directory-MakedirTests.test_exist_ok_existing_directory  s    
 ww||I,,f588E?
D'2;;;'2;;UK
D%$/
Dd3
 	BGGOOC(48r   c                &   \         P                  P                  \        P                  R 4      p\
        P                  pRp\         P                  ! ^4      p \
        P                  ! \         P                  ! \        P                  4      P                  4      p \         P                  ! \        P                  WR,          4       \         P                  ! \        P                  4      P                  T,          T8w  d   \        P                  ! R4      h\         P                  ! YT,          4       \         P                  ! YRR7       \         P                  ! T\
        P                  ! \         P                  ! T4      P                  4      T( ,          4       \         P                  ! YT,          RR7       \         P                  ! T4       R#   \         d    \        P                  ! R4      hi ; i  \         P                  ! T4       i ; i)r  r   zCannot set S_ISGID for dir.z No support for S_ISGID dir mode.Tr  N)r   rE   rG   r   rk   r   S_ISGIDr  S_IMODElstatry  rV  rY  r   SkipTestrS  )r5   rE   r  r   r  existing_testfn_modes   &     r   test_exist_ok_s_isgid_directory,MakedirTests.test_exist_ok_s_isgid_directory  sY   
 ww||I,,f5,,88E?	#'<<HHY--.66$8 G))+?+IJ ))*22W<G''(JKK KKWn- KKT2HHT4<<(>(>?7(JKKKWnt<HHX # G''(EFFG HHXs&   AG8 +G C5G8 "G55G8 8Hc                   \         P                  p\        P                  P	                  \         P                  R 4      p\        VRRR7      ;_uu_ 4       pVP                  R4       RRR4       V P                  \        \        P                  V4       V P                  \        \        P                  VRR7       V P                  \        \        P                  VRR7       \        P                  ! V4       R#   + '       g   i     L; i)	r  r   r   r   r  NFr  T)r   rk   r   rE   rG   r    r!   r   rK   rS  ro  )r5   r  rE   rx   s   &   r   #test_exist_ok_existing_regular_file0MakedirTests.test_exist_ok_existing_regular_file  s    ww||I,,f5$g..!GGEN /'2;;5'2;;uE'2;;tD
		$ /.s   C::D
	r  zrequires Windowsc                   \         P                  p\        P                  P	                  \        P                  P                  \         P                  R 4      4      p\        P                  ! VRR7       \        P                  ! RVR.RR7      p\        P                  ! V4       VP                  4       P                  R^4      ^,          pV P                  VR4       R	# )
rn  i  )r   z	cacls.exez/soemr    z5"D:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;FA;;;OW)"N)r   rk   r   rE   rF  rG   rH   r   check_outputr  r  rsplitrD   )r5   r  rE   outs   &   r   test_win32_mkdir_700!MakedirTests.test_win32_mkdir_700  s    wwrww||I,<,<eDE
E"%%{D$&?%P
iik  a(+C	
r   c           	     N   \         P                  P                  \        P                  R RRRRR4      p\         P                  P                  V4      '       g7   V\        P                  8w  d"   \         P                  P                  V4      pK[  \         P                  ! V4       R# r  )r   rE   rG   r   rk   r  rR   
removedirsr5   rE   s   & r   rC  MakedirTests.tearDown  si    ww||I,,fff"FF4
 ''..&&493C3C+C77??4(D
dr   r,   N)r_   r`   ra   rb   rn   r  r   rD  r   rE  r   r  r  r  r   r   r   r  rC  rc   rd   re   s   @r   r  r  j  s     # __!I	I __!9	9 __!	6 D*<=

 >

	 	r   r  chownzrequires os.chown()c                   @  a  ] tR tRt o ]R 4       tR t]P                  ! ]	! ]
R4      R4      R 4       t]P                  ! ];'       d    ]! ]4      ^8  R4      R 4       t]P                  ! ]'       * ;'       d    ]! ]4      ^8  R	4      R
 4       t]R 4       tRtV tR# )ChownFileTestsi  c                N    \         P                  ! \        P                  4       R # r(   r  clss   &r   
setUpClassChownFileTests.setUpClass      
!!"r   c                   \         P                  ! \        P                  4      pVP                  pVP
                  pRR\        P                  ! R4      \        P                  ! R^4      3 Fk  pV P                  \        \         P                  \        P                  WC4       V P                  \        \         P                  \        P                  W$4       Km  	  V P                  \         P                  ! \        P                  W#4      4       V P                  \         P                  ! \        P                  RR4      4       R# )r*  Ng      y             re  )r   r   r   rk   st_uidst_giddecimalDecimal	fractionsFractionr   r   r!  assertIsNone)r5   r   uidgidr  s   &    r   *test_chown_uid_gid_arguments_must_be_index9ChownFileTests.test_chown_uid_gid_arguments_must_be_index  s    wwy''(kkkkC!4i6H6HQ6OPEi93C3CUPi93C3CSP Q 	"((9#3#3S>?"((9#3#3R<=r   	getgroupszneed os.getgroupsc                t   \         P                  ! 4       p\        V4      ^8  d   V P                  R4       VR,          w  r#\         P                  ! \
        P                  4      P                  p\         P                  ! \
        P                  WB4       \         P                  ! \
        P                  4      P                  pV P                  WR4       \         P                  ! \
        P                  WC4       \         P                  ! \
        P                  4      P                  pV P                  WS4       R# )rb  ztest needs at least 2 groupsNrb  NN)r   r7  r@   r~   r   r   rk   r,  r!  r-  rD   )r5   groupsgid_1gid_2r3  r4  s   &     r   test_chown_gidChownFileTests.test_chown_gid  s    v;?MM89bzggi&&'..
!!3.ggi&&'..$
!!3.ggi&&'..$r   z0test needs root privilege and more than one userc                   \         R ,          w  r\        P                  ! \        P                  4      P
                  p\        P                  ! \        P                  W4       \        P                  ! \        P                  4      P                  pV P                  WA4       \        P                  ! \        P                  W#4       \        P                  ! \        P                  4      P                  pV P                  WB4       R# r9  N)		all_usersr   r   r   rk   r-  r!  r,  rD   )r5   uid_1uid_2r4  r3  s   &    r   test_chown_with_root#ChownFileTests.test_chown_with_root  s     !}ggi&&'..
!!5.ggi&&'..$
!!5.ggi&&'..$r   z2test needs non-root account and more than one userc                   \         R ,          w  r\        P                  ! \        P                  4      P
                  pV P                  \        4      ;_uu_ 4        \        P                  ! \        P                  W4       \        P                  ! \        P                  W#4       RRR4       R#   + '       g   i     R# ; ir@  )	rA  r   r   r   rk   r-  r   rY  r!  )r5   rB  rC  r4  s   &   r   test_chown_without_permission,ChownFileTests.test_chown_without_permission  sq     !}ggi&&'..//HHY%%u2HHY%%u2 0///s   AB00C	c                N    \         P                  ! \        P                  4       R # r(   )r   r  r   rk   r%  s   &r   tearDownClassChownFileTests.tearDownClass  r)  r   r,   N)r_   r`   ra   rb   classmethodr'  r5  r   r   r   r   r=  root_in_posixr@   rA  rD  rG  rJ  rc   rd   re   s   @r   r#  r#    s      # #> [13FG% H%  ==3y>A+=KM%M% ]*AAs9~/AMO3O3 # #r   r#  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	RemoveDirsTestsi  c                N    \         P                  ! \        P                  4       R # r(   )r   rS  r   rk   rm   s   &r   rn   RemoveDirsTests.setUp   s    
I$$%r   c                N    \         P                  ! \         P                  4       R # r(   )r   r  rk   rm   s   &r   rC  RemoveDirsTests.tearDown#  s    ))*r   c                V   \         P                  P                  \        P                  R 4      p\         P
                  ! V4       \         P                  P                  VR4      p\         P
                  ! V4       \         P                  ! V4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  \        P                  4      4       R# )diradirbN)	r   rE   rG   r   rk   rH   r  assertFalser  r5   rU  rV  s   &  r   test_remove_allRemoveDirsTests.test_remove_all&  s    ww||I,,f5
ww||D&)

d-.-.	(8(89:r   c                   \         P                  P                  \        P                  R 4      p\         P
                  ! V4       \         P                  P                  VR4      p\         P
                  ! V4       \        \         P                  P                  VR4      4       \         P                  ! V4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  \        P                  4      4       R# rU  rV  file.txtN)r   rE   rG   r   rk   rH   r%   r  rW  r  rt   rX  s   &  r   test_remove_partial#RemoveDirsTests.test_remove_partial0  s    ww||I,,f5
ww||D&)
BGGLLz23
d-.t,-y'7'789r   c                   \         P                  P                  \        P                  R 4      p\         P
                  ! V4       \         P                  P                  VR4      p\         P
                  ! V4       \        \         P                  P                  VR4      4       V P                  \        4      ;_uu_ 4        \         P                  ! V4       RRR4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  V4      4       V P                  \         P                  P                  \        P                  4      4       R#   + '       g   i     L; ir\  )r   rE   rG   r   rk   rH   r%   r   rK   r  rt   r  rX  s   &  r   test_remove_nothing#RemoveDirsTests.test_remove_nothing;  s    ww||I,,f5
ww||D&)
BGGLLz23w''MM$ (t,-t,-y'7'789	 ('s   E::F
	r,   N)r_   r`   ra   rb   rn   rC  rY  r^  ra  rc   rd   re   s   @r   rO  rO    s#     &+;	:
: 
:r   rO  zWASI has no /dev/nullc                   &   a  ] tR tRt o R tRtV tR# )DevNullTestsiH  c                   \        \        P                  R ^ 4      ;_uu_ 4       pVP                  R4       VP	                  4        RRR4       \        \        P                  R4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       R#   + '       g   i     L]; i  + '       g   i     R# ; i)r     helloNr   r   )r    r   devnullr!   rs   rD   r   rw   s   & r   test_devnullDevNullTests.test_devnullJ  sy    "**dA&&!GGHGGI ' "**d##qQVVXs+ $# '& $##s   "B0!B.B+	.B?	r,   N)r_   r`   ra   rb   rh  rc   rd   re   s   @r   rd  rd  H  s     , ,r   rd  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )URandomTestsiR  c                   V P                  \        \        P                  ! ^ 4      4      ^ 4       V P                  \        \        P                  ! ^4      4      ^4       V P                  \        \        P                  ! ^
4      4      ^
4       V P                  \        \        P                  ! ^d4      4      ^d4       V P                  \        \        P                  ! R4      4      R4       R# )r   r;   N)rD   r@   r   urandomrm   s   &r   test_urandom_length URandomTests.test_urandom_lengthS  s    RZZ]+Q/RZZ]+Q/RZZ^,b1RZZ_-s3RZZ-.5r   c                    \         P                  ! ^4      pV P                  V\        4       \         P                  ! ^4      pV P	                  W4       R#    N)r   rm  r2   r[   r  r5   data1data2s   &  r   test_urandom_valueURandomTests.test_urandom_valueZ  s:    

2eU+

2E)r   c                    R P                  RRV,          RR34      p\        RV4      pV^,          pV P                  \        V4      V4       V# )
zimport os, syszdata = os.urandom(%s)zsys.stdout.buffer.write(data)zsys.stdout.buffer.flush()r   )rG   r   rD   r@   )r5   countr   r  r  s   &&   r   get_urandom_subprocess#URandomTests.get_urandom_subprocess`  sV    yy#e++'	) *
 tT*QVe,r   c                l    V P                  ^4      pV P                  ^4      pV P                  W4       R# rq  )r{  r  rs  s   &  r   test_urandom_subprocess$URandomTests.test_urandom_subprocessk  s0    ++B/++B/E)r   r,   N)
r_   r`   ra   rb   rn  rv  r{  r~  rc   rd   re   s   @r   rk  rk  R  s     6*	* *r   rk  	getrandomzneed os.getrandom()c                   N   a  ] tR tRt o ]R 4       tR tR tR tR t	R t
RtV tR	# )
GetRandomTestsiq  c                     \         P                  ! ^4       R#   \         d<   pTP                  \        P                  8X  d   \
        P                  ! R4      hh Rp?ii ; i)ra  z%getrandom() syscall fails with ENOSYSN)r   r  rK   rL   r  r   r  )r&  rV   s   & r   r'  GetRandomTests.setUpClasss  sI    	LLO 	yyELL( ''(OPP	s    A 6AA c                    \         P                  ! ^4      pV P                  V\        4       V P	                  \        V4      ^4       R# rq  )r   r  r2   r[   rD   r@   )r5   r   s   & r   test_getrandom_type"GetRandomTests.test_getrandom_type  s4    ||BdE*TB'r   c                V    \         P                  ! ^ 4      pV P                  VR4       R# )r   r   N)r   r  rD   )r5   emptys   & r   test_getrandom0GetRandomTests.test_getrandom0  s    Q$r   c                2    V P                  \        R 4       R# )GRND_RANDOMN)r  r   rm   s   &r   test_getrandom_random$GetRandomTests.test_getrandom_random  s    2}-r   c                v     \         P                  ! ^\         P                  4       R#   \         d     R# i ; ira  N)r   r  GRND_NONBLOCKr   rm   s   &r   test_getrandom_nonblock&GetRandomTests.test_getrandom_nonblock  s-    	LLB,,- 		s   %) 88c                    \         P                  ! ^4      p\         P                  ! ^4      pV P                  W4       R# rq  )r   r  r  rs  s   &  r   test_getrandom_value#GetRandomTests.test_getrandom_value  s,    R R E)r   r,   N)r_   r`   ra   rb   rL  r'  r  r  r  r  r  rc   rd   re   s   @r   r  r  q  s5     	 	(
%.* *r   r  HAVE_GETENTROPYHAVE_GETRANDOMHAVE_GETRANDOM_SYSCALLz*os.random() does not use a file descriptorr:   z$VxWorks can't set RLIMIT_NOFILE to 1c                   ^   a  ] tR tRt o ]P
                  ! ]R4      R 4       tR tR t	Rt
V tR# )URandomFDTestsi  z!test requires the resource modulec                "    R p\        RV4       R# )a  if 1:
            import errno
            import os
            import resource

            soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
            resource.setrlimit(resource.RLIMIT_NOFILE, (1, hard_limit))
            try:
                os.urandom(16)
            except OSError as e:
                assert e.errno == errno.EMFILE, e.errno
            else:
                raise AssertionError("OSError not raised")
            r   Nr   r   s   & r   test_urandom_failure#URandomFDTests.test_urandom_failure  s     	t$r   c                (    R p\        RV4      w  r#pR# )a  if 1:
            import os
            import sys
            import test.support
            os.urandom(4)
            with test.support.SuppressCrashReport():
                os.closerange(3, 256)
            sys.stdout.buffer.write(os.urandom(4))
            -ScNr   )r5   r   rcr  errs   &    r   test_urandom_fd_closed%URandomFDTests.test_urandom_fd_closed  s     (t4r   c                   V P                  \        P                  \        P                  4       \	        \        P                  R4       RP                  \        P                  R7      p\        RV4      w  r#pV P                  \        V4      ^4       V P                  VR,          VR,          4       \        RV4      w  r%pV P                  \        V4      ^4       V P                  WS4       R# )   xa  if 1:
            import os
            import sys
            import test.support
            os.urandom(4)
            with test.support.SuppressCrashReport():
                for fd in range(3, 256):
                    try:
                        os.close(fd)
                    except OSError:
                        pass
                    else:
                        # Found the urandom fd (XXX hopefully)
                        break
                os.closerange(3, 256)
            with open({TESTFN!r}, 'rb') as f:
                new_fd = f.fileno()
                # Issue #26935: posix allows new_fd and fd to be equal but
                # some libc implementations have dup2 return an error in this
                # case.
                if new_fd != fd:
                    os.dup2(new_fd, fd)
                sys.stdout.buffer.write(os.urandom(4))
                sys.stdout.buffer.write(os.urandom(4))
            )rk   r  :r   r   N:r   rf  NNs   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
r   r   rl   rk   r%   formatr   rD   r@   r  )r5   r   r  r  r  out2err2s   &      r   test_urandom_fd_reopened'URandomFDTests.test_urandom_fd_reopened  s     		(()*:*:;I$$j10 i../1 	2 (t4S1%CHc#h/)%6$TA&D&r   r,   N)r_   r`   ra   rb   r   r   resourcer  r  r  rc   rd   re   s   @r   r  r    s7     
 #FG% H%,5$' $'r   r  c              #  n  a"   . oV3R lpV3R lp \         P                  p\         P                  p\         P                  pV\         n        V\         n        V e   V \         n        Sx  V\         n        V\         n        V\         n        R#   X\         n        X\         n        X\         n        i ; i5i)z
Stubs out execv and execve functions when used as context manager.
Records exec calls. The mock execv and execve functions always raise an
exception as they would normally never return.
c                 @   < SP                  R W34       \        R4      h)execvzexecv called)rn  RuntimeErrorr   r   callss   &*r   
mock_execv#_execvpe_mockup.<locals>.mock_execv  s    gt*+>**r   c                 ^   < SP                  R W34       \        \        P                  R4      h)execvezexecve called)rn  rK   rL   ENOTDIRr  s   &*r   mock_execve$_execvpe_mockup.<locals>.mock_execve	  s%    h+,emm_55r   N)r   r  r  r  )r  r  r  
orig_execvorig_execveorig_defpathr  s   &     @r   _execvpe_mockupr    s      E+6"XX
iizz	 BJ	!
 	!
s   B5AB ,#B5#B22B5r  zneed os.execv()c                      a  ] tR tRt o ]P
                  ! ]R4      R 4       tR tR t	]P                  ! ]! ]R4      R4      R 4       tR	 tR
 t]P                  ! ]P"                  R8H  R4      R 4       tRtV tR# )	ExecTestsi	  z4avoid triggering a linuxthreads bug: see issue #4970c                V    V P                  \        \        P                  R R .R4       R# )zno such app-N)r   rK   r   execvperm   s   &r   test_execvpe_with_bad_program'ExecTests.test_execvpe_with_bad_program	  s$     	'2::~)*D	2r   c                8   V P                  \        \        P                  R R4       V P                  \        \        P                  R . 4       V P                  \        \        P                  R R4       V P                  \        \        P                  R R.4       R# )notepadrE  Nr,   r  )r   r  r   r  rm   s   &r   test_execv_with_bad_arglist%ExecTests.test_execv_with_bad_arglist	  sd    *bhh	2>*bhh	2>*bhh	5A*bhh	B4@r   c                    V P                  \        \        P                  R . R4       V P                  \        \        P                  R . / 4       V P                  \        \        P                  R R./ 4       R# )r  NrE  )r   r  r   r  rm   s   &r   test_execvpe_with_bad_arglist'ExecTests.test_execvpe_with_bad_arglist$	  sR    *bjj)RF*bjj)RD*bjj)bT2Fr   _execvpez)No internal os._execvpe function to test.c           
        \         P                  R ,           pV\        J d>   Rp\         P                  P	                  \         P
                  ! V4      V4      pTp. ROpMSRp. ROp\         P                  P	                  W#4      p\         P                  R8w  d   \         P
                  ! V4      pMTpRR/p\        4       ;_uu_ 4       pV P                  \        \         P                  WF4       V P                  \        V4      ^4       V P                  V^ ,          RWF334       RRR4       \        VR7      ;_uu_ 4       pV P                  \        \         P                  W6VR	7       V P                  \        V4      ^4       V P                  V^ ,          R
WVV334       RRR4       \        4       ;_uu_ 4       pVP                  4       p	V\        J d   W)R&   MW)R&   V P                  \        \         P                  W6V	R	7       V P                  \        V4      ^4       V P                  V^ ,          R
WVV	334       RRR4       R#   + '       g   i     EL,; i  + '       g   i     L; i  + '       g   i     R# ; i)absolutepaths
   executabler   r  spamr   r  N)r  r  r  r  r  )s   prognamearg1arg2)prognamer  r  )r   rF   r[   rE   rG   r  r   r  r   r  r  rD   r@   rK   r  r  )
r5   	test_typeprogram_pathprogramfullpathnative_fullpath	argumentsr  r  env_paths
   &&        r   _test_internal_execvpe ExecTests._test_internal_execvpe)	  s    vv.#Gww||BKK$=wGH&O5I"G4Iww||L:Hww$"$++h"7"*w %lX2SZ+U1X<'HI	  \22egWS  :SZ+$$U1X?,<=?	 3 %xxzHE!$0!#/ gWX  ?SZ+$$U1X?,ABD #  32 s'   AIA I;BI/I	I,	/J 	c                    V P                  \        4       \        P                  R 8w  d   V P                  \        4       R# R# )r  N)r  r3   r   r   r[   rm   s   &r   test_internal_execvpe_str#ExecTests.test_internal_execvpe_strZ	  s.    ##C(77d?''. r   c                
   \         P                  R R.p\        P                  P	                  4       pRVR&   V P                  \        4      ;_uu_ 4        \        P                  ! V^ ,          W4       RRR4       \        P                  P	                  4       pRVR&   V P                  \        4      ;_uu_ 4        \        P                  ! V^ ,          W4       RRR4       \        P                  P	                  4       pRVR&   V P                  \        4      ;_uu_ 4        \        P                  ! V^ ,          W4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)	r   passcabbageFRUIT VEGETABLENorange VEGETABLE=cabbageFRUITlemonFRUIT=ORANGE)r>   r   r   r  r  r   r  r  )r5   r   newenvs   &  r   test_execve_invalid_env!ExecTests.test_execve_invalid_env_	  s    f- "%.!"z**IId1gt, + "5wz**IId1gt, + "!(~z**IId1gt, +* +* +* +**s$   E;E"E1E	E.	1F	r   zWin32-specific testc                     \         P                  ! R R./ 4       V P                  R4       R#   \         d@   pT P	                  TP
                  RJ ;'       g    TP
                  ^ 8g  4        Rp?R# Rp?ii ; i)rE  argzNo OSError raisedN)r   r  rw  rK   rt   winerrorr  s   & r   test_execve_with_empty_path%ExecTests.test_execve_with_empty_patht	  sd    	+IIb5'2& II)*  	COOAJJ$.AA!**/BB	Cs   . A84A33A8r,   N)r_   r`   ra   rb   r   rD  USING_LINUXTHREADSr  r  r  r   r   r   r  r  r  r>   r?   r  rc   rd   re   s   @r   r  r  	  s      __'KM2M2AG
 Z0DF-DF-D^/
-* 02GH+ I+r   r  r   r  c                   J   a  ] tR tRt o R tR tR tR tR tR t	R t
R	tV tR
# )Win32ErrorTestsi	  c                >    \         P                  ! \        P                  4       V P	                  R \        P                  ,          4       R#   \
         d    Rp R# \         d5   pRpT P	                  R\        P                  : RT: 24        Rp?R# Rp?ii ; i)zfile %s must not existFTzfile z% must not exist; os.stat failed with N)r   r   r   rk   rw  rJ   rK   )r5   r  rV   s   &  r   rn   Win32ErrorTests.setUp	  sy    		CGGI$$% II.1A1AAB ! 	F 	1FII"))30 1 1	1s#   $A BB'B()BBc                    V P                  \        \        P                  \        P
                  \        P
                  R ,           4       R# )z.bakN)r   rK   r   r   r   rk   rm   s   &r   r   Win32ErrorTests.test_rename	  s,    '299i.>.>	@P@PQW@WXr   c                l    V P                  \        \        P                  \        P
                  4       R # r(   )r   rK   r   ro  r   rk   rm   s   &r   test_removeWin32ErrorTests.test_remove	  s    '299i.>.>?r   c                l    V P                  \        \        P                  \        P
                  4       R # r(   )r   rK   r   rI   r   rk   rm   s   &r   
test_chdirWin32ErrorTests.test_chdir	  s    '288Y-=-=>r   c                F   V P                  \        P                  \        P                  4       \	        \        P                  R 4      ;_uu_ 4       pV P                  \        \        P                  \        P                  4       RRR4       R#   + '       g   i     R# ; i)rV  N)	r   r   rl   rk   r    r   rK   r   rH   rw   s   & r   
test_mkdirWin32ErrorTests.test_mkdir	  s\    	(()*:*:;)""C((Agrxx1A1AB )(((s   4BB 	c                n    V P                  \        \        P                  \        P
                  R 4       R # r(   )r   rK   r   r  r   rk   rm   s   &r   r  Win32ErrorTests.test_utime	  s     '288Y-=-=tDr   c                n    V P                  \        \        P                  \        P
                  ^ 4       R# r   )r   rK   r   rV  r   rk   rm   s   &r   
test_chmodWin32ErrorTests.test_chmod	  s     '288Y-=-=qAr   r,   N)r_   r`   ra   rb   rn   r   r  r  r  r  r  rc   rd   re   s   @r   r  r  	  s4     
CY@?CEB Br   r  z!Cannot create invalid FD on WASI.c                     a  ] tR tRt o . R=OtR0t]P                  ! 4       '       g   ]RR.,          t]RR0,          tR t] F  t	]! ]	4      ]
! 4       R]	,           &   K  	  R tR tR	 t]P                  ! ]! ]R
4      R4      R 4       t]P                  ! ]! ]R4      R4      R 4       t]P                  ! ]! ]R4      R4      R 4       t]P                  ! ]! ]R4      R4      R 4       t]P                  ! ]! ]R4      R4      R 4       t]P                  ! ]! ]R4      R4      R 4       t]P                  ! ]! ]R4      R4      R 4       t]P                  ! ]! ]R4      R4      ]P2                  ! ]P4                  ! 4       R4      R 4       4       t]P                  ! ]! ]R4      R 4      R! 4       t]P                  ! ]! ]R"4      R#4      R$ 4       t]P                  ! ]! ]R%4      R&4      R' 4       t]P                  ! ]! ]R(4      R)4      R* 4       t]P                  ! ]! ]R+4      R,4      R- 4       t ]P                  ! ]! ]R.4      R/4      R0 4       t!]P                  ! ]! ]R14      R24      R3 4       t"]P                  ! ]! ]R44      R54      R6 4       t#]PH                  ! 4       R7 4       t%]P                  ! ]! ]R84      R94      R: 4       t&R;t'V t(R<# )>TestInvalidFDi	  fchdir	fdatasyncfsyncc                   a  V 3R  lpV# )c                    < \        \        S4      '       dT   V P                  \        \        S4      4       SV P                  9   d"   V P                  \        \        S4      4       R # R # R # r(   )r   r   r  rq  singles_fildes
check_boolrw   s   &r   helper(TestInvalidFD.get_single.<locals>.helper	  sJ    A

72q>*+++OOGBN3 , r   r,   )rx   r  s   f r   
get_singleTestInvalidFD.get_single	  s    	4
 r   test_c                     V! \         P                  ! 4       .VO5/ VB  V P                  R V,          4       R#   \         d6   pT P	                  TP
                  \
        P                  4        Rp?R# Rp?ii ; i)z5%r didn't raise an OSError with a bad file descriptorN)r   make_bad_fdrw  rK   rD   rL   r  )r5   rx   r   r:  r  s   &&*, r   r  TestInvalidFD.check	  sh    	i##%777 IIM   	3QWWekk22	3s   ; A;*A66A;c           
     N   \         P                  ! 4       ;_uu_ 4        \         P                  ! R \        4       R F5  pV P	                  \        4      ;_uu_ 4        V! V.VO5/ VB  RRR4       K7  	  RRR4       R#   + '       g   i     KT  ; i  + '       g   i     R# ; i)errorNr  )r  r  simplefilterRuntimeWarningr   )r5   rx   r   r:  r   s   &&*, r   r  TestInvalidFD.check_bool	  sv    $$&&!!'>:!&&~66b*4*6* 76 " '& 766 '&&s#   >BA?)B?B
	BB$	c                    V P                  \        P                  R R7       V P                  \        P                  R R7       R# )r   r   N)r  r   r   r  rm   s   &r   r   TestInvalidFD.test_fdopen	  s*    

299w
/		G4r   isattyztest needs os.isatty()c                x    V P                  \        P                  ! \        P                  ! 4       4      R 4       R# FN)rD   r   r  r   r  rm   s   &r   test_isattyTestInvalidFD.test_isatty	  s$    9#8#8#:;UCr   r   ztest needs os.closerange()c                R   \         P                  ! 4       p\        ^
4       F  p\        P                  ! W,           4        M	  X^8  d   \        P                  ! R4      hV P                  \        P                  ! WV,           ^,
          4      R4       R#   \
         d     K  i ; i)r_  z5Unable to acquire a range of invalid file descriptorsN)
r   r  r  r   r  rK   r   r  rD   r   )r5   r   r  s   &  r   r   TestInvalidFD.test_closerange	  s    ""$ rA"$   q5##GI Ir6!84d;  s   BB&%B&dup2ztest needs os.dup2()c                F    V P                  \        P                  ^4       R# )   N)r  r   r#  rm   s   &r   	test_dup2TestInvalidFD.test_dup2	  s    

277Br   c           
     h   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       VRR.p\        P                  ! V^R7       F  w  r4W48w  g   K  V P                  W4R7      ;_uu_ 4        V P                  \        4      ;_uu_ 4       p\         P                  ! W44       RRR4       V P                  XP                  P                  \        P                  4       RRR4       K  	  R#   + '       g   i     LR; i  + '       g   i     K  ; i)ra  r  )r   fd2Nre  i   )r   r    r   r   r   rs   r  r  r   r   rK   r#  rD   r  rL   r  )r5   valid_fdfdsr   r)  r  s   &     r   test_dup2_negative_fd#TestInvalidFD.test_dup2_negative_fd	  s    778R[[1(+

 !((Q7GBy\\R\11**733s( 4$$S]]%8%8%++F 21 8 43 211s$   D ,D<D DD  D1fchmodztest needs os.fchmod()c                F    V P                  \        P                  ^ 4       R# r   )r  r   r.  rm   s   &r   test_fchmodTestInvalidFD.test_fchmod	  s    

299a r   fchownztest needs os.fchown()c                H    V P                  \        P                  RR4       R# )ra  Nre  )r  r   r2  rm   s   &r   test_fchownTestInvalidFD.test_fchown	  s    

299b"%r   	fpathconfztest needs os.fpathconf()c                    V P                  R \        P                  4       V P                  \        P                  R 4       V P                  \        P
                  R 4       R# PC_NAME_MAXN)r  r   pathconf_namesr  pathconfr6  rm   s   &r   test_fpathconfTestInvalidFD.test_fpathconf	  s:    mR%6%67]3m4r   z@musl pathconf ignores the file descriptor and returns a constantc                    V P                  \        P                  R 4       V P                  \        P                  R 4       R# r8  )r  r   r;  r6  rm   s   &r   test_fpathconf_bad_fd#TestInvalidFD.test_fpathconf_bad_fd
  s(     	

2;;.

2<</r   	ftruncateztest needs os.ftruncate()c                    V P                  \        P                  ^ 4       V P                  \        P                  ^ 4       V P	                  \        P                  ^ 4       R# r   )r  r   truncaterA  r  rm   s   &r   test_ftruncateTestInvalidFD.test_ftruncate
  s8    

2;;"

2<<#Q'r   r   ztest needs os.lseek()c                H    V P                  \        P                  ^ ^ 4       R# r   )r  r   r   rm   s   &r   
test_lseekTestInvalidFD.test_lseek
  s    

288Q"r   r   ztest needs os.read()c                F    V P                  \        P                  ^4       R# r  )r  r   r   rm   s   &r   r   TestInvalidFD.test_read
  s    

277Ar   r   ztest needs os.readinto()c                X    V P                  \        P                  \        ^4      4       R# )rc  N)r  r   r   r   rm   s   &r   r   TestInvalidFD.test_readinto
  s    

2;;	!-r   readvztest needs os.readv()c                ^    \        ^
4      pV P                  \        P                  V.4       R# )r_  N)r   r  r   rM  )r5   rM  s   & r   
test_readvTestInvalidFD.test_readv
  s    m

288cU#r   	tcsetpgrpztest needs os.tcsetpgrp()c                F    V P                  \        P                  ^ 4       R# r   )r  r   rQ  rm   s   &r   test_tcsetpgrptTestInvalidFD.test_tcsetpgrpt"
  s    

2<<#r   r!   ztest needs os.write()c                F    V P                  \        P                  R 4       R# )    N)r  r   r!   rm   s   &r   r   TestInvalidFD.test_write&
  s    

288T"r   writevztest needs os.writev()c                H    V P                  \        P                  R .4       R# )r  N)r  r   rX  rm   s   &r   test_writevTestInvalidFD.test_writev*
  s    

299vh'r   c                    V P                  \        P                  4       V P                  \        P                  R 4       R# TN)r  r   get_inheritableset_inheritablerm   s   &r   test_inheritableTestInvalidFD.test_inheritable.
  s(    

2%%&

2%%t,r   r   r   c                    V P                  \        P                  4       V P                  \        P                  R 4       R# r]  )r  r   r   r   rm   s   &r   test_blockingTestInvalidFD.test_blocking3
  s&     	

2??#

2??D)r   r,   N)r  r}   r  fstatvfs	tcgetpgrpttyname))r_   r`   ra   rb   singlesr  r   !in_systemd_nspawn_sync_suppressedr  rx   localsr  r  r   r   r   r   r   r  r   r&  r,  r0  r4  r<  rD  linked_to_muslr?  rD  rG  r   r   rO  rS  r   rZ  r2  r`  rc  rc   rd   re   s   @r   r  r  	  s    LGZN 4466K));00 (m +5 X.0HID JD \24PQ< R< V,.DE  F  V,.DEG FG X.0HI! J! X.0HI& J& [13NO5 P5
 [13NO__ J
0	
 P
0 [13NO( P(
 W-/FG# H# V,.DE F Z02LM. N. W-/FG$ H$ [13NO$ P$ W-/FG# H# X.0HI( J(   "- #- ^4HJ*J*r   r  rE  zrequires os.linkc                   D   a  ] tR tRt o R tR tR tR tR tR t	Rt
V tR	# )
	LinkTestsi:
  c                    \         P                  V n        \        P                  P                  \         P                  R ,           4      V n        R# )r  N)r   rk   file1r   rE   rG   file2rm   s   &r   rn   LinkTests.setUp<
  s.    %%
WW\\)"2"2S"89
r   c                    V P                   V P                  3 F@  p\        P                  P	                  V4      '       g   K*  \        P
                  ! V4       KB  	  R # r(   )ro  rp  r   rE   r  rl   )r5   files   & r   rC  LinkTests.tearDown@
  s7    ZZ,Dww~~d##		$ -r   c                   \        V4        \        P                  ! W4       \        VR4      ;_uu_ 4       p\        VR4      ;_uu_ 4       pV P                  \        P                  P                  VP                  4       VP                  4       4      4       RRR4       RRR4       R#   \         d#   pT P	                  R T,          4        Rp?LRp?ii ; i  + '       g   i     LJ; i  + '       g   i     R# ; i)os.link(): %sNr   )
r%   r   rE  rY  r~   r    rt   rE   sameopenfiler   )r5   ro  rp  r  r  f2s   &&&   r   
_test_linkLinkTests._test_linkE
  s    E	/GGE! %"d5$&7&72OOBGG00biikJK '8  	/MM/A-..	/&7&7s;   B* C-AC	C-*C5CCC*%C--C>	c                R    V P                  V P                  V P                  4       R # r(   )ry  ro  rp  rm   s   &r   	test_linkLinkTests.test_linkO
  s    

DJJ/r   c                    V P                  \        V P                  \        P                  ! 4       4      \        V P
                  \        P                  ! 4       4      4       R # r(   )ry  r[   ro  r>   r  rp  rm   s   &r   test_link_bytesLinkTests.test_link_bytesR
  s<    djj#*C*C*EFdjj#*C*C*EF	Hr   c                ,    \         P                  ! R 4       T ;P
                  R ,          un        T P
                  R,           T n        T P                  T P
                  T P                  4       R#   \         d    \        P                  ! R4      hi ; i)   ñz#Unable to encode for this platform.r  N)r   r  UnicodeErrorr   r  ro  rp  ry  rm   s   &r   test_unicode_nameLinkTests.test_unicode_nameV
  so    	KKK 	

f
ZZ#%


DJJ/  	K##$IJJ	Ks   A1 1"B)ro  rp  N)r_   r`   ra   rb   rn   rC  ry  r|  r  r  rc   rd   re   s   @r   rm  rm  :
  s*     : 
L0H0 0r   rm  zPosix specific testsc                     a  ] tR tRt o RtRt]P                  ! ]! ]	R4      R4      R 4       t
]P                  ! ]! ]	R4      R4      R 4       t]P                  ! ]! ]	R4      R	4      R
 4       t]P                  ! ]! ]	R4      R4      R 4       t]P                  ! ]! ]	R4      R4      R 4       t]P                  ! ]! ]	R4      R4      ]P                   ! 4       R 4       4       t]P                  ! ]! ]	R4      R4      ]P                   ! 4       R 4       4       t]P                  ! ]! ]	R4      R4      ]P                   ! 4       R 4       4       tRtV tR# )PosixUidGidTestsi`
  setuidztest needs os.setuid()c                ,   \         P                  ! 4       ^ 8w  d&   V P                  \        \         P                  ^ 4       V P                  \
        \         P                  R4       V P                  \        \         P                  V P                  4       R# r   z
not an intN)r   getuidr   rK   r  r   OverflowErrorUID_OVERFLOWrm   s   &r   test_setuidPosixUidGidTests.test_setuidf
  sX    99;!gryy!4)RYY=-D4E4EFr   setgidztest needs os.setgid()c                D   \         P                  ! 4       ^ 8w  d2   \        '       g&   V P                  \        \         P
                  ^ 4       V P                  \        \         P
                  R4       V P                  \        \         P
                  V P                  4       R# r  )	r   r  HAVE_WHEEL_GROUPr   rK   r  r   r  GID_OVERFLOWrm   s   &r   test_setgidPosixUidGidTests.test_setgidm
  s^    99;!$4$4gryy!4)RYY=-D4E4EFr   seteuidztest needs os.seteuid()c                ,   \         P                  ! 4       ^ 8w  d&   V P                  \        \         P                  ^ 4       V P                  \
        \         P                  R4       V P                  \        \         P                  V P                  4       R# r  )	r   r  r   rK   r  r   setegidr  r  rm   s   &r   test_seteuidPosixUidGidTests.test_seteuidt
  sX    99;!grzz15)RZZ>-T5F5FGr   r  ztest needs os.setegid()c                D   \         P                  ! 4       ^ 8w  d2   \        '       g&   V P                  \        \         P
                  ^ 4       V P                  \        \         P
                  R4       V P                  \        \         P
                  V P                  4       R# r  )	r   r  r  r   rK   r  r   r  r  rm   s   &r   test_setegidPosixUidGidTests.test_setegid{
  s^    99;!$4$4grzz15)RZZ>-T5F5FGr   setreuidztest needs os.setreuid()c                   \         P                  ! 4       ^ 8w  d'   V P                  \        \         P                  ^ ^ 4       V P                  \
        \         P                  R^ 4       V P                  \
        \         P                  ^ R4       V P                  \        \         P                  V P                  ^ 4       V P                  \        \         P                  ^ V P                  4       R# r  )r   r  r   rK   r  r   r  r  rm   s   &r   test_setreuidPosixUidGidTests.test_setreuid
  s    99;!gr{{Aq9)R[[,B)R[[!\B-d6G6GK-a9J9JKr   c                T    \         P                  ! \        P                  R R.4       R# )r   z,import os,sys;os.setreuid(-1,-1);sys.exit(0)Nr   r  r>   r   rm   s   &r   test_setreuid_neg1#PosixUidGidTests.test_setreuid_neg1
  %    
 	>@ 	Ar   setregidztest needs os.setregid()c                   \         P                  ! 4       ^ 8w  d3   \        '       g'   V P                  \        \         P
                  ^ ^ 4       V P                  \        \         P
                  R^ 4       V P                  \        \         P
                  ^ R4       V P                  \        \         P
                  V P                  ^ 4       V P                  \        \         P
                  ^ V P                  4       R# r  )	r   r  r  r   rK   r  r   r  r  rm   s   &r   test_setregidPosixUidGidTests.test_setregid
  s     99;!$4$4gr{{Aq9)R[[,B)R[[!\B-d6G6GK-a9J9JKr   c                T    \         P                  ! \        P                  R R.4       R# )r   z,import os,sys;os.setregid(-1,-1);sys.exit(0)Nr  rm   s   &r   test_setregid_neg1#PosixUidGidTests.test_setregid_neg1
  r  r   r,   N        )r_   r`   ra   rb   r  r  r   r   r   r   r  r  r  r  r  r   r2  r  r  r  rc   rd   re   s   @r   r  r  `
  s     LLX.0HIG JG X.0HIG JG Y/1JKH LH Y/1JKH LH Z02LML NL Z02LM  "A # NA Z02LM  "L # NL Z02LM  "A # NAr   r  c                   ~   a  ] tR tRt o R tR tR tR t]P                  ! ]
! ]R4      R4      R 4       tR	 tR
tV tR# )Pep383Testsi
  c                  a \         P                  '       d   \         P                  V n        MA\         P                  '       d   \         P                  V n        M\         P                  V n        \
        P                  ! V P                  4      V n        . oV3R  lpV! \         P                  4       \         P                  '       d   V! \         P                  4       \         P                  '       d   V! \         P                  4       S'       g   V P                  R4       \        4       V n        \
        P                  ! V P                  4        S F  p\         P                  ! \
        P                  P                  V P                  V4      4       \
        P                   ! V4      pW P                  9   d   \#        R4      hV P                  P%                  V4       K  	  R#    \&        P(                  ! T P                  4       h ; i)c                 |   <  \         P                  ! V 4      p SP                  T 4       R #   \         d     R # i ; ir(   )r   r  r  rn  )fnbytesfns   &r   add_filename'Pep383Tests.setUp.<locals>.add_filename
  s7    [[_ NN2 & s   , ;;z&couldn't create any non-ascii filenamezduplicate filenameN)r   TESTFN_UNENCODABLErn  TESTFN_NONASCIIrk   r   r  bdirTESTFN_UNICODEr~   r  	unicodefnrH   create_empty_filerE   rG   r\   r  addr  r  )r5   r  r  r  s   &  @r   rn   Pep383Tests.setUp
  sL   ''' 33DH&&& 00DH ''DHKK)		 	Y--.'''556$$$223MMBC
		++BGGLLB,GH[[_'$%9::""2& 	MM$((#s   BG( (#Hc                F    \         P                  ! V P                  4       R # r(   )r  r  rn  rm   s   &r   rC  Pep383Tests.tearDown
  s    dhhr   c                   V P                   p\        \        P                  ! V P                  4      4      pV P                  W!4       \        P                  ! 4       p \        P                  ! V P                  4       V P                  \        \        P                  ! 4       4      V4       \        P                  ! V4       R #   \        P                  ! T4       i ; ir(   )r  r  r   rW  rn  rD   r1   rI   )r5   rT   foundcurrent_directorys   &   r   test_listdirPep383Tests.test_listdir
  s    >>BJJtxx())IIK	( HHTXXS.9HH&'BHH&'s   AC Cc                    V P                    FG  p\        \        P                  P	                  V P
                  V4      R 4      pVP                  4        KI  	  R# r   N)r  r    r   rE   rG   rn  rs   )r5   r  rx   s   &  r   	test_openPep383Tests.test_open
  s8    ..BRWW\\$((B/6AGGI !r   r  r  c                    V P                    FC  p\        P                  P                  V P                  V4      p\        P
                  ! V4       KE  	  R # r(   )r  r   rE   rG   rn  r  )r5   r  fullnames   &  r   test_statvfsPep383Tests.test_statvfs
  s6     ..Bww||DHHb1HJJx  !r   c                    V P                    FA  p\        P                  ! \        P                  P	                  V P
                  V4      4       KC  	  R # r(   )r  r   r   rE   rG   rn  )r5   r  s   & r   	test_statPep383Tests.test_stat
  s/    ..BGGBGGLL2./ !r   )r  rn  r  N)r_   r`   ra   rb   rn   rC  r  r  r   r   r   r   r  r  rc   rd   re   s   @r   r  r  
  sO     #J (
 Y//1!1!0 0r   r  c                      a  ] tR tRt o R tR tR t]P                  ! ]	RJ R4      R 4       t
]P                  ! R4      ]P                  ! 4       R	 4       4       t]P                  ! 4       R
 4       tRtV tR# )Win32KillTestsi
  c                   ^ RI p^ RI Hp ^ RIpVP                  P                  P
                  pVP                  Vn        VP                  VP                  VP                  4      VP                  VP                  VP                  4      VP                  VP                  4      VP                  VP                  4      3Vn        Rp\        P                  ! \        P                   RRP#                  V4      .\        P$                  \        P$                  \        P$                  R7      pV P'                  VP(                  P*                  4       V P'                  VP,                  P*                  4       V P'                  VP.                  P*                  4       ^ ^drW8  d   VP1                  4       f   VP3                  \5        V4      4      p
V! VP7                  VP(                  P9                  4       4      WP;                  V
4      RRR4      pV P=                  V^ R4       V
P>                  '       d+   V PA                  WjP>                  PC                  4       4       M2\D        PF                  ! R4       V^,          pK  V PI                  R	4       \J        PL                  ! VPN                  V4       V PA                  VPQ                  4       V4       R# )
r   Nwintypesrunningr   z<import sys;sys.stdout.write('{}');sys.stdout.flush();input())r  stderrstdinzPeekNamedPipe failed皙?z1Did not receive communication from the subprocess))rG  r  msvcrtrH  rI  PeekNamedPipeBOOLrestypeHANDLEPOINTERc_charDWORDargtypesr   Popenr>   r   r  r  r   r  rs   r  r  pollcreate_string_bufferr@   get_osfhandler   sizeofr  r  rD   r  r,  sleeprw  r   killpidwait)r5   sigrG  r  r  r  r+  r  rz  maxrM  rslts   &&          r   _killWin32KillTests._kill
  s   
 	# ..<< ("*//"(.."?"*.."(.."@"(.."@"(.."@"B "+ ,26#;	!8
 (2'1&0oo7 	))*))*

(()skdiik1--c#h7C !!5!5dkk6H6H6J!K!$mmC&8$dLDa)?@yyy  ii&6&6&89JJsOQJEIIIJ
#c*r   c                D    V P                  \        P                  4       R # r(   )r  signalSIGTERMrm   s   &r   test_kill_sigterm Win32KillTests.test_kill_sigterm)  s    

6>>"r   c                (    V P                  ^d4       R# )d   N)r  rm   s   &r   test_kill_intWin32KillTests.test_kill_int-  s    

3r   Nzrequires mmapc                   R \         P                  ! 4       ,          p\        P                  ! R^V4      p^ V^ &   \        P                  P                  \        P                  P                  \        4      R4      p\        P                  WS.p\        P                  ! V\        P                  R7      pT;_uu_ 4        \        P                  ! \        P                  4       F  pVP!                  4       e   K   M#	  VP#                  4        V P%                  R4       \        P"                  ! VP&                  V4        VP)                  \        P                  R7       RRR4       R#   \        P*                   d4    TP#                  4        T P%                  RP-                  T4      4        LQi ; i  + '       g   i     R# ; i)z
test_os_%szwin_console_handler.pyr  Nz'Subprocess didn't finish initialization)timeoutzsubprocess did not stop on {}re  )uuiduuid1mmapr   rE   rG   rR   r   r>   r   r   r  CREATE_NEW_PROCESS_GROUPr   sleeping_retrySHORT_TIMEOUTr  r  rw  r  r  TimeoutExpiredr  )	r5   eventr   tagnamemscriptcmdr  r  s	   &&&      r   _kill_with_eventWin32KillTests._kill_with_event1  s@   -IIb!W%! bggooh768~~v/.8.Q.QS T++G,A,AB99;& C
 				CDGGDHHe$H 		'"7"7	8 T  ,, H				9@@FGH! TTs2   =7F59AF5  E**AF2/F51F22F55G	z.subprocesses aren't inheriting Ctrl+C propertyc                f   ^ RI Hp ^ RI pVP                  VP                  4      ! 4       pVP                  P
                  P                  pVP                  VP                  4      VP                  3Vn        VP                  Vn	        V! V^ 4       V P                  \        P                  R4       R# )r   r  NCTRL_C_EVENT)rG  r  r  c_intrH  rI  SetConsoleCtrlHandlerr  r  r  r  r  r  )r5   r  rG  NULLr  s   &    r   test_CTRL_C_EVENT Win32KillTests.test_CTRL_C_EVENTS  s     	$ ~~fll+- & 6 6 L L*0..*F*2--*9&(0%
 	dA&f11>Br   c                F    V P                  \        P                  R 4       R# )CTRL_BREAK_EVENTN)r  r  r  rm   s   &r   test_CTRL_BREAK_EVENT$Win32KillTests.test_CTRL_BREAK_EVENTg  s    f557IJr   r,   )r_   r`   ra   rb   r  r  r  r   rD  r  r  skipr   r2  r  r  rc   rd   re   s   @r   r  r  
  s     4+l# __TT\?3H 4HB ]]CD  "C # EC$   "K #Kr   r  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	Win32ListdirTestsil  zTest listdir on Windows.c                @   . V n         \        ^4       F  pRV,          p\        P                  P	                  \
        P                  V4      pRV,          p\        P                  P	                  \
        P                  V4      p\        P                  ! V4       \        VRRR7      ;_uu_ 4       pVP                  RV,          4       RRR4       V P                   P                  W$.4       K  	  V P                   P                  4        R#   + '       g   i     LL; i)rb  zSUB%dzFILE%dr   r   r   z'I'm %s and proud of it. Blame test_os.
N)created_pathsr  r   rE   rG   r   rk   rS  r    r!   r  rg  )r5   r  dir_namedir_path	file_name	file_pathrx   s   &      r   rn   Win32ListdirTests.setUpp  s    qA{Hww||I$4$4h?H 1IY%5%5yAIKK!iw771BYNO 8%%x&;<  	! 87s   0DDc                N    \         P                  ! \        P                  4       R # r(   )r  r  r   rk   rm   s   &r   rC  Win32ListdirTests.tearDown}  s    i&&'r   c           	        V P                  \        \        P                  ! \        P
                  4      4      V P                  4       T P                  \        \        P                  ! \        P                  ! \        P
                  4      4      4      V P                   Uu. uF  p\        P                  ! V4      NK  	  up4       R# u upi )z-Test when the path is not an "extended" path.N)rD   r  r   rW  r   rk   r  r  r  s   & r   test_listdir_no_extended_path/Win32ListdirTests.test_listdir_no_extended_path  s     	rzz)"2"234""	$
 	rzz"++i.>.>"?@A/3/A/AB/AtT"/AB	DBs   !C	
c           	     4   R\         P                  P                  \        P                  4      ,           pV P                  \        \         P                  ! V4      4      V P                  4       R\         P                  ! \         P                  P                  \        P                  4      4      ,           pT P                  \        \         P                  ! V4      4      V P                   Uu. uF  p\         P                  ! V4      NK  	  up4       R# u upi )z&Test when the path starts with '\\?\'.\\?\   \\?\N)
r   rE   rF  r   rk   rD   r  rW  r  r  r  s   & r   test_listdir_extended_path,Win32ListdirTests.test_listdir_extended_path  s     277??9+;+;<<rzz$'(""	$
 BKK	8H8H(IJJrzz$'(/3/A/AB/AtT"/AB	DBs   -D
)r  N)r_   r`   ra   rb   r0  rn   rC  r"  r'  rc   rd   re   s   @r   r  r  l  s$     ""(
DD Dr   r  r  zNT specific testsc                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	Win32ListdriveTestsi  z5Test listdrive, listmounts and listvolume on Windows.c           	        \         P                  ! . RO\        P                  P	                  \        P
                  ! RR4      R4      RRR7      pVP                  4       pV Uu0 uF  q3P                  R4      '       g   K  VkK  	  upV n        V Uu0 uF  q3R,          R	8X  g   K  VkK  	  upV n	        V Uu0 uF  q3R
,          R	8X  g   K  VkK  	  upV n
        R# u upi u upi u upi )
fsutil.exe
SystemRootz\WindowsSystem32mbcsignore)r6   r   r  r%  :ra  NNz:\:ra  rQ  NN)r,  volumerf  )r   r  r   rE   rG   getenvr   
startswithknown_volumesknown_drivesknown_mounts)r5   r  linesls   &   r   rn   Win32ListdriveTests.setUp  s    %%,RYY|[A:N	
  ).JA,,y2IaaJ(-@12%QQ@(-A135QQA K@As$   $CCC"'C"9C'C'c                    \         P                  ! 4       pV P                  V\        4       V P	                  V P
                  V P
                  \        V4      ,          4       R # r(   )r   
listdrivesr2   rf  assertSetEqualr5  r  )r5   drivess   & r   test_listdrives#Win32ListdriveTests.test_listdrives  sF    fd+F+	
r   c                    \         P                  ! 4       pV P                  V\        4       V P	                  V P
                  V P
                  \        V4      ,          4       R # r(   )r   listvolumesr2   rf  r<  r4  r  )r5   volumess   & r   test_listvolumes$Win32ListdriveTests.test_listvolumes  sG    .."gt,W-	
r   c                   \         P                  ! 4        Fe  p \         P                  ! V4      pV P                  V\        4       V P                  \        V4      V P                  \        V4      ,          4       Kg  	  R#   \         d6   p\        P                  '       d   \        R TRT4        Rp?K   Rp?K  Rp?ii ; i)Skippingz
because ofN)r   rA  
listmountsr2   rf  r<  r  r6  rK   r   rN   rO   )r5   r1  mountsexs   &   r   test_listmounts#Win32ListdriveTests.test_listmounts  s    nn&F
v.
 %%fd3##K%%F3 '  @???*flB?? #@s   BC$B<<C)r5  r6  r4  N)r_   r`   ra   rb   r0  rn   r>  rC  rJ  rc   rd   re   s   @r   r*  r*    s"     ?B

 r   r*  readlinkzneeds os.readlink()c                   &  a  ] tR tRt o Rt]P                  P                  ]4      t	]P                  ! ]4      t]P                  ! ]	4      tR tR tR tR t]P$                  R 4       t]P$                  R 4       t]P$                  R	 4       tR
tV tR# )ReadlinkTestsi  readlinktestc                0   \         P                  P                  V4      p\         P                  P                  V4      p\        P                  R 8X  d2   R pV! V4      '       d
   VR,          pV! V4      '       d
   VR,          pV P                  W4       R# )r   c                 \    T P                  \        V \        4      '       d   R 4      # R4      # )r&  r%  )r3  r  r[   )r  s   &r   r.  /ReadlinkTests.assertPathEqual.<locals>.<lambda>  s&    1<<(E22
$C8A$Cr   :r   NNN)r   rE   normcaser>   r?   rD   )r5   leftright
has_prefixs   &&& r   assertPathEqualReadlinkTests.assertPathEqual  st    ww%  '<<7"CJ$Bx%  b	%r   c                   V P                  \        P                  P                  V P                  4      4       V P                  \        P                  P                  V P
                  4      4       V P                  \        P                  P                  V P                  4      4       V P                  \        P                  P                  V P                  4      4       R # r(   )	rt   r   rE   r  filelink_targetfilelinkb_targetrW  filelink	filelinkbrm   s   &r   rn   ReadlinkTests.setUp  s~    t';';<=t'<'<=>6778r   c                    \        V P                  4      pV P                  \        \        P
                  V P                  4       V P                  \        \        P
                  V4       R # r(   )r   rZ  r   rK   r   rL  )r5   rZ  s   & r   test_not_symlinkReadlinkTests.test_not_symlink  sD    "4#7#78'2;;0D0DE'2;;@r   c                    V P                  \        \        P                  R 4       V P                  \        \        P                  \	        R 4      4       R# )zmissing-linkN)r   rJ   r   rL  r   rm   s   &r   test_missing_linkReadlinkTests.test_missing_link  s8    +R[[.I+R[[">2	4r   c                :   \         P                  ! V P                  V P                  4       V P	                  \
        P                  V P                  4       \        V P                  4      pV P                  \         P                  ! V4      V P                  4       R # r(   )
r   r   rZ  r\  r   r   rl   r   rW  rL  )r5   r\  s   & r   test_pathlikeReadlinkTests.test_pathlike  s_    


4''7	(($--8DMM*R[[2D4H4HIr   c                d   \         P                  ! V P                  V P                  4       V P	                  \
        P                  V P                  4       \         P                  ! \        V P                  4      4      pV P                  WP                  4       V P                  V\        4       R # r(   )r   r   r[  r]  r   r   rl   rL  r   rW  r2   r[   r  s   & r   test_pathlike_bytes!ReadlinkTests.test_pathlike_bytes  sm    


4(($..9	(($..9{{8DNN34T#8#89dE*r   c                R   \         P                  ! V P                  V P                  4       V P	                  \
        P                  V P                  4       \         P                  ! V P                  4      pV P                  WP                  4       V P                  V\        4       R # r(   )r   r   r[  r]  r   r   rl   rL  rW  r2   r[   r  s   & r   
test_bytesReadlinkTests.test_bytes   sh    


4(($..9	(($..9{{4>>*T#8#89dE*r   r,   N)r_   r`   ra   rb   r\  r   rE   rF  r   rZ  r  r]  r[  rW  rn   r`  rc  r   skip_unless_symlinkrf  ri  rl  rc   rd   re   s   @r   rN  rN    s     Hggooh/OH%I{{?3&9A
4
 ""J #J ""+ #+ ""+ #+r   rN  c                     a  ] tR tRt o Rt]P                  P                  ]4      t	Rt
]P                  P                  ]	4      tRtR tR tR tR tR	 tR
 tR tR tR tR t]P2                  ! ]P                  P5                  R4      ;'       d    ]P                  P7                  R4      R4      R 4       tR tR tRtV t R# )Win32SymlinkTestsi	  filelinktestdirlinktestzmissing linkc                   \         P                  P                  V P                  4      '       g   Q h\         P                  P                  V P                  4      '       g   Q h\         P                  P                  V P
                  4      '       d   Q h\         P                  P                  V P                  4      '       d   Q h\         P                  P                  V P                  4      '       d   Q hR # r(   )r   rE   r  dirlink_targetrZ  dirlinkr\  missing_linkrm   s   &r   rn   Win32SymlinkTests.setUp  s    ww~~d112222ww~~d22333377>>$,,////77>>$--000077>>$"3"344444r   c                   \         P                  P                  V P                  4      '       d!   \         P                  ! V P                  4       \         P                  P                  V P
                  4      '       d!   \         P                  ! V P
                  4       \         P                  P                  V P                  4      '       d#   \         P                  ! V P                  4       R # R # r(   )	r   rE   r  r\  ro  ru  r  rj   rv  rm   s   &r   rC  Win32SymlinkTests.tearDown  s    77>>$--((IIdmm$77>>$,,''HHT\\"77??4,,--IId''( .r   c                   \         P                  ! V P                  V P                  4       V P	                  \         P
                  P                  V P                  4      4       V P	                  \         P
                  P                  V P                  4      4       V P	                  \         P
                  P                  V P                  4      4       V P                  V P                  V P                  4       R # r(   )
r   r   rt  ru  rt   rE   r  r  islink
check_statrm   s   &r   test_directory_link%Win32SymlinkTests.test_directory_link!  s    


4&&5t||45dll34t||45d&9&9:r   c                   \         P                  ! V P                  V P                  4       V P	                  \         P
                  P                  V P                  4      4       V P	                  \         P
                  P                  V P                  4      4       V P	                  \         P
                  P                  V P                  4      4       V P                  V P                  V P                  4       R # r(   )
r   r   rZ  r\  rt   rE   r  r  r{  r|  rm   s   &r   test_file_link Win32SymlinkTests.test_file_link(  s    


4''7t}}56t}}56t}}56t';';<r   c                   V P                   p\        P                  P                  V4      '       d   \        P                  ! V4       Rp\        P                  P                  V4      '       d   Q hRp\        P                  ! W!V4       R# )z2Create a "directory" link to a non-existent targetz"c:\\target does not exist.29r3c740TN)rv  r   rE   rj   ro  r  r   )r5   linknamer   target_is_dirs   &   r   _create_missing_dir_link*Win32SymlinkTests._create_missing_dir_link/  s]    $$77??8$$IIh677>>&))))


6]3r   c                f    V P                  4        \        P                  ! V P                  4       R # r(   )r  r   ro  rv  rm   s   &r   ,test_remove_directory_link_to_missing_target>Win32SymlinkTests.test_remove_directory_link_to_missing_target9  s"    %%' 			$##$r   c                    V P                  4        V P                  \        P                  P	                  V P
                  4      4       R # r(   )r  rW  r   rE   r  rv  rm   s   &r   .test_isdir_on_directory_link_to_missing_target@Win32SymlinkTests.test_isdir_on_directory_link_to_missing_target@  s/    %%'t'8'89:r   c                f    V P                  4        \        P                  ! V P                  4       R # r(   )r  r   r  rv  rm   s   &r   .test_rmdir_on_directory_link_to_missing_target@Win32SymlinkTests.test_rmdir_on_directory_link_to_missing_targetD  s     %%'
""#r   c                   V P                  \        P                  ! V4      \        P                  ! V4      4       V P                  \        P                  ! V4      \        P                  ! V4      4       \        P
                  ! V4      pV P                  \        P                  ! V4      \        P                  ! V4      4       V P                  \        P                  ! V4      \        P                  ! V4      4       R # r(   )rD   r   r   r  r  r  )r5   rE  r   
bytes_links   &&& r   r|  Win32SymlinkTests.check_statH  s    8BHHTNBGGDM:[[&
,bggfo>BHHZ0"''*2EFr   c                0   \         P                  P                  \        P                  4      p\         P                  P                  VR 4      p\         P                  P                  VR4      pV P                  \        P                  V4       \         P                  ! V4       \         P                  ! V4       \         P                  ! V4       \         P                  P                  \         P                  P                  VR4      4      p\        V4       \         P                  ! 4       p \         P                  ! V4       \         P                  P                  VR4      p\         P                  ! \         P                  P                  V4      R4       V P                  R\         P                  ! \         P                  ! 4       4      4       V P!                  \         P"                  ! V4      \         P"                  ! R4      4       \         P                  ! V4       V P!                  \         P"                  ! V4      \         P"                  ! \         P                  P                  V4      4      4       \         P                  ! V4       V P!                  \         P"                  ! V4      \         P"                  ! \         P                  P                  V4      4      4       \         P                  ! V4       R#   \         P                  ! T4       i ; i)level2level3ro  rE  N)r   rE   rF  r   rk   rG   r   r  rH   r%   r1   rI   r   relpathr  rW  rD   r   )r5   level1r  r  ro  orig_dirrE  s   &      r   
test_12084Win32SymlinkTests.test_12084P  s   !1!12fh/fh/	((&1


VW =>E99;	HHV77<</DJJrwwu-v6MM&"**RYY["9: RWWU^RWWV_= HHVRWWU^WWRWW__T%:;= HHVRWWU^WWRWW__T%:;= HHXBHHXs   .F7K= =LC:\Users\All UsersC:\ProgramDatazTest directories not foundc                    \         P                  ! R 4      pV P                  \         P                  P	                  VR4      4       R# )r  r  N)r   rL  rt   rE   samefile)r5   r   s   & r   
test_29248Win32SymlinkTests.test_29248s  s1     23((1BCDr   c                @   Rp\         P                  P                  ! V.^
,          !  pRV,           V3W3VR,          VR,          3.pV F  w  rE \         P                  ! WE4        \         P                  ! V4        \         P                  ! \         P                  ! T4      \         P                  ! T4      4        \         P                  ! T4       K  	  R#   \
         d     Lji ; i  \         d     L{i ; i  \
         d     K  i ; i  \         d     K  i ; i)r  rD  :N   NNXXXXXXXXXXXXXXXXXXXXXXXXXXX)r   rE   rG   r   ro  rK   rJ   r  )r5   segmentrE   
test_casesr   dests   &     r   test_buffer_overflow&Win32SymlinkTests.test_buffer_overflow  s     ww||gY^, D['"O$Zd$

 $IC

3%IIdO

2;;s+R[[->?IIdO# $   %    % sH   C+'C>?D>C<C('C(+C98C9<D
DDDc                |   \         P                  P                  R 4      p\         P                  P                  V4      '       g   V P	                  R4       \
        P                  ! \         P                  ! V4      R4       Uu. uF"  p\         P                  P                  W4      NK$  	  ppV F  p\        P                  '       d   \        4        \        RV4       \         P                  ! V4      pV P                  V\         P                  ! V4      4       V P                  \        P                   ! VP"                  4      4       V P                  VP$                  \        P&                  4       V P)                  \         P                  P+                  V4      4        R# 	  V P	                  R4       R# u upi )z$%LOCALAPPDATA%\Microsoft\WindowsAppsz%test requires a WindowsApps directoryz*.exezTesting withz$test requires an app execution aliasN)r   rE   
expandvarsr  r~   fnmatchfilterrW  rG   r   rN   rO   r  rD   r   rW  S_ISLNKry  st_reparse_tagIO_REPARSE_TAG_APPEXECLINKrt   r  )r5   rL  r=   aliasesaliasr  s   &     r   test_appexeclink"Win32SymlinkTests.test_appexeclink  s-   ww!!"IJww}}T""MMAB $NN2::d+;WEGEq 77<<(E 	 G Ene,%BR0T\\"**56R..0O0OPOOBGGNN512  MM@AGs   (F9r,   N)!r_   r`   ra   rb   r\  r   rE   rF  r   rZ  ru  rR   rt  rv  rn   rC  r}  r  r  r  r  r  r|  r  r   r   rj   r  r  r  r  rc   rd   re   s   @r   rp  rp  	  s      Hggooh/OGWW___5N!L5);=4%;$G!F )>? B B "/@ A8:
E:
E!FB Br   rp  c                      a  ] tR tRt o Rt]P                  P                  ]P                  P                  ]	4      4      t
R tR tR tR tRtV tR# )	Win32JunctionTestsi  junctiontestc                    \         P                  P                  V P                  4      '       g   Q h\         P                  P	                  V P
                  4      '       d   Q hR # r(   )r   rE   r  junction_targetrj   junctionrm   s   &r   rn   Win32JunctionTests.setUp  sA    ww~~d22333377??4==11111r   c                    \         P                  P                  V P                  4      '       d#   \         P                  ! V P                  4       R # R # r(   )r   rE   rj   r  rl   rm   s   &r   rC  Win32JunctionTests.tearDown  s.    77??4==))IIdmm$ *r   c                J   \         P                  ! V P                  V P                  4       V P	                  \
        P                  P                  V P                  4      4       V P	                  \
        P                  P                  V P                  4      4       V P	                  \
        P                  P                  V P                  4      4       V P                  \
        P                  ! V P                  4      \
        P                  ! V P                  4      4       V P                  \
        P                  ! V P                  4      \
        P                  ! V P                  4      4       V P                  \
        P                  P                  V P                  4      4       V P                  \
        P                  P!                  R V P                  ,           4      \
        P                  P!                  \
        P"                  ! V P                  4      4      4       R# )r%  N)_winapiCreateJunctionr  r  rt   r   rE   rj   r  r  r  r   r  rD   rW  r{  rS  rL  rm   s   &r   test_create_junction'Win32JunctionTests.test_create_junction  s4   t33T]]C67t}}56dmm45BGGDMM2BHHT]]4KL/9M9M1NO 	67)))d6J6J*JK))"++dmm*DE	Gr   c                   \         P                  ! V P                  V P                  4       V P	                  \
        P                  P                  V P                  4      4       V P	                  \
        P                  P                  V P                  4      4       \
        P                  ! V P                  4       V P                  \
        P                  P                  V P                  4      4       R # r(   )r  r  r  r  rt   r   rE   r  rj   rl   rW  rm   s   &r   test_unlink_removes_junction/Win32JunctionTests.test_unlink_removes_junction  s    t33T]]Ct}}5667
		$-- 67r   r,   N)r_   r`   ra   rb   r  r   rE   rR   rF  r   r  rn   rC  r  r  rc   rd   re   s   @r   r  r    sC     Hggoobggooh&?@O2%G8 8r   r  c                      a  ] tR tRt o R t]P                  ! 4       R 4       t]P                  ! 4       R 4       tRt	V t
R# )Win32NtTestsi  c                   \         P                  ! R 4      p\         P                  ! R4      p^ RIpVP                  RRR7      pVP                  P
                  VP                  n        VP                  P                  VP                  n        VP                  P
                  VP                  P                  3VP                  n        VP                  4       pVP                  P                  4       pVP                  WBP                  V4      4      pV P                  ^V4       VP                  pRRR\         .p\#        ^
4       F5  p	V F,  p
 VP%                  V
4        \(        P*                  ! V
4       K.  	  K7  	  VP                  WBP                  V4      4      pV P                  ^V4       VP                  V,
          pV P                  ^ V4       R#   \&         d     Li ; i  \&         d     K  i ; i)	r  rG  NzKernel32.dllT)use_last_errorz\\?\C:z\\?\NULz	\\?\CONIN)r   import_modulectypes.wintypesWinDLLr  r  GetCurrentProcessr  r  GetProcessHandleCountLPDWORDr  r  byrefrD   r  r   r  _getfinalpathname	Exceptionr   r   )r5   r  rG  kernelhprochandle_countrN  before_count	filenamesr  r   handle_deltas   &           r   test_getfinalpathname_handles*Win32NtTests.test_getfinalpathname_handles  s   ((.,,X6~dC+1??+A+A  (/5/C/C$$,171G1G171H1H1J$$- ((*,,.))%l1KLB#)) 	
	 rA!((.GGDM "  ))%l1KLB#))L8L) ! 
 ! s$   G!G)G&%G&)G87G8c           	        \         P                  pV P                  \         P                  V4       \        P                  ! 4       ^,           p\
        P                  ! R4      p\        P                  ! \        P                  RW1\        V4      .4      ;_uu_ 4       p\        P                  ! 4       V8  d    \        P                  ! V4       K3   VP!                  ^4       RRR4       R#   \         d   pTP                  ^8X  g   Q h Rp?Ks  Rp?ii ; i  \        P"                   d    TP%                  4         L]i ; i  + '       g   i     R# ; i)rc  a              import os
            import sys
            import time

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

            while time.time() < deadline:
                try:
                    with open(filename, "w") as f:
                        pass
                except OSError:
                    pass
                try:
                    os.remove(filename)
                except OSError:
                    pass
            r   N)r   rk   r   rl   r,  textwrapdedentr   r  r>   r   r3   r   r   rJ   r  r  r  	terminate)r5   r"   deadlinecommandr  r  s   &     r   test_stat_unlink_race"Win32NtTests.test_stat_unlink_race  s     $$	(((399;?// # ( s~~tWHVWW[_))+(+GGH%!		! XW ) +::?*?+ ,, ! ! XWWsT   E8C,ED,D7D
EDE%E =E?E  EE	c                  aa \         P                  o\        P                  P	                  R 4      o\        SR4      ;_uu_ 4       pVP                  R4       RRR4       \        P                  ! S4      p \        P                  ! SSR.\        P                  R7       VV3R
 lpV P+                  V4       \        P                  '       d   \        RS4       \        RV4       \        P                  ! S4      p\        P                  '       d   \        RV4       V P-                  VP.                  ^ VP.                  34       V P-                  VP0                  ^ VP0                  34       V P3                  VP4                  VP4                  4       V P3                  VP6                  VP6                  4       V P3                  VP8                  VP8                  4       V P3                  VP:                  VP:                  4       V P=                  VP>                  VP>                  4       R#   + '       g   i     EL; i  \        P                   d   p\        P                  '       dB   \        SSRR4       \        TP                  P!                  RR4      P#                  4       4        \        P$                  ! S4       M  \&         d     Mi ; iT P)                  R	4        Rp?ELNRp?ii ; i)z %SystemRoot%\System32\icacls.exer  s	   Test dataNz/inheritance:rr  zfailed.r  r   z"Unable to create inaccessible filec                     < \         P                  ! S SR R.\         P                  R7       \        P                  ! S4       R# )z/grantz*WD:(D)r  N)r   r  STDOUTr   rl   )ICACLSr"   s   r   cleanup9Win32NtTests.test_stat_inaccessible_file.<locals>.cleanupR  s1    ##VXx$K+5+<+<>IIhr   zFile:zstat with access:z without access:) r   rk   r   rE   r  r    r!   r   r   r  r  CalledProcessErrorr   rN   rO   r  r  r  rl   rK   r~   r   r  st_devst_inorD   ry  rm  r  r  assertGreaterEqualr  )r5   rx   stat1rI  r  stat2r  r"   s   &     @@r   test_stat_inaccessible_file(Win32NtTests.test_stat_inaccessible_file:  s   ####$GH(D!!QGGL! " !	@##VX7G$H+5+<+<>	  	 ???'8$%u- !???$e, 	ellQ$56ellQ$56 	66 	88 	?g "!! ,, 	@fh(8)Dbii&&ui8??AB		(# MM>??	@sI   H.7)I .H?	K3AK./KK.KK.KK..K3r,   N)r_   r`   ra   rb   r  r   r2  r  r  rc   rd   re   s   @r   r  r    sH     /*b   "'! #'!R   "7@ #7@r   r  c                   2   a  ] tR tRt o R tR tR tRtV tR# )NonLocalSymlinkTestsiu  c                2    \         P                  ! R4       R# )z-
Create this structure:

base
 \___ some_dir
zbase/some_dirN)r   rS  rm   s   &r   rn   NonLocalSymlinkTests.setUpx  s     	O$r   c                2    \         P                  ! R 4       R# )r  N)r  r  rm   s   &r   rC  NonLocalSymlinkTests.tearDown  s    fr   c                    \         P                  P                  RR4      p\         P                  ! RV4       \         P                  P	                  V4      '       g   Q hR# )ay  
The symlink target should resolve relative to the link, not relative
to the current directory.

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

In issue13772, it was discovered that directory detection failed if
the symlink target was not specified relative to the current
directory, which was a defect in the implementation.
r  	some_linksome_dirN)r   rE   rG   r   r  )r5   r   s   & r   test_directory_link_nonlocal1NonLocalSymlinkTests.test_directory_link_nonlocal  s?     ggll6;/


:s#ww}}S!!!!r   r,   N)	r_   r`   ra   rb   rn   rC  r  rc   rd   re   s   @r   r  r  u  s     %" "r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )FSEncodingTestsi  c                    V P                  \        P                  ! R 4      R 4       V P                  \        P                  ! R4      R4       R# )s   abcu   abcŁN)rD   r   r  r\   rm   s   &r   test_nopFSEncodingTests.test_nop  s4    Z0*=[1;?r   c                    R F@  p \         P                  ! V4      pT P                  \         P                  ! T4      T4       KB  	  R#   \         d     KT  i ; i)	   unicodeŁN)r  u   latinéascii)r   r  r  rD   r\   )r5   r  r  s   &  r   test_identityFSEncodingTests.test_identity  sM    9B++b/ R[[126 : & s   A		AAr,   N)r_   r`   ra   rb   r  r  rc   rd   re   s   @r   r  r    s     @7 7r   r  c                   *  a  ] tR tRt o R t]P                  ! ]P                  ! ^ 4      ;'       dR    ]	! 4       '       * ;'       d>    ]
P                  P                  R4      ;'       g    ]! ]R4      ;'       d
    ]! ]R4      R4      R 4       tRtV tR	# )
DeviceEncodingTestsi  c                P    V P                  \        P                  ! R 4      4       R# )i@ N)r2  r   device_encodingrm   s   &r   test_bad_fdDeviceEncodingTests.test_bad_fd  s    ",,V45r   winnl_langinfoCODESETz>test requires a tty and either Windows or nl_langinfo(CODESET)c                    \         P                  ! ^ 4      pV P                  V4       V P                  \        P
                  ! V4      4       R# r   )r   r	  assertIsNotNonert   codecslookup)r5   r   s   & r   test_device_encoding(DeviceEncodingTests.test_device_encoding  s7     %%a(X&h/0r   r,   N)r_   r`   ra   rb   r
  r   r   r   r  r	   r>   r?   r3  r   localer  rc   rd   re   s   @r   r  r    s     6 1 M Mln*< M M#,,BYBYZ_B` CL CLV]+JJ	0JLN1N1r   r  c                   N  a  ] tR tRt o ]P
                  ! ]! ]R4      R4      R 4       tRR lt	R t
R t]P
                  ! ]P                  R	8H  R
4      R 4       t]P
                  ! ]P                  R	8H  R
4      R 4       t]P
                  ! ]! ]R4      R4      R 4       tRtV tR# )PidTestsi  getppidztest needs os.getppidc                6   \         P                  ! \        P                  R R.\         P                  \         P                  R7      pVP                  4       w  r#V P                  VR4       V P                  \        V4      \        P                  ! 4       4       R# )r   zimport os; print(os.getppid()))r  r  r   N)
r   r  r>   _base_executabler  communicaterD   r   r   getpid)r5   r  r  r  s   &   r   test_getppidPidTests.test_getppid  sl    c22D>@$.OO$.OO5 $Vbiik2r   Nc                   \         P                  R 8X  d   R\         P                   R2RRV R2.pM\         P                  RV.p\        P                  ! \        P
                  \         P                  V4      pVe	   V! V4       \        P                  ! V^ 4      w  rgV P                  \        P                  ! V4      V4       V P                  We4       R# )r   "r   N)	r>   r?   r   r   spawnvP_NOWAITwaitpidrD   waitstatus_to_exitcode)r5   r   exitcodecallbackr   r  pid2statuss   &&&&    r   check_waitpidPidTests.check_waitpid  s    <<7" 'q)41TF!=DNND$/DiiS^^T:SM zz#q)226:HE#r   c                ,    V P                  R ^ R7       R# )r  )r   r%  Nr)  rm   s   &r   test_waitpidPidTests.test_waitpid  s    3r   c                    ^pRV R2pV P                  W!R7       V P                  \        4      ;_uu_ 4        \        P                  ! R4       RRR4       R#   + '       g   i     R# ; i)   zimport sys; sys.exit()r%          N)r)  r   r   r   r$  )r5   r%  r   s   &  r   test_waitstatus_to_exitcode$PidTests.test_waitstatus_to_exitcode  sT    &xj243y))%%c* *)))s   AA*	r   win32-specific testc                :    R pRV R2pV P                  W!R7       R# )l   :   z$import _winapi; _winapi.ExitProcess(r1  r2  Nr,  )r5   STATUS_CONTROL_C_EXITr   s   &  r   test_waitpid_windowsPidTests.test_waitpid_windows  s+     !+56K5LAN4@r   c                   Rp^ ^^V3 F0  pV P                  \        P                  ! V^,          4      V4       K2  	  V P                  \        4      ;_uu_ 4        \        P                  ! V^,           ^,          4       RRR4       V P                  \
        4      ;_uu_ 4        \        P                  ! R4       RRR4       R#   + '       g   i     LN; i  + '       g   i     R# ; i)rb  Nr  re  )rD   r   r$  r   r  r  )r5   max_exitcoder%  s   &  r   #test_waitstatus_to_exitcode_windows,PidTests.test_waitstatus_to_exitcode_windows  s    "Aq,/HR66x1}E%' 0
 z**%%|a'7A&=> +}--%%b) .- +*---s   %C$CC	C)	SIGKILLzneed signal.SIGKILLc                   a R \         P                   R2p\        P                  oV3R lpV P	                  VS) VR7       R# )zimport time; time.sleep(r1  c                 6   < \         P                  ! V S4       R # r(   )r   r  )r  signums   &r   kill_process?PidTests.test_waitstatus_to_exitcode_kill.<locals>.kill_process  s    GGC r   )r%  r&  N)r   LONG_TIMEOUTr  r?  r)  )r5   r   rC  rB  s   &  @r    test_waitstatus_to_exitcode_kill)PidTests.test_waitstatus_to_exitcode_kill  s?    )'*>*>)?qA	! 	46'LIr   r,   r(   )r_   r`   ra   rb   r   r   r   r   r  r)  r-  r4  r>   r?   r9  r=  r  rF  rc   rd   re   s   @r   r  r    s     Y/1HI3 J3$$4+ 02GHA IA 02GH
* I
* 35JKJ LJr   r  c                     a  ] tR tRt o ]R 4       tRRRR/R lt]! R4      R 4       t]! R	4      R
 4       t	]! R4      R 4       t
]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R	4      R 4       t]! R4      R 4       t]! R4      R 4       tR t]! R4      R 4       t]! R4      R 4       tR tV tR!# )"
SpawnTestsi  c                    \         P                  R 8w  d   V # V  Uu. uF   pRVP                  4       9   d   RV R2MTNK"  	  up# u upi )r  r  r   )r   r   r  )r   r  s   & r   
quote_argsSpawnTests.quote_args  sF     77d?KEIJTccSYY[0!C5
c9TJJJs   &Awith_envF	use_bytesc                  ^V n         \        P                  pV P                  \        P                  V4       V'       g   RV P                   ,          pM\        \        P                  4      V n        \        \        P                  ! 4       4      V n        V P                  V P                  V P                  &   RV P                  : RV P                   : R2p\        VRRR7      ;_uu_ 4       pVP                  V4       RRR4       \        P                   pV P#                  Wc.4      pV'       d   \        P$                  ! V4      pV Uu. uF  p\        P$                  ! V4      NK  	  ppV P                  P'                  4        U	U
u/ uF0  w  r\        P$                  ! V	4      \        P$                  ! V
4      bK2  	  up
p	V n        Wg3#   + '       g   i     L; iu upi u up
p	i )	   zimport sys; sys.exit(%s)z#import sys, os; magic = os.environ[z]; sys.exit(r1  r   r   r   N)r%  r   rk   r   rl   rp  r   r  r  r3   r  uuid4rx  r    r!   r>   r   rK  r  rv  )r5   rM  rN  r"   r   r$   r  r   r=   kvs   &$$        r   create_argsSpawnTests.create_args	  sP   ##	(((3-=DBJJ'DH4::<(DH!%DHHTXX xx0D (C'22bHHTN 3 ..23kk'*G,01DqBKKNDD1$(HHNN$46$4DA AA6$46DH } 32 26s   -GG	6G#G	spawnlc                    V P                  4       w  r\        P                  ! \        P                  V.VO5!  pV P	                  W0P
                  4       R # r(   )rT  r   rV  P_WAITrD   r%  r5   r  r   r%  s   &   r   test_spawnlSpawnTests.test_spawnl'  s=    ((*99RYY7$7==1r   spawnlec                    V P                  R R7      w  r\        P                  ! \        P                  V.VOV P                  N5!  pV P                  W0P                  4       R# T)rM  N)rT  r   r\  rX  r  rD   r%  rY  s   &   r   test_spawnleSpawnTests.test_spawnle-  sK    (($(7::biiB4BB==1r   spawnlpc                    V P                  4       w  r\        P                  ! \        P                  V.VO5!  pV P	                  W0P
                  4       R # r(   )rT  r   ra  rX  rD   r%  rY  s   &   r   test_spawnlpSpawnTests.test_spawnlp3  s=    ((*::bii848==1r   spawnlpec                    V P                  R R7      w  r\        P                  ! \        P                  V.VOV P                  N5!  pV P                  W0P                  4       R# r^  )rT  r   re  rX  r  rD   r%  rY  s   &   r   test_spawnlpeSpawnTests.test_spawnlpe9  sK    (($(7;;ryy'CDC$((C==1r   r!  c                >   V P                  4       w  r\        P                  ! \        P                  W4      pV P	                  W0P
                  4       \        P                  ! \        P                  \        V4      V4      pV P	                  W0P
                  4       R # r(   )rT  r   r!  rX  rD   r%  r   rY  s   &   r   test_spawnvSpawnTests.test_spawnv?  sg    ((*99RYY6==1 99RYY(94@==1r   spawnvec                    V P                  R R7      w  r\        P                  ! \        P                  WV P                  4      pV P                  W0P                  4       R# r^  rT  r   rl  rX  r  rD   r%  rY  s   &   r   test_spawnveSpawnTests.test_spawnveI  sC    (($(7::biiA==1r   spawnvpc                    V P                  4       w  r\        P                  ! \        P                  W4      pV P	                  W0P
                  4       R # r(   )rT  r   rq  rX  rD   r%  rY  s   &   r   test_spawnvpSpawnTests.test_spawnvpO  s8    ((*::bii7==1r   spawnvpec                    V P                  R R7      w  r\        P                  ! \        P                  WV P                  4      pV P                  W0P                  4       R# r^  )rT  r   ru  rX  r  rD   r%  rY  s   &   r   test_spawnvpeSpawnTests.test_spawnvpeU  sC    (($(7;;ryy'B==1r   c                    V P                  4       w  r\        P                  ! \        P                  W4      p\        P
                  ! W0P                  R 7       R# )r2  N)rT  r   r!  r"  r   wait_processr%  )r5   r  r   r  s   &   r   test_nowaitSpawnTests.test_nowait[  s8    ((*iiW3S==9r   c                    V P                  R R R7      w  r\        P                  ! \        P                  WV P                  4      pV P                  W0P                  4       R# )T)rM  rN  Nrn  rY  s   &   r   test_spawnve_bytesSpawnTests.test_spawnve_bytesa  sG     (($$(G::biiA==1r   c                    V P                  4       w  rV P                  \        \        P                  \        P
                  V4       V P                  \        \        P                  \        P
                  VR 4       R# rE  N)rT  r   r  r   rV  r"  r5   r  __s   &  r   test_spawnl_noargsSpawnTests.test_spawnl_noargsh  sL    &&(*biigF*biigrJr   c                    V P                  4       w  rV P                  \        \        P                  \        P
                  V/ 4       V P                  \        \        P                  \        P
                  VR / 4       R# r  )rT  r   r  r   r\  r"  r  s   &  r   test_spawnle_noargsSpawnTests.test_spawnle_noargsn  sP    &&(*bjj"++wK*bjj"++wBOr   c                   V P                  4       w  rV P                  \        \        P                  \        P
                  VR4       V P                  \        \        P                  \        P
                  V. 4       V P                  \        \        P                  \        P
                  VR4       V P                  \        \        P                  \        P
                  VR .4       R# rE  Nr,   r  )rT  r   r  r   r!  r"  r  s   &  r   test_spawnv_noargsSpawnTests.test_spawnv_noargst  s    &&(*biigrJ*biigrJ*biiguM*biigtLr   c                   V P                  4       w  rV P                  \        \        P                  \        P
                  VR/ 4       V P                  \        \        P                  \        P
                  V. / 4       V P                  \        \        P                  \        P
                  VR/ 4       V P                  \        \        P                  \        P
                  VR ./ 4       R# r  )rT  r   r  r   rl  r"  r  s   &  r   test_spawnve_noargsSpawnTests.test_spawnve_noargs|  s    &&(*bjj"++wBO*bjj"++wBO*bjj"++wrR*bjj"++wbQr   c                0   \         P                  pV P                  VR R.4      p\        P                  P                  4       pRVR&    V! \        P                  W#V4      pV P                  V^4       \        P                  P                  4       pRVR&    V! \        P                  W#V4      pV P                  V^4       \        P                  P                  4       pRVR&    V! \        P                  W#V4      pV P                  V^4       \        P                  pV P                  \        P                  V4       \        VRR	R
7      ;_uu_ 4       pVP                  R4       RRR4       V P                  W&.4      p\        P                  P                  4       pRVR&   V! \        P                  W#V4      pV P                  V^ 4       R#   \         d     ELki ; i  \         d     EL/i ; i  \         d     Li ; i  + '       g   i     L; i)r   r  r  r  r  r  r  r  r   r   r   zPimport sys, os
if os.getenv("FRUIT") != "orange=lemon":
    raise AssertionErrorNzorange=lemon)r>   r   rK  r   r  r  rX  rD   r  r   rk   r   rl   r    r!   )r5   spawnr  r   r  r%  r"   r$   s   &&      r   _test_invalid_envSpawnTests._test_invalid_env  s   ..v67 "%.!"	,RYYv>H Xs+ "5w	,RYYv>H Xs+ "!(~	,RYYv>H Xs+ ##	(((3(C'22bHH 0 1 3
 23"(wG6:1%K  		  		  		 32sB   	G G" %G4 HGG"G10G14HHH	c                D    V P                  \        P                  4       R # r(   )r  r   rl  rm   s   &r   test_spawnve_invalid_env#SpawnTests.test_spawnve_invalid_env  s    rzz*r   c                D    V P                  \        P                  4       R # r(   )r  r   ru  rm   s   &r   test_spawnvpe_invalid_env$SpawnTests.test_spawnvpe_invalid_env  s    r{{+r   )r  r%  rx  N)r_   r`   ra   rb   rk  rK  rT  r   rZ  r_  rc  rg  rj  ro  rs  rw  r{  r~  r  r  r  r  r  r  r  rc   rd   re   s   @r   rI  rI    s    K Ke u < h2  2
 i 2 !2
 i 2 !2
 j!2 "2
 h2  2 i 2 !2
 i 2 !2
 j!2 "2
 h:  :
 i 2 !2 hK  K
 i P !P
 hM  M i R !R.&` i + !+ j!, ",r   rI  z>Skip due to platform/environment differences on *NIX buildbotsgetloginztest needs os.getloginc                   &   a  ] tR tRt o R tRtV tR# )
LoginTestsi  c                f    \         P                  ! 4       pV P                  \        V4      ^ 4       R# r   )r   r  r  r@   )r5   	user_names   & r   test_getloginLoginTests.test_getlogin  s!    KKM	C	NA.r   r,   N)r_   r`   ra   rb   r  rc   rd   re   s   @r   r  r    s     / /r   r  getprioritysetpriorityz'needs os.getpriority and os.setpriorityc                   *   a  ] tR tRt o RtR tRtV tR# )ProgramPriorityTestsi  z0Tests for os.getpriority() and os.setpriority().c                :   \         P                  ! \         P                  \         P                  ! 4       4      pR V R2p\	        RV4      w  r4p\        V4      pV^8  d$   WQ8:  d   \        P                  ! RV,          4      hV P                  WQ^,           4       R# )zMif 1:
        import os
        os.setpriority(os.PRIO_PROCESS, os.getpid(), zJ + 1)
        print(os.getpriority(os.PRIO_PROCESS, os.getpid()))
        r   z?unable to reliably test setpriority at current nice level of %sN)	r   r  PRIO_PROCESSr  r   r   r   r  rD   )r5   r  r   r  r  new_prios   &     r   test_set_get_priority*ProgramPriorityTests.test_set_get_priority  s    ~~booryy{;66:V <	 %T40	s82:(*## %BDH%I J J Xax0r   r,   N)r_   r`   ra   rb   r0  r  rc   rd   re   s   @r   r  r    s      ;1 1r   r  sendfileztest needs os.sendfile()c                     a  ] tR tRt o RR,          t]P                  P                  R4      '       * t]	P                  ! ]R4      t]	P                  ! ]P                  R8  R4      t]R 4       t]R 4       t]R 4       tR tR	 tR
 t]R 4       t]R 4       tR tR tR tR tR t]R 4       t]R 4       t]]R 4       4       t]]R 4       4       t ]]	P                  ! ]!! ]"R4      R4      R 4       4       t#Rt$V t%R# )TestSendfilei  i   z%requires headers and trailers supportz(test is only meaningful on 32-bit buildsc                N    \        \        P                  V P                  4       R # r(   )r%   r   rk   DATAr%  s   &r   r'  TestSendfile.setUpClass  s    I$$chh/r   c                N    \         P                  ! \         P                  4       R # r(   )r   rl   rk   r%  s   &r   rJ  TestSendfile.tearDownClass  s    ))*r   c               x   "   V P                  4       '       g   V P                  4       G R j  xL
 5x  K3  R #  L5ir(   )at_eofr   )readers   &r   chunksTestSendfile.chunks  s'     --//%% "%s   ::8:c                   "   R P                  V P                  V4       Uu. u Rj  xL
 q3NK   LDMu upi up4      T n        TP                  4        T P                  P                  4        R# 5i)r   N)rG   r  server_bufferrs   server)r5   r  writerrV  s   &&& r   handle_new_clientTestSendfile.handle_new_client  sI      XXF8K&L&L1q&L&LMs&   A031
/1
31
3>A0c                  "   R V n         \        P                  ! V P                  \        P
                  4      G Rj  xL
 V n        V P                  P                  ^ ,          P                  4       p\        P                  ! 4       V n
        V P                  P                  R4       \        P                  ! 4       P                  V P                  V4      G Rj  xL
  V P                  P                  4       V n        \!        \"        P$                  R4      V n        V P&                  P                  4       V n        R#  L Le5i)r   NFr   )r  r)   start_serverr  r   HOSTv4r  socketsgetsocknamesocketclientsetblockingget_running_loopsock_connectr   socknor    r   rk   rs  )r5   server_names   & r   
asyncSetUpTestSendfile.asyncSetUp  s      #001G1G1>1E1EG Gkk))!,88:mmo&&&(55dkk;OOOkk((*))40	ii&&(G
 	Ps#   :E D<BE D>A$E >E c                   "   V P                   P                  4        V P                  P                  4        V P                  P	                  4       G R j  xL
  R #  L5ir(   )rs  rs   r  r  wait_closedrm   s   &r   asyncTearDownTestSendfile.asyncTearDown  s9     		kk%%'''s   AAAAc                 n   "   \         P                  ! \        P                  .V O5/ VB G R j  xL
 #  L5ir(   )r)   	to_threadr   r  )r   r:  s   *,r   async_sendfileTestSendfile.async_sendfile  s*     &&r{{DTDVDDDDs   ,535c                    "     \         P                  ! V / VB G Rj  xL
 #  L  \         d\   pTP                  \        P                  8X  d   h TP                  \        P
                  \        P                  39   d    Rp?K  h Rp?ii ; i5i)zVA higher level wrapper representing how an application is
supposed to use sendfile().
N)r  r  rK   rL   
ECONNRESETEAGAINEBUSY)r   r:  r  s   *, r   sendfile_wrapperTestSendfile.sendfile_wrapper  sn     
 
)88$I&IIII 99 0 00YY5<<"==s=   B% #% B% BAB?BBBBc                  "   ^ p^ pRpV\        V P                  4      8  dn   V P                  V P                  V P                  W#4      G Rj  xL
 pV^ 8X  d   M6W$,          pW,          pV P                  WC8*  4       V P                  W!4       K  V P                  V\        V P                  4      4       V P                  P                  \        P                  4       V P                  P                  4        V P                  P                  4       G Rj  xL
  V P                  \        V P                  4      \        V P                  4      4       V P                  V P                  V P                  4       R#  EL- Lg5ir      N)r@   r  r  r  r   rt   rD   r  shutdownr  	SHUT_RDWRrs   r  r  r  )r5   
total_sentoffsetnbytessents   &    r   test_send_whole_file!TestSendfile.test_send_whole_file$  s    
3tyy>)..t{{DKK/5? ?DqyNFJOODN+V0S^4V--.kk%%'''T//0#dii.A++TYY7? 	(s&   AE?E:CE?E=A%E?=E?c                :  "   ^ p\        V P                  4      ^,          p\        V P                  4      V,
          pRpW8  d]   V P                  V P                  V P                  W$4      G Rj  xL
 pV^ 8X  d   M%W%,          pW,          pV P                  WT8*  4       Kb  V P                  P                  \        P                  4       V P                  P                  4        V P                  P                  4       G Rj  xL
  V P                  \        V P                  4      ^,          R pV P                  V\        V4      4       V P                  \        V P                  4      \        V4      4       V P                  V P                  V4       R#  EL' L5ir  )r@   r  r  r  r   rt   r  r  r  r  rs   r  r  rD   r  )r5   r  r  	must_sendr  r  rT   s   &      r   test_send_at_certain_offset(TestSendfile.test_send_at_certain_offset:  s3    
TYY1$		NV+	$..t{{DKK/5? ?DqyNFJOODN+V--.kk%%'''99S^q012S]3T//0#h-@++X6? 	(s&   A-F/F0BFFBFFc                F  "   \        V P                  4      R ,           p V P                  V P                  V P                  VR 4      G Rj  xL
 pV P                  V^ 4       V P                  P                  \        P                  4       V P                  P                  4        V P                  P                  4       G Rj  xL
  V P                  V P                   R4       R#  L  \         d+   pTP                  \        P                  8w  d   h  Rp?LRp?ii ; i L\5i)r  Nr   )r@   r  r  r  r   rD   rK   rL   EINVALr  r  r  r  rs   r  r  r  )r5   r  r  r  s   &   r   test_offset_overflow!TestSendfile.test_offset_overflowQ  s     TYY$&	&,,T[[$++-3T; ;D T1%V--.kk%%'''++S1; 	ww%,,& '	 	(sM   D!+C' C%C' A2D!D"D!%C' 'D2 DD!DD!c                L  "   V P                  \        4      ;_uu_ 4       pV P                  V P                  V P                  RR4      G Rj  xL
  RRR4       V P                  XP                  P                  \        P                  4       R#  LB  + '       g   i     LH; i5i)ra  r  Nre  )	r   rK   r  r  r   rD   r  rL   r  r5   r@  s   & r   test_invalid_offset TestSendfile.test_invalid_offsetb  sk     w''2%%dkk4;;DIII (++U\\: J ('s.   B$,BBB>B$BB!	B$c           
       "   V P                  V P                  V P                  ^ RR7      G Rj  xL
  V P                  '       d7   V P                  V P                  V P                  ^ RRR^ R7      G Rj  xL
  R# R#  LN L
5i)r   r  )r  r  r  rz  N)r  r  r  rz  headerstrailersr   r,   )r  r  r   SUPPORT_HEADERS_TRAILERSrm   s   &r   test_keywordsTestSendfile.test_keywordsg  s     !!DKK)*$ " 8 	8 	8(((%%T[[-.d.02Q & H H H )	8Hs'   -BA>B/B5B 6	B Bc                  "   ^ pRV P                   RR ,           pV P                  V P                  V P                  ^ RRR.R7      G Rj  xL
 pV P	                  VR4       W,          pRpV\        V4      8  dw   \        \        V4      V,
          R4      pV P                  V P                  V P                  WE4      G Rj  xL
 pV^ 8X  d   M#V P	                  W54       W,          pWC,          pK  V P                  V\        V4      4       V P                  P                  4        V P                  P                  4       G Rj  xL
  V P                  \        V P                  4      \        V4      4       R#  EL. L L95i)	r   Nr  r  s   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxs   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyre  i   )r  r  r  r   assertLessEqualr@   minr  rD   r  rs   r  r  hashr  )r5   r  expected_datar  r  r  s   &     r   test_headersTestSendfile.test_headersr  sI    
/$))CR.@((dkk1d2<j1I ) K KT#34
3}--]+j8$?F..t{{DKK/5? ?Dqy  .JNFS%78kk%%'''d00143FG%K? 	(s8   AE?
E8A6E?E;BE?E=5E?;E?=E?c           
        "   \         P                  R ,           pRpV P                  \         P                  V4       \	        W4       \        VR4      ;_uu_ 4       pV P                  V P                  VP                  4       ^ ^RR.R7      G Rj  xL
  V P                  P                  4        V P                  P                  4       G Rj  xL
  V P                  V P                  R4       RRR4       R#  Lf L,  + '       g   i     R# ; i5i)r  s   abcdefr   s   123456s   789r  Ns   abcde123456789)r   rk   r   rl   r%   r    r  r  r   r  rs   r  r  rD   r  )r5   r   	file_datarx   s   &   r   test_trailersTestSendfile.test_trailers  s     ""S(		(('2G''4  A%%dkk188:q!096/B & D D DKK++))+++T//1BC ! D ,	 !  sB   AD4C:C6;C:C8 C:,
D6C:8C::D		Dc           
       "   R V P                   P                  n        V P                  \        4      ;_uu_ 4       pV P                  V P                  V P                  ^ ^ RR,          .R,          R7      G Rj  xL
  RRR4       V P                  XP                  P                  \        P                  4       R#  LB  + '       g   i     LH; i5i)Fr  r  N   r  r  handler_instance
accumulater   rK   r  r  r   rD   r  rL   r  r  s   & r   test_headers_overflow_32bits)TestSendfile.test_headers_overflow_32bits  s      38$$/w''2%%dkk4;;1/3e|nu.D & F F F ( 	++U\\:F ('.   9C=B=8B;9B==>C;B==C	Cc           
       "   R V P                   P                  n        V P                  \        4      ;_uu_ 4       pV P                  V P                  V P                  ^ ^ RR,          .R,          R7      G Rj  xL
  RRR4       V P                  XP                  P                  \        P                  4       R#  LB  + '       g   i     LH; i5i)Fr  r  Nr  r  r  r  s   & r   test_trailers_overflow_32bits*TestSendfile.test_trailers_overflow_32bits  s      38$$/w''2%%dkk4;;104u~/E & G G G ( 	++U\\:G ('r
  SF_NODISKIOztest needs os.SF_NODISKIOc                &  "    V P                  V P                  V P                  ^ R\        P                  R7      G Rj  xL
  R#  L  \
         d<   pTP                  \        P                  \        P                  39  d   h  Rp?R# Rp?ii ; i5i)r   r  r   N)	r  r  r   r   r  rK   rL   r  r  )r5   r  s   & r   
test_flagsTestSendfile.test_flags  sn     	%%dkk4;;4,.NN & < < < 	yyell ;; <	s?   B;A A A BA B0B	B	BB)r  rs  r   r  r  r  Ns   12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde)linuxandroidsolarissunosr  )&r_   r`   ra   rb   r  r>   r?   r3  r  r   r   requires_headers_trailersmaxsizerequires_32brL  r'  rJ  rk  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r  rc   rd   re   s   @r   r  r    s     $DLL##$LMM  ( 3 34L3!5&&s{{U':68L 0 0 + + & &

)( E E  "8,7.2";
H H H. D D ;  ; ;  ; ]3466 r   r  c                     \        \        R 4      '       g   R#  \        \        P                  R^ 4      ;_uu_ 4       p  \        P
                  ! V P                  4       RR4        RRR4       \        P                  ! \        P                  4       R#   \         d1     RRR4       \        P                  ! \        P                  4       R# i ; i  + '       g   i     Lt; i  \        P                  ! \        P                  4       i ; i)setxattrFr   	   user.testr   NT)	r   r   r    r   rk   r  r   rK   rl   )r$   s    r   supports_extended_attributesr    s    2z""+)""D!,,BIIKs; - 	))*  	 - 	))* -, 	))*sE   #C% C&B&C% CC C% CCC"	C% %&Dz(no non-broken extended attribute supportc                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	ExtendedAttributeTestsi  c                   \         P                  pV P                  \         P                  V4       \	        V4       V P                  \        4      ;_uu_ 4       pV! Wq! R 4      3/ VB  RRR4       V P                  XP                  P                  \        P                  4       V! V4      p	V P                  V	\        4       V! Wq! R 4      R3/ VB  \        V	4      p
V
P                  R 4       V P                  \        V! V4      4      V
4       V P                  V! VR3/ VB R4       V! Wq! R 4      R\        P                   3/ VB  V P                  V! VR3/ VB R4       V P                  \        4      ;_uu_ 4       pV! Wq! R 4      R\        P"                  3/ VB  RRR4       V P                  VP                  P                  \        P$                  4       V P                  \        4      ;_uu_ 4       pV! Wq! R4      R\        P                   3/ VB  RRR4       V P                  VP                  P                  \        P                  4       V! Wq! R4      R\        P"                  3/ VB  V
P                  R4       V P                  \        V! V4      4      V
4       V! Wq! R 4      3/ VB  V P                  \        4      ;_uu_ 4       pV! Wq! R 4      3/ VB  RRR4       V P                  VP                  P                  \        P                  4       V
P'                  R 4       V P                  \        V! V4      4      V
4       V P                  V! Wq! R4      3/ VB R4       V! Wq! R 4      R
3/ VB  V P                  V! Wq! R 4      3/ VB R
4       V! Wq! R 4      3/ VB  \)        R \+        ^ 4       4       4      pV F  pV! W|R	3/ VB  K  	  V P                  \        V! V4      4      \        V	4      \        V4      ,          4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL/; i  + '       g   i     ELz; i)	user.testNr   r  rf  s   byez
user.test2   fooc              3   D   "   T F  pR P                  V4      x  K  	  R# 5i)zuser.test{}N)r  )r  r  s   & r   r  ;ExtendedAttributeTests._check_xattrs_str.<locals>.<genexpr>  s     Ay!m**1--ys    r  s   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)r   rk   r   rl   r%   r   rK   rD   r  rL   ENODATAr2   rf  r  r  r   XATTR_REPLACEXATTR_CREATEEEXISTro  r  r  )r5   r   getxattrr  removexattr	listxattrr:  r  r@  
init_xattrxattrmanythings   &&&&&&,      r   _check_xattrs_str(ExtendedAttributeTests._check_xattrs_str  ss   	(("-Bw''2R;262 (++U]];r]
j$/Q{^S3F3J		+Yr]+U3"l=f=sCQ{^Xr/?/?J6J"l=f=xHw''2R;KFK (++U\\:w''2R<&"2B2BMfM (++U]];Q|_fbooHH		,Yr]+U3B+1&1w''2R;262 (++U]];[!Yr]+U3"ao@@&IQ{^X88"an??JB+1&1AuRyAAER// Yr]+S_s4y-HIS ('' ('' ('' (''s0   P  P+9 P?QP(	+P<	?Q	Q$	c                   V P                   ! \        .VO5/ VB  \        P                  ! \        P                  4       V P                   ! \
        P                  .VO5/ VB  \        P                  ! \        P                  4       R # r(   )r0  r3   r   rl   rk   r   r  r  s   &*,r   _check_xattrs$ExtendedAttributeTests._check_xattrs  s^    s4T4V4))*r{{<T<V<))*r   c                    V P                  \        P                  \        P                  \        P                  \        P
                  4       R # r(   r3  r   r)  r  r*  r+  rm   s   &r   test_simple"ExtendedAttributeTests.test_simple  s)    2;;R^^<<	)r   c                    V P                  \        P                  \        P                  \        P                  \        P
                  R R7       R# )FrW  Nr6  rm   s   &r   
test_lpath!ExtendedAttributeTests.test_lpath  s1    2;;R^^<< 	 	@r   c                B    R  pR pR pR pV P                  WW44       R# )c                     \        V R 4      ;_uu_ 4       p\        P                  ! VP                  4       .VO5!  uuRRR4       #   + '       g   i     R# ; ir  )r    r   r)  r   rE   r   r$   s   &* r   r)  1ExtendedAttributeTests.test_fds.<locals>.getxattr  s7    dD!!R{{299;66 "!!!   &AA	c                     \        V R ^ 4      ;_uu_ 4       p\        P                  ! VP                  4       .VO5!   RRR4       R#   + '       g   i     R# ; ir  N)r    r   r  r   r>  s   &* r   r  1ExtendedAttributeTests.test_fds.<locals>.setxattr  s9    dD!$$BIIK/$/ %$$$r  c                     \        V R ^ 4      ;_uu_ 4       p\        P                  ! VP                  4       .VO5!   RRR4       R#   + '       g   i     R# ; irB  )r    r   r*  r   r>  s   &* r   r*  4ExtendedAttributeTests.test_fds.<locals>.removexattr  s9    dD!$$ryy{2T2 %$$$r  c                     \        V R 4      ;_uu_ 4       p\        P                  ! VP                  4       .VO5!  uuRRR4       #   + '       g   i     R# ; ir  )r    r   r+  r   r>  s   &* r   r+  2ExtendedAttributeTests.test_fds.<locals>.listxattr  s7    dD!!R||BIIK7$7 "!!!r@  N)r3  )r5   r)  r  r*  r+  s   &    r   test_fdsExtendedAttributeTests.test_fds  s(    	7	0	3	8 	8{Fr   r,   N)r_   r`   ra   rb   r0  r3  r7  r:  rH  rc   rd   re   s   @r   r  r    s(     .J`+)@G Gr   r  get_terminal_sizezrequires os.get_terminal_sizec                      a  ] tR tRt o R t]P                  ! 4       R 4       t]P                  ! ]
P                  R8H  R4      R 4       tRtV tR# )	TermsizeTestsi  c                    \         P                  ! 4       pT P                  TP                  ^ 4       T P                  TP                  ^ 4       R#   \         d   p\        P                  \        P
                  .p\        P                  R8X  d    TP                  \        P                  4       \        P                  R8X  g   TP                  T9   d   T P                  R4       h Rp?ii ; i)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.
r  r   failed to query terminal sizeN)r   rJ  rK   rL   r  ENOTTYr>   r?   rn  EACCESr~   r  columnsr7  )r5   r   r  known_errnoss   &   r   test_does_not_crash!TermsizeTests.test_does_not_crash  s    	'')D 	a0

A.  
	!LL%,,7L||y( ##ELL1||w&!''\*A =>
	s   A C-BC((C-c                    \         P                  ! RR.\         P                  RR7      P                  4       p\        X^,          4      \        V^ ,          4      3p \        P                  ! \        P                  P                  4       4      pT P'                  Y#4       R#   \        \         P
                  \        3 d    T P                  R4        Li ; i  \         d\   p\        P                  R8X  g0   TP                   \         P"                  \         P$                  39   d   T P                  R4       h Rp?ii ; i)	zCheck if stty returns the same results

stty actually tests stdin, so get_terminal_size is invoked on
stdin explicitly. If stty succeeded, then get_terminal_size()
should work too.
sttyr   T)r  r  zstty invocation failedr   rN  N)r   r  DEVNULLrr  rJ   r  rY  r~   r   r   rJ  r>   	__stdin__r   rK   r?   rL   r  rO  rD   )r5   r   rT   r  r  s   &    r   test_stty_matchTermsizeTests.test_stty_match5  s    	4''V$Z-?-?d%'  QL#d1g,/	))#--*>*>*@AF 	* ":#@#@! 	4MM23	4  	||w&!''ellELL5Q*Q =>	s*   7B# 2C #1CCE %AD;;E r   zWindows specific testc                h    \        RR4      pX;_uu_ 4        \        P                  ! VP                  4       4      pRRR4       V P                  XP                  ^ 4       V P                  VP                  ^ 4       R#   \         d    T P                  R4        Li ; i  + '       g   i     Ll; i)zBCheck if get_terminal_size() returns a meaningful value in Windowszconout$r   zfailed to open conout$N)	r    rK   r~   r   rJ  r   r  rQ  r7  )r5   conoutr   s   &  r   test_windows_fdTermsizeTests.test_windows_fdR  s    	4)S)F V''8D  	a0

A.  	4MM23	4Vs   A? %B!?BB!B1	r,   N)r_   r`   ra   rb   rS  r   r2  rY  r   r   r>   r?   r]  rc   rd   re   s   @r   rL  rL    sS     /.   "+ #+8 02IJ
/ K
/r   rL  memfd_createzrequires os.memfd_createc                   &   a  ] tR tRt o R tRtV tR# )MemfdCreateTestsi`  c                z   \         P                  ! R \         P                  4      pV P                  VR4       V P	                  \         P
                  V4       V P                  \         P                  ! V4      4       \        VRRR7      ;_uu_ 4       pVP                  R4       V P                  VP                  4       ^4       RRR4       \         P                  ! R 4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      4       R#   + '       g   i     Lm; i)Hir  F)closefds   memfd_createNre  )r   r_  MFD_CLOEXECr  r   rs   rW  r^  r    r!   rD   tell)r5   r   rx   r)  s   &   r   test_memfd_create"MemfdCreateTests.test_memfd_createc  s    __T2>>2B#"%++B/0"dE**aGGO$QVVXr* + ood##&++C01 +*s   2D**D:	r,   N)r_   r`   ra   rb   rg  rc   rd   re   s   @r   ra  ra  `  s     2 2r   ra  eventfdzrequires os.eventfdc                   2   a  ] tR tRt o R tR tR tRtV tR# )EventfdTestsiq  c                P   R  p^p^*p\         P                  ! V4      pV P                  VR4       V P                  \         P                  V4       V P                  \         P                  ! V4      4       \         P                  ! WB4      pV P                  WQ! V4      4       \         P                  ! WA! ^4      4       \         P                  ! WB4      pV P                  WQ! ^4      4       \         P                  ! WA! ^(4      4       \         P                  ! WA! ^4      4       \         P                  ! WB4      pV P                  WQ! ^*4      4       \         P                  ! V^4       \         P                  ! V^4       \         P                  ! V4      pV P                  V^4       R# )c                0    \         P                  ! RV 4      # )z$Pack as native uint64_t
            z@Q)structpack)r  s   &r   ro  /EventfdTests.test_eventfd_initval.<locals>.packu  s     ;;tU++r   Nre  )r   ri  r  r   rs   rW  r^  r   rD   r!   eventfd_writeeventfd_read)r5   ro  r   initvalr   ress   &     r   test_eventfd_initval!EventfdTests.test_eventfd_initvalt  s:   	, ZZ B#"%++B/0 ggbd7m,
T"Xggbd2h'
T"X
T!Wggbd2h' 	R 
Qoob!b!r   c                
   ^p\         P                  \         P                  ,          \         P                  ,          p\         P                  ! W4      pV P                  VR4       V P                  \         P                  V4       \         P                  ! V4      pV P                  V^4       \         P                  ! V4      pV P                  V^4       V P                  \        4      ;_uu_ 4        \         P                  ! V4       RRR4       V P                  \        4      ;_uu_ 4        \         P                  ! V^4       RRR4       \         P                  ! V^4       \         P                  ! V4      pV P                  V^4       V P                  \        4      ;_uu_ 4        \         P                  ! V4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)rb  Nre  )r   EFD_CLOEXECEFD_SEMAPHOREEFD_NONBLOCKri  r  r   rs   rr  rD   r   r   r   rq  )r5   rs  r   r   rt  s   &    r   test_eventfd_semaphore#EventfdTests.test_eventfd_semaphore  sH   !1!11BOOCZZ'B#"% oob!a oob!a //OOB 0//GGBN 0 	Qoob!a //OOB 0/ 0/// 0//s$   2G.G*G1G	G.	1H	c                   \         P                  \         P                  ,          p\         P                  ! ^ V4      pV P	                  VR4       V P                  \         P                  V4       \        P                  ! V.V.V.^ 4      w  r4pV P                  W4V3. V.. 34       \         P                  ! V^4       \        P                  ! V.V.V.^ 4      w  r4pV P                  W4V3V.V.. 34       V P                  \         P                  ! V4      ^4       \         P                  ! VR4       \        P                  ! V.V.V.^ 4      w  r4pV P                  W4V3V.. . 34       \         P                  ! V4       R# )r   Nre  l    )r   rx  rz  ri  r  r   rs   selectrD   rq  rr  )r5   r   r   rfdwfdxfds   &     r   test_eventfd_select EventfdTests.test_eventfd_select  sB   0ZZ5!B#"% rdRD2$:##C2tR.9 	R rdRD2$:##CB4"r*:;,b1 	[)rdRD2$:##CB4R.9
r   r,   N)	r_   r`   ra   rb   ru  r{  r  rc   rd   re   s   @r   rk  rk  q  s     "> 4 r   rk  timerfd_createzrequires os.timerfd_creater  z#gh-124873: Test is flaky on Androidc                     a  ] tR tRt o ^t^
]) ,          t^
^	],
          ,          tR tR tR t	R t
]P                  ! ]P                  P                  R4      R4      R 4       tR	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )TimerfdTestsi  c                    \         P                  ! V/ VB pV P                  V^ 4       V P                  \         P                  ! V4      4       V P                  \         P                  V4       V# r   )r   r  r  rW  r^  r   rs   )r5   r   r:  r   s   &*, r   r  TimerfdTests.timerfd_create  sW    //A&++B/0"%	r   c                z    \         P                  ! V^4      p\        P                  V\        P
                  R7      # )rf  )	byteorder)r   r   r   
from_bytesr>   r  )r5   r   r   s   && r   read_count_signaled TimerfdTests.read_count_signaled  s(    wwr1~~~dcmm~<<r   c                D   V P                  \        P                  4      pR pRp\        P                  ! WVR7      w  rEV P                  VRV P                  R7       V P                  VRV P                  R7       \        P                  ! WVR7      w  rEV P                  WSV P                  R7       V P                  WBV P                  R7       \        P                  ! V4      w  rEV P                  WSV P                  R7       V P                  WBV P                  R7       R# )      ?      ?initialintervalr3  placesN)r  r,  CLOCK_REALTIMEr   timerfd_settimers  CLOCK_RES_PLACEStimerfd_gettime)r5   r   initial_expirationr  next_expiration	interval2s   &     r   test_timerfd_initval!TimerfdTests.test_timerfd_initval  s     !4!45! &(%7%7ai%j"y#d6K6KLD<Q<QR &(%7%7ai%j"y4;P;PQ4K`K`a &(%7%7%;"y4;P;PQ4K`K`ar   c                   V P                  \        P                  \        P                  R 7      pRp\        P
                  ! W^ R7       V P                  \        4      ;_uu_ 4       pV P                  V4       RRR4       V P                  XP                  P                  \        P                  4       \        P                  ! VR,           4       V P                  V P                  V4      ^4       R#   + '       g   i     L; i)r  r  r  N)r  r,  r  r   TFD_NONBLOCKr  r   rK   r  rD   r  rL   r  r  )r5   r   r  r  s   &   r   test_timerfd_non_blocking&TimerfdTests.test_timerfd_non_blocking  s      !4!4BOO L !
2AF w''3$$R( (,,ell; 	

%+, 	11"5q9 ('s   'C55D	netbsdzIgh-131263: Skip on NetBSD due to system freeze with negative timer valuesc                   RpV P                  \        P                  4      p^ \        P                  .p\        \        R4      '       d5   VP                  \        P                  \        P                  ,          4       R EF;  w  rEV EF.  pV P                  WdVR7      ;_uu_ 4        V P                  \        4      ;_uu_ 4       p\        P                  ! W&WER7       RRR4       V P                  XP                  P                  \        P                  4       V P                  \        4      ;_uu_ 4       p\!        W,          4      p\!        W,          4      p	\        P"                  ! W&WR7       RRR4       V P                  VP                  P                  \        P                  4       RRR4       EK1  	  EK>  	  R#   + '       g   i     L; i  + '       g   i     Lk; i  + '       g   i     EKr  ; i)r_  TFD_TIMER_CANCEL_ON_SETr   r  r  N ʚ;))re  r   )ra  re  )re  re  )皙r   )ra  r  )r  r  )r  r,  r  r   TFD_TIMER_ABSTIMEr   rn  r  r   r   rK   r  rD   r  rL   r  r   timerfd_settime_ns)
r5   one_sec_in_nsecr   r  r  r  r   context
initial_nsinterval_nss
   &         r   test_timerfd_negative"TimerfdTests.test_timerfd_negative  s^       !4!45--.
2011b22R5O5OOP "dG#\\\RR**733w**2G_ 4$$W%6%6%<%<ellK**733w%(/*C%E
&)?+E&G--bzh 4 $$W%6%6%<%<ellK SR $ "d 43 43 SRRs=   'G(	GAG(	7;G2<G(	GG(	G% G(	(G:c                   V P                  \        P                  4      p^pRp\        P                  ! WVR7       \        P
                  ! V4      w  rEV P                  WSV P                  R7       V P                  WBV P                  R7       ^p\        P                  ! 4       p\        V4       F$  pV P                  V P                  V4      ^4       K&  	  \        P                  ! 4       V,
          pW#V^,
          ,          ,           p	V P                  WyV P                  ,
          4       \        P                  ! VR,           V,          4       V P                  V P                  V4      V4       R# )ra        ?r  r  N)r  r,  r  r   r  r  rs  r  perf_counterr  rD   r  r  	CLOCK_RESr  )
r5   r   r  r  r  r  rz  tr  
total_times
   &         r   test_timerfd_interval"TimerfdTests.test_timerfd_interval  s%     !4!45 
2HM &(%7%7%;"y4;P;PQ4K`K`auAT55b91= !#'eai*@@
14>>9: 	

U3Y(*+11"5u=r   c                   V P                  \        P                  4      p\        P                  ! \        P                  4      p^pW#,           p^ p\        P
                  ! V\        P                  WER7       \        P                  ! V4      w  rgV P                  WuV P                  R7       V P                  WcV P                  R7       \        P                  ! 4       pV P                  V4      p	\        P                  ! 4       V,
          pV P                  V	^4       V P                  WV P                  ,
          4       R# )ra  r  r  N)r  r,  r  clock_gettimer   r  r  r  rs  r  r  r  rD   r  r  )
r5   r   r?  r  r  r  r  r  r  count_signaleds
   &         r   test_timerfd_TFD_TIMER_ABSTIME+TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME4  s      !4!45  !4!45  \
2R%9%9CUi &(%7%7%;"y4;P;PQt?T?TU11"5!#+1t~~56r   c                   V P                  \        P                  \        P                  R 7      p\
        P
                  ! V.V.V.^ 4      w  r#pV P                  W#V3. . . 34       RpRp\        P                  ! WVR7       ^p\        P                  ! 4       p\        V4       Fa  p	\
        P
                  ! V.V.V.WV,           4      w  r#pV P                  W#V3V.. . 34       V P                  V P                  V4      ^4       Kc  	  \        P                  ! 4       V,
          pWVV^,
          ,          ,           p
V P                  WV P                  ,
          4       R# )r  r  r  r  N)r  r,  r  r   r  r~  rD   r  r  r  r  r  r  )r5   r   r  r  r  r  r  rz  r  r  r  s   &          r   test_timerfd_select TimerfdTests.test_timerfd_selectN  s-     !4!4BOO LrdRD2$:##C2r2,7 "
2HMuA"MM2$rd<N<YZMCcc_tRn=T55b91=  !#'eai*@@
14>>9:r   c                   V P                  \        P                  \        P                  R 7      p\
        P                  ! 4       pVP                  V\
        P                  4       V P                  VP                  4       RpV^,          pV^,          pV'       d   \        P                  ! VVVR7       M%\        P                  ! VWT,          Wd,          R7       ^pV'       d   \        P                  ! 4       pM\        P                  ! 4       p\        V4       F  p	Tp
V	^ 8X  d   WV,           V
,           pMWj,           pVP!                  W,          4      pV P#                  \%        V4      ^V4       V^ ,          ^,          pV P#                  V\
        P                  4       V P#                  V P'                  V4      ^4       K  	  WVV^,
          ,          ,           pV'       d@   \        P                  ! 4       V,
          pV P)                  WV P*                  ,
          4       ME\        P                  ! 4       V,
          pV P)                  WV,          V P,                  ,
          4       VP/                  V4       R# )r  r  Nr  )r  r,  r  r   r  	selectorsDefaultSelectorregister
EVENT_READr   rs   r  r  perf_counter_nsr  r  r~  rD   r@   r  r  CLOCK_RES_NSr  
unregister)r5   nanosecondsr   selectorsec_to_nsecinitial_expiration_nsr  rz  r  r  timeout_margin_ns
timeout_nsreadyr  r  dts   &&              r   check_timerfd_pollTimerfdTests.check_timerfd_pollf  s     !4!4BOO L,,."i223' +q 0!Q&!!"*?+68 r'<'J(3(AC $$&A!!#AuA +Av2@CTT
(<
OOJ$<=ESZE2!HQKEUI$8$89T55b91=  +EAI-FF
%%'!+Br0A0A#AB""$q(Br#;dnn#LMBr   c                (    V P                  R 4       R# r  r  rm   s   &r   test_timerfd_pollTimerfdTests.test_timerfd_poll  s    &r   c                (    V P                  R 4       R# r]  r  rm   s   &r   test_timerfd_ns_poll!TimerfdTests.test_timerfd_ns_poll  s    %r   c                   RpVR,          pV P                  \        P                  4      p^ pVR,          p\        P                  ! W4VR7      w  rgV P                  V^ 4       V P                  V^ 4       \        P                  ! W4VR7      w  rgV P                  Wu4       V P                  Wd4       \        P                  ! V4      w  rgV P                  Wu4       V P                  Wd4       V P                  WdVR7       R# )r_  r;   r  r[  Nr  )	r  r,  r  r   r  rD   timerfd_gettime_nsr  rs  )r5   r  limit_errorr   r  r  next_expiration_nsinterval_ns2s   &       r   test_timerfd_ns_initval$TimerfdTests.test_timerfd_ns_initval  s    %.  !4!45 !"%-,.,A,A"ny,z(q)+Q/ ,.+@+@mx+y(3+C ,.+@+@+D(3/G1P[\r   c                   RpVR,          pV P                  \        P                  4      pTpV^,          p\        P                  ! W4VR7       \        P
                  ! V4      w  rgV P                  Wu4       V P                  Wd4       ^p\        P                  ! 4       p	\        V4       F$  p
V P                  V P                  V4      ^4       K&  	  \        P                  ! 4       V	,
          p	WEV^,
          ,          ,           pV P                  WV P                  ,
          4       \        P                  ! VR,           V,          V,          4       V P                  V P                  V4      V4       R# )r_  r  r  Nr  r;   )r  r,  r  r   r  r  rD   r  r  r  r  r  r  r  )r5   r  r  r   r  r  r  r  rz  r  r  total_time_nss   &           r   test_timerfd_ns_interval%TimerfdTests.test_timerfd_ns_interval  s,   %.  !4!45 !0%*
b+V ,.+@+@+D(3/G  "uAT55b91=   "Q&-uqy0II1d.?.??@ 	

U3Y+-?@11"5u=r   c                   RpVR,          pV P                  \        P                  4      p\        P                  ! \        P                  4      pTpWE,           p^ p\        P
                  ! V\        P                  WgR7       \        P                  ! V4      w  rV P                  \        W,
          4      V4       V P                  \        W,
          4      V4       \        P                  ! 4       p
V P                  V4      p\        P                  ! 4       V
,
          p
V P                  V^4       V P                  WV P                  ,
          4       R# )r_  r  Nr  r;   )r  r,  r  clock_gettime_nsr   r  r  r  
assertLessabsr  r  rD   r  r  )r5   r  r  r   now_ns	offset_nsr  r  r  r  r  r  s   &           r   !test_timerfd_ns_TFD_TIMER_ABSTIME.TimerfdTests.test_timerfd_ns_TFD_TIMER_ABSTIME  s   %.  !4!45&&t':':; $	 & 2
b(<(<F[r ,.+@+@+D(L67+F.:;kJ  "11"5  "Q&+1$*;*;;<r   c                   RpV P                  \        P                  \        P                  R7      p\
        P
                  ! V.V.V.^ 4      w  r4pV P                  W4V3. . . 34       V^,          pV^,          p\        P                  ! W&VR7       ^p\        P                  ! 4       p	\        V4       Fh  p
\
        P
                  ! V.V.V.Wg,           R,          4      w  r4pV P                  W4V3V.. . 34       V P                  V P                  V4      ^4       Kj  	  \        P                  ! 4       V	,
          p	WgV^,
          ,          ,           pV P                  WV P                  ,
          4       R# )r_  r  r  g    eANr  )r  r,  r  r   r  r~  rD   r  r  r  r  r  r  )r5   r  r   r  r  r  r  r  rz  r  r  r  s   &           r   test_timerfd_ns_select#TimerfdTests.test_timerfd_ns_select  sD     !4!4BOO LrdRD2$:##C2r2,7 !01 4%*
b+V  "uA"MM2$rd=R=`dg<giMCcc_tRn=T55b91=    "Q&-uqy0II1d.?.??@r   r,   N)r_   r`   ra   rb   r  r  r  r  r  r  r  r   rD  r>   r?   r3  r  r  r  r  r  r  r  r  r  r  r  rc   rd   re   s   @r   r  r    s     
 '''I!../L=
b*:$ __S\\,,X623L3L,>874;00 d'&]0>>=8A Ar   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )OSErrorTestsi  c                &    ! R  R\         4      p. V n        . V n        \        P                  e   \        P                  pM\        P
                  pV P                  P                  V4       V P                  P                  V! V4      4       \        P                  e   \        P                  pM$\        P                  ! \        P
                  4      pV P                  P                  V4       V P                  V P                  ,           V n
        R# )c                       ] tR tRtRtR# )OSErrorTests.setUp.<locals>.Stri  r,   Nr_   r`   ra   rb   rc   r,   r   r   Strr        r   r  N)r3   bytes_filenamesunicode_filenamesr   r  rk   rn  TESTFN_UNDECODABLEr   r  r  )r5   r  decodedencodeds   &   r   rn   OSErrorTests.setUp  s    	# 	  "!#''322G&&G%%g.%%c'l3''322Gkk)"2"23G##G,--0F0FFr   c                p	   V P                   \        P                  3V P                   \        P                  3V P                   \        P                  \        P
                  3V P                   \        P                  3V P                   \        P                  3V P                   \        P                  3V P                   \        P                  3V P                   \        P                  R 3V P                   \        P                  R 3.	p\        P                  ! 4       '       d-   VP                  V P                   \        P                  R34       \!        \        R4      '       d.   VP                  V P                   \        P"                  ^ ^ 34       \!        \        R4      '       d.   VP                  V P                   \        P$                  ^ ^ 34       \!        \        R4      '       d-   VP                  V P                   \        P&                  ^ 34       \!        \        R4      '       d-   VP                  V P                   \        P(                  ^ 34       \!        \        R4      '       d-   VP                  V P                   \        P*                  ^ 34       \!        \        R4      '       d,   VP                  V P                   \        P,                  34       \!        \        R4      '       d-   VP                  V P                   \        P.                  R 34       \!        \        R	4      '       d   VP1                  V P                   \        P2                  3V P                   \        P4                  R
3V P                   \        P6                  R
R3V P                   \        P8                  R
334       \!        \        R4      '       d-   VP                  V P                   \        P:                  R34       \!        \        R4      '       d,   VP                  V P                   \        P<                  34       V F-  vr#pV F"  p V! V.VO5!   V P?                  RV 24       K$  	  K/  	  R#   \@         d2   pT PC                  TPD                  T\G        T4      4        Rp?Kc  Rp?i\H         d     Kt  i ; i)r   r   r!  lchownrC  chflagslchflagschrootrE  r+  r!  s   userlchmodrL  zNo exception thrown by N)%r  r   rI   r  r    r   r  r   rl   rW  r   r   r   	can_chmodrn  rV  r   r!  r 	  rC  r	  r	  r	  rE  r  r+  r)  r  r*  r	  rL  rw  rK   r  r"   r3   UnicodeDecodeError)r5   funcsr  func	func_argsr   r  s   &      r   test_oserror_filename"OSErrorTests.test_oserror_filename   s   ^^RXX'^^RXX'^^RWWbkk2^^RXX'^^RWW&^^RYY(^^RZZ)^^RYY.^^RZZ/

   LL$.."((E:;2wLL$.."((Aq9:2x  LL$.."))Q:;2z""LL$.."++q9:2y!!LL$.."**a892z""LL$.."++q9:2x  LL$.."))562vLL$.."''59:2{##LL/k:k7C=	  2x  LL$.."))U;<2z""LL$.."++78+0'Ii!@*	* II 7v>? " ,1  AMM#,,c$i@@) s$   
Q,,R57&R##R50R54R5)r  r  r  N)r_   r`   ra   rb   rn   r
	  rc   rd   re   s   @r   r  r    s     G(1@ 1@r   r  c                   r   a  ] tR tRt o R tR tR t]P                  ! ]	! ]
R4      R4      R 4       tRtV tR	# )
CPUCountTestsiS  c                    Vf   V P                  R4       V P                  V\        4       V P                  V^ 4       R # )N&Could not determine the number of CPUs)r~   r2   r   r  r5   cpuss   &&r   check_cpu_countCPUCountTests.check_cpu_countT  s4    <MMBCdC(4#r   c                R    \         P                  ! 4       pV P                  V4       R # r(   )r   	cpu_countr	  r	  s   & r   test_cpu_countCPUCountTests.test_cpu_count[  s    ||~T"r   c                    \         P                  ! 4       pV P                  V\         P                  ! 4       4       V P	                  V4       R # r(   )r   process_cpu_countr  r	  r	  r	  s   & r   test_process_cpu_count$CPUCountTests.test_process_cpu_count_  s4    ##%T2<<>2T"r   sched_setaffinityz!don't have sched affinity supportc                   \         P                  ! 4       pVf   V P                  R4       \         P                  ! ^ 4      p\	        V4      ^8:  d   V P                  R\        V4       24       V P                  \         P                  ^ \        V4      4       VP                  4        \         P                  ! ^ V4       \         P                  ! 4       pV P                  W1^,
          4       R # )Nr	  z.sched_getaffinity() returns less than 2 CPUs: )r   r	  r~   sched_getaffinityr@   r  r   r	  rf  r  rD   )r5   	affinity1mask	affinity2s   &   r   test_process_cpu_count_affinity-CPUCountTests.test_process_cpu_count_affinityd  s     ((*	MMBC ##A&t9>MM %%+D\N4 5,,ad<

Q% ((*	M2r   r,   N)r_   r`   ra   rb   r	  r	  r	  r   r   r   r   r"	  rc   rd   re   s   @r   r	  r	  S  s@     $##
 %89<>3>3r   r	  c                     a  ] tR tRt o R t]P                  ! ]RJ R4      R 4       t]P                  ! ]RJ R4      R 4       t	]P                  ! ]! ]R4      R4      R	 4       tR
 tR t]P                  ! ]! ]R4      R4      R 4       tR tR t]P                  ! ]P(                  R8H  R4      R 4       t]P                  ! ]! ]R4      R4      R 4       tRtV tR# )FDInheritanceTestsiz  c                ^   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      R 4       \         P                  ! VR4       V P                  \         P                  ! V4      R4       R# FTN)	r   r    r   r   r   rs   rD   r^  r_  r   s   & r   test_get_set_inheritable+FDInheritanceTests.test_get_set_inheritable|  sn    WWXr{{+"%++B/7
2t$++B/6r   Nz
need fcntlc                   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      R 4       \        P                  ! V\        P                  4      pV\        P                  ( ,          p\        P                  ! V\        P                  V4       V P                  \         P                  ! V4      R4       R# r'	  )r   r    r   r   r   rs   rD   r^  fcntlF_GETFD
FD_CLOEXECF_SETFD)r5   r   r   s   &  r   test_get_inheritable_cloexec/FDInheritanceTests.test_get_inheritable_cloexec  s    WWXr{{+"%++B/7 B.%""""Bu-++B/6r   c                
   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \        P                  ! V\        P                  4      \        P                  ,          \        P                  4       \         P                  ! VR 4       V P                  \        P                  ! V\        P                  4      \        P                  ,          ^ 4       R# r]  )r   r    r   r   r   rs   rD   r+	  r,	  r-	  r_  r   s   & r   test_set_inheritable_cloexec/FDInheritanceTests.test_set_inheritable_cloexec  s    WWXr{{+"%R7%:J:JJ))	+ 	2t$R7%:J:JJ	r   O_PATHzneed os.O_PATHc                   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      R 4       \         P                  ! VR4       V P                  \         P                  ! V4      R4       \         P                  ! VR 4       V P                  \         P                  ! V4      R 4       R# r'	  )	r   r    r   r4	  r   rs   rD   r^  r_  r   s   & r   test_get_set_inheritable_o_path2FDInheritanceTests.test_get_set_inheritable_o_path  s    WWXryy)"%++B/7
2t$++B/6
2u%++B/7r   c                H   \         P                  ! 4       pV P                  \        4      ;_uu_ 4       p\        P
                  ! V4       R R R 4       V P                  XP                  P                  \        P                  4       V P                  \        4      ;_uu_ 4       p\        P                  ! VR4       R R R 4       V P                  VP                  P                  \        P                  4       V P                  \        4      ;_uu_ 4       p\        P                  ! VR4       R R R 4       V P                  VP                  P                  \        P                  4       R #   + '       g   i     EL); i  + '       g   i     L; i  + '       g   i     Lm; i)NTF)r   r  r   rK   r   r^  rD   r  rL   r  r_  )r5   r   r  s   &  r   test_get_set_inheritable_badf0FDInheritanceTests.test_get_set_inheritable_badf  s    ""$w''3r" (,,ekk:w''3r4( (,,ekk:w''3r5) (,,ekk: ('' (' ('s#   E*#E>F*E;	>F	F!	c                    \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      R 4       R# r  )r   r    r   r   r   rs   rD   r^  r   s   & r   r  FDInheritanceTests.test_open  sC    WWXr{{+"%++B/7r   r   zneed os.pipe()c                L   \         P                  ! 4       w  rV P                  \         P                  V4       V P                  \         P                  V4       V P	                  \         P
                  ! V4      R 4       V P	                  \         P
                  ! V4      R 4       R# r  )r   r   r   rs   rD   r^  )r5   r  r  s   &  r   	test_pipeFDInheritanceTests.test_pipe  si    779#&#&++C0%8++C0%8r   c                P   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       \         P                  ! V4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      R 4       R# r  )	r   r    r   r   r   rs   r}   rD   r^  r5   fd1r)  s   &  r   test_dupFDInheritanceTests.test_dup  sb    ggh,#&ffSk#&++C0%8r   c                    \         P                  ! ^4      pV P                  \         P                  V4       V P	                  V^ 4       R# r  )r   r}   r   rs   r  r   s   & r   test_dup_standard_stream+FDInheritanceTests.test_dup_standard_stream  s1    VVAY"%2q!r   r   r6  c                F   \         P                  ! R \         P                  4      pV P                  \         P                  V4       \         P
                  ! V4      pV P                  \         P                  V4       V P                  \         P                  ! V4      4       R# )NULN)r   r    r   r   rs   r}   rW  r^  rA	  s   &  r   test_dup_nulFDInheritanceTests.test_dup_nul  sb     ggeR[[)#&ffSk#&++C01r   r#  zneed os.dup2()c                   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! W4      V4       V P                  \         P                  ! V4      4       \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! WR R7      V4       V P                  \         P                  ! V4      4       R# )F)inheritableN)r   r    r   r   r   rs   rD   r#  rt   r^  rW  )r5   r   r)  fd3s   &   r   r&  FDInheritanceTests.test_dup2  s    WWXr{{+"% ggh,#&)3/**3/0 ggh,#&e<cB++C01r   r,   )r_   r`   ra   rb   r(	  r   rD  r+	  r/	  r2	  r   r   r   r6	  r9	  r  r>	  rC	  rF	  r>   r?   rJ	  r&  rc   rd   re   s   @r   r%	  r%	  z  s    7 __Ud]L1
7 2
7 __Ud]L1 2 X.0@A	8 B	8;8
 V,.>?9 @99"
 02GH2 I2 V,.>?2 @2r   r%	  openptyzneed os.openpty()c                     a  ] tR tRt o R tR t]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R	4      R
 4       4       4       t
]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R4      ]P                  ! ]! ]	R4      R	4      R 4       4       4       4       4       4       t]P                  ! ]! ]	R4      R4      ]P                  ! 4       R 4       4       tRtV tR# )PseudoterminalTestsi  c                    \         P                  ! 4       w  rV P                  \         P                  V4       V P                  \         P                  V4       W3# )z/Open a pty fd-pair, and schedule cleanup for it)r   rP	  r   rs   r5   main_fd	second_fds   &  r   open_ptyPseudoterminalTests.open_pty  s=    ZZ\'*),!!r   c                    V P                  4       w  rV P                  \        P                  ! V4      R 4       V P                  \        P                  ! V4      R 4       R# r  )rW	  rD   r   r^  rT	  s   &  r   test_openpty PseudoterminalTests.test_openpty  sF    !]]_++G4e<++I6>r   ptsnamezneed os.ptsname()rr   zneed os.O_RDWRO_NOCTTYzneed os.O_NOCTTYc                   V P                  4       w  r\        P                  ! V4      p\        P                  ! V\        P                  \        P
                  ,          4      pV P                  \        P                  V4       \        P                  ! VR 4       V P                  \        P                  ! V^4      R 4       R# )r"  N)rW	  r   r\	  r    rr   r]	  r   rs   r!   rD   r   )r5   rU	  rV	  second_pathreopened_second_fds   &    r   test_open_via_ptsname)PseudoterminalTests.test_open_via_ptsname  s{     "]]_jj)WW["))BKK2GH"45
#V,!,f5r   posix_openptzneed os.posix_openpt()grantptzneed os.grantpt()unlockptzneed os.unlockpt()c                d   \         P                  ! \         P                  \         P                  ,          4      pV P	                  \         P
                  V4       \         P                  ! V4       \         P                  ! V4       \         P                  ! V4      p\         P                  ! V\         P                  \         P                  ,          4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      \         P                  ! V4      4       R # r(   )r   rc	  rr   r]	  r   rs   rd	  re	  r\	  r    rD   rg  )r5   	mother_fdson_pathson_fds   &   r   test_posix_pty_functions,PseudoterminalTests.test_posix_pty_functions  s     OOBIIbkk$9:	),


9
I::i(299R[[#89&)I.

60BCr   rV  zneed os.spawnl()c                   \         P                  ! 4       w  rV P                  \         P                  V4       V P                  \         P                  V4       \        P
                  ! R V R24      p\        P                  pV P                  \        P                  \        P                  4       \        VR4      ;_uu_ 4       p\        W5RR7       RRR4       \        P                  pWd.p\         P                  R8X  d   RV^ ,          9   d   RV^ ,           R2V^ &   \         P                  ! \         P                  V.VO5!  pV P!                  V^ 4       R#   + '       g   i     L; i)	z
            import errno
            import os
            import test.support
            try:
                import msvcrt
            except ImportError:
                msvcrt = None

            fd = aA  

            with test.support.SuppressCrashReport():
                if msvcrt is not None:
                    try:
                        handle = msvcrt.get_osfhandle(fd)
                    except OSError as exc:
                        if exc.errno != errno.EBADF:
                            raise
                        # get_osfhandle(fd) failed with EBADF as expected
                    else:
                        raise Exception("get_osfhandle() must fail")

                try:
                    fd3 = os.dup(fd)
                except OSError as exc:
                    if exc.errno != errno.EBADF:
                        raise
                    # os.dup(fd) failed with EBADF as expected
                else:
                    os.close(fd3)
                    raise Exception("dup must fail")
        r   rE  )rs  endNr  r  r   )r   r   r   rs   r  r  r   rk   rl   r    rO   r>   r   r   rV  rX  rD   )	r5   r   r)  r   r"   r$   r   r  r%  s	   &        r   test_pipe_spawnl$PseudoterminalTests.test_pipe_spawnl  s    '')"%#& 	$  	  B ##	(()*:*:;(C  B$R( ! ^^
$77d?sc!f}Q]CF99RYY
9S91% ! s   EE+	r,   N)r_   r`   ra   rb   rW	  rZ	  r   r   r   r   ra	  rj	  r   r2  rn	  rc   rd   re   s   @r   rR	  rR	    sr    "?
 Y/1DEX.0@AZ02DE6 F B F6 ^46NOY/1DEZ02FGY/1DEX.0@AZ02DED F B F H F PD X.0BC  "7& # D7&r   rR	  c                      a  ] tR tRt o R
RRR]P
                  3R3RRRR]P                  3]! ]RR4      3.tR t	R t
R	tV tR# )PathTConverterTestsiP  NFru   r    rs   c                
   \         P                  p\        P                  R 8X  d   R;r#M/\        P                  ! \         P                  4      p\        V4      p\        P                  ! \        V4      \        P                  \        P                  ,          4      pV P                  \         P                  \         P                  4       V P                  \        P                  V4       \        V4      p\        V4      pV P                   EF  w  rxrV P                  VR7      ;_uu_ 4         \        \        V4      pYTT3 FB  pTf   K	  T P                  Y|R7      ;_uu_ 4        T! T.T	O5!  pT
e	   T
! T4       RRR4       KD  	  T P!                  \"        R4      ;_uu_ 4        T! T.T	O5!   RRR4       T'       d   T! T.T	O5!  pT
e	   T
! T4       M1T P!                  \"        R4      ;_uu_ 4        T! T.T	O5!   RRR4       RRR4       EK
  	  R#   \         d     RRR4       EK%  i ; i  + '       g   i     EK  ; i  + '       g   i     L; i  + '       g   i     Lb; i  + '       g   i     EKv  ; i)r  Nr   )r   rE   zto return str or byteszos.PathLike)r   rk   r   r   r  r   r    r   rq   r   rl   rs   	functionsr   rq  rv  assertRaisesRegexr   )r5   str_filenamebytes_fspathbytes_filenamer   
int_fspath
str_fspathr   allow_fd
extra_args
cleanup_fnr  rE   r}  s   &             r   test_path_t_converter)PathTConverterTests.test_path_t_converter\  s    ''77d?,00L>[[)9)9:N#N3LWWXl+R[[-CD	(()*:*:;"%b\
l+
6:nn2DJ4(( T*B *:)+D| 4;;!#D!6:!6%1&v. <;	+ ++!#;= =z/J/= 0Z0F!-"6*//%)+ + 2+
++1 )( 7E & 	 )( <;;
= =+ +1 )((s~   -I0/H?(I0'H5>*I0(I
3I05I08II0H2	%I01H2	2I05I 
I0
II0I-(I00Jc                \   R pV P                  \        VR,          4      ;_uu_ 4        \        P                  ! \	        ^4      4       RRR4       V P                  \        VR,          4      ;_uu_ 4        \        P                  ! \	        R4      4       RRR4       V P                  \        VR,          4      ;_uu_ 4        \        P                  ! \	        \        4       4      4       RRR4       R#   + '       g   i     L; i  + '       g   i     Lz; i  + '       g   i     R# ; i)z-__fspath__\(\) to return str or bytes, not %sr   NfloatgQ@object)rt	  r   r   r   r   r	  )r5   r+  s   & r   &test_path_t_converter_and_custom_class:PathTConverterTests.test_path_t_converter_and_custom_class  s    >##IsV|<<GGHQK  =##IsX~>>GGHTN# ?##IsY??GGHVX&' @?	 =<>>???s#    C45 D(D4D	D	D+	r,   )r   Tr,   N)r  Fr,   N)r	  Fr  N)r	  Fr  N)r_   r`   ra   rb   r   F_OKr   rq  rs	  r}	  r	  rc   rd   re   s   @r   rq	  rq	  P  sW      	!"	5277*d+&'	GT(BCI*,X( (r   rq	  r   r   zCannot unset blocking flagz'Windows only supports blocking on pipesc                   &   a  ] tR tRt o R tRtV tR# )BlockingTestsi  c                   \         P                  ! \        \         P                  4      pV P	                  \         P
                  V4       V P                  \         P                  ! V4      R 4       \         P                  ! VR4       V P                  \         P                  ! V4      R4       \         P                  ! VR 4       V P                  \         P                  ! V4      R 4       R# )TFN)	r   r    r   r   r   rs   rD   r   r   r   s   & r   rc  BlockingTests.test_blocking  s    WWXr{{+"%,d3
E",e4
D!,d3r   r,   N)r_   r`   ra   rb   rc  rc   rd   re   s   @r   r	  r	    s     
	4 	4r   r	  c                   &   a  ] tR tRt o R tRtV tR# )ExportsTestsi  c                    V P                  R \        P                  4       V P                  R\        P                  4       R# )r    r8  N)r  r   __all__rm   s   &r   test_os_allExportsTests.test_os_all  s&    fbjj)fbjj)r   r,   N)r_   r`   ra   rb   r	  rc   rd   re   s   @r   r	  r	    s     * *r   r	  c                   2   a  ] tR tRt o R tR tR tRtV tR# )TestDirEntryi  c                    \         P                  P                  \        P                  4      V n        V P                  \        P                  V P                  4       \         P                  ! V P                  4       R # r(   )r   rE   realpathr   rk   r   r  rH   rm   s   &r   rn   TestDirEntry.setUp  sF    GG$$Y%5%56		(($))4
r   c                N    V P                  \        \        P                  4       R # r(   )r   r   r   DirEntryrm   s   &r   test_uninstantiable TestDirEntry.test_uninstantiable  s    )R[[1r   c                   \        \        P                  P                  V P                  R 4      R4      p\        P                  ! V P                  4       Uu. uF  q"NK  	  upP                  4       pV P                  V\        P                  4       V P                  VP                  R 4       ^ RI
pV P                  \        VP                  W!4       R# u upi )r]     pythonN)r%   r   rE   rG   scandirr  r2   r	  rD   r   r  r   r   r  )r5   r"   entryr  s   &   r   test_unpickableTestDirEntry.test_unpickable  s    rww||DIIzBIN$&JJtyy$9:$95$9:>>@eR[[1Z0)V\\5C	 ;s   
C)rE   N)	r_   r`   ra   rb   rn   r	  r	  rc   rd   re   s   @r   r	  r	    s     
2D Dr   r	  c                     a  ] tR tRt o ]P
                  tR tR%R ltR tR t	R t
R tR tR	 t]P                  ! ]P"                  R
8g  R4      R 4       tR tR%R ltR tR tR tR tR tR tR tR tR t]P<                  ! ]P@                  ]PB                  9   R4      R 4       t"]P                  ! ]#PH                  R4      R 4       t%R t&R t'R t(R t)R  t*R! t+R" t,R#t-V t.R$# )&TestScandiri  c                H   \         P                  P                  \        P                  4      V n        \         P
                  ! V P                  4      V n        V P                  \        P                  V P                  4       \         P                  ! V P                  4       R # r(   )
r   rE   r	  r   rk   r  
bytes_pathr   r  rH   rm   s   &r   rn   TestScandir.setUp  sZ    GG$$Y%5%56	++dii0	(($))4
r   c                    \        V\        4      '       d   V P                  MV P                  p\        P                  P                  W!4      p\        VR 4       V# )r	  )r  r[   r	  rE   r   rG   r%   )r5   r   rE   r"   s   &&  r   r%   TestScandir.create_file  s>    ",T5"9"9ttyy77<<+Hi(r   c                    \        R  \        P                  ! V P                  4       4       4      pV P	                  \        VP                  4       4      V4       V# )c              3   >   "   T F  pVP                   V3x  K  	  R # 5ir(   r   r  r	  s   & r   r  *TestScandir.get_entries.<locals>.<genexpr>  s       ;$95 

E*$9s   )rp  r   r	  rE   rD   r  keys)r5   namesentriess   && r   get_entriesTestScandir.get_entries  sF     ;$&JJtyy$9; ;/7r   c                    V'       d^   \        V4       FL  pVP                  R 4      '       g   K  VR9   d   K%  V P                  \        W4      \        W$4      WV34       KN  	  R# V P                  W4       R# )st_N)r  r  st_nlinkr  st_ctime_ns)rn  r3  rD   rq  )r5   r  r  skip_fieldsr  s   &&&& r   assert_stat_equalTestScandir.assert_stat_equal  sj    E
u-- + +  !5!(!5"'!57 # U*r   c                    \         P                  ! V P                  4      pV P                  \        \        V4      4       VP                  4        R # r(   )r   r	  rE   r   r   r   rs   )r5   scandir_iters   & r   r	  TestScandir.test_uninstantiable  s5    zz$)),)T,%78r   c                    V P                  R 4      p\        P                  ! V P                  4      p^ RIpV P                  \        VP                  W!4       VP                  4        R# r]  N)	r%   r   r	  rE   r  r   r   r  rs   )r5   r"   r	  r  s   &   r   r	  TestScandir.test_unpickable  sI    ##J/zz$)),)V\\<Jr   c                   V P                  V\        P                  4       V P                  VP                  V4       V P                  VP
                  \        P
                  P                  V P
                  V4      4       V P                  VP                  4       \        P                  ! VP
                  R R7      P                  4       \        P                  ! VP
                  4      pV P                  VP                  4       \        P                  ! VP                  4      4       V P                  VP                  4       \        P                  ! VP                  4      4       V P                  VP                  4       \        P
                  P!                  VP
                  4      4       \        P                  ! VP
                  R R7      pV P                  VP                  R R7      \        P                  ! VP                  4      4       V P                  VP                  R R7      \        P                  ! VP                  4      4       V P                  VP#                  4       \        P
                  P%                  VP
                  4      4       T P'                  VP                  4       T\        P                  R8H  ;'       d    V'       * 4       V P'                  VP                  R R7      V\        P                  R8H  4       R# )FrW  r  N)r2   r   r	  rD   r   rE   rG   inoder   r  is_dirS_ISDIRry  is_fileS_ISREG
is_symlinkr{  is_junction
isjunctionr	  )r5   r	  r   r	  r	  r	  
entry_statentry_lstats   &&&&&&  r   check_entryTestScandir.check_entry  s	   eR[[1T*RWW\\$))T%BCUCJJ	L WWUZZ(
j&8&89	;j&8&89	;))+

3	5 ggejj%@e<k&9&9:	<u=k&9&9:	< 	**,bgg.@.@.LMuzz|)!ww$AAz>	C 	uzz%z@*!ww$	0r   c                   \         P                  ! 4       p\         P                  ! 4       p\        P                  P                  V P                  R 4      p\        P                  ! V4       V P                  R4      pV'       dA    \        P                  ! V\        P                  P                  V P                  R4      4       V'       d   \        P                  ! V\        P                  P                  V P                  R4      RR7       \        P                  ! V\        P                  P                  V P                  R4      4       R R.pV'       d   VP                  R4       V'       d   VP                  R
4       V P                  V4      pVR ,          pV P                  VR RR	R	4       VR,          pV P                  VRR	RR	4       V'       d   VR,          pV P                  VRR	RR	4       V'       d?   VR,          pV P                  VRRR	R4       VR,          pV P                  VRR	RR4       R# R#   \         d$   pT P                  RT,          4        Rp?ELRp?ii ; i)rn  r]  zlink_file.txtrv  Nsymlink_dirT)r   symlink_file.txtF)r	  r	  )r   can_hardlinkrT  r   rE   rG   rH   r%   rE  rY  r~   r   rn  r  r	  r	  )	r5   rE  r   rR   r"   r  r	  r	  r	  s	   &        r   test_attributesTestScandir.test_attributes	  s   %%''')'',,tyy%0
##J/3"'',,tyy/"JK JJwTYY F+/1JJxdii9K!LM
#LL)LL<=""5)tUE:
#
E4?O,EUOUD%HM*EUM4E./EU$6tTJ 1 # 3o1223s   ?H= =I+I&&I+r   z/Can only test junctions with creation on win32.c                   \         P                  P                  V P                  R 4      p\         P                  ! V4       ^ RIp VP
                  ! V\         P                  P                  V P                  R4      4       T P                  RR .4      pT P                  TR,          P                  4       R4       T P                  TR ,          P                  4       R4       R#   \         d    \        P                  ! R4      hi ; i)tgtdirNsrcjuncz!creating the test junction failedTF)r   rE   rG   rH   r  r  rK   r   r  r	  rD   r	  )r5   rR   r  r	  s   &   r   test_attributes_junctions%TestScandir.test_attributes_junctions2  s    '',,tyy(3
	I""7BGGLLI,NO ""Ix#89+7794@*668%@  	I##$GHH	Is   ;C$ $"Dc                    \        V\        4      '       d   V P                  MV P                  p\	        \
        P                  ! V4      4      pV P                  \        V4      ^4       V^ ,          pV P                  VP                  V4       V# r  )
r  r[   r	  rE   rf  r   r	  rD   r@   r   )r5   r   rE   r	  r	  s   &&   r   	get_entryTestScandir.get_entryA  sf    ",T5"9"9ttyyrzz$'(Wq)
T*r   c                    V P                  VR 7      pV P                  \        P                  P	                  V4      4      # )r   )r%   r	  r   rE   basename)r5   r   r"   s   && r   create_file_entryTestScandir.create_file_entryJ  s3    ###.~~bgg..x899r   c                   V P                  4       p\        P                  ! 4       p \        P                  ! V P                  4       \        R  \        P                  ! 4        4       4      pV P                  \        VP                  4       4      \        P                  P                  V4      .4       \        P                  ! V4       R#   \        P                  ! T4       i ; i)c              3   <   "   T F  qP                   V3x  K  	  R # 5ir(   r   r	  s   & r   r  5TestScandir.test_current_directory.<locals>.<genexpr>V  s     IL5JJ.Ls   N)r%   r   r1   rI   rE   rp  r	  rD   r  r	  r	  )r5   r"   old_dirr	  s   &   r   test_current_directory"TestScandir.test_current_directoryN  s    ##%))+		HHTYY IBJJLIIGVGLLN3 gg..x89; HHWBHHWs   BC C#c                \    V P                  4       pV P                  \        V4      R 4       R# )z<DirEntry 'file.txt'>N)r	  rD   r  r5   r	  s   & r   	test_reprTestScandir.test_repr\  s%    &&(e&=>r   c                    V P                  4       pV P                  \        P                  ! V4      \        P                  P                  V P                  R 4      4       R# r	  )r	  rD   r   fspathrE   rG   r	  s   & r   test_fspath_protocol TestScandir.test_fspath_protocol`  s<    &&(5)277<<		:+NOr   c                J   \         P                  ! R 4      pV P                  VR7      p\         P                  ! V4      pV P	                  V\
        4       V P                  V\         P                  P                  \         P                  ! V P                  4      V4      4       R# )zbytesfile.txtr   N)	r   r  r	  r	  r2   r[   rD   rE   rG   )r5   rw	  bytes_entryr	  s   &   r   test_fspath_protocol_bytes&TestScandir.test_fspath_protocol_bytesd  sq    _5,,.,A;'fe,bkk$))&<^L	Nr   c                .   \         P                  P                  V P                  R 4      p\         P                  ! V4       V P	                  R 4      p\         P
                  ! V4       \         P                  R8X  d    V P                  VP                  4       4       V P                  VP                  4       4       V P                  VP                  4       4       \         P                  R8X  dE   V P                  \        VP                  4       VP                  4        VP                  RR7       R# V P!                  VP                  4       ^ 4       V P                  \        VP                  4       V P                  \        VP                  RR7       R# )rn  r  FrW  N)r   rE   rG   rH   r	  r  r   rt   r	  rW  r	  r	  r   rJ   r	  r   r  )r5   rE   r	  s   &  r   test_removed_dirTestScandir.test_removed_dirl  s   ww||DIIu-
u%
 77d?OOELLN+)))+,77d?/=JJLJJuJ-u{{}a0/</USr   c                   V P                  4       p\        P                  ! VP                  4       V P	                  VP                  4       4       \        P                  R 8X  d    V P                  VP                  4       4       V P	                  VP                  4       4       \        P                  R 8X  dE   V P                  \        VP                  4       VP                  4        VP                  RR7       R# V P                  VP                  4       ^ 4       V P                  \        VP                  4       V P                  \        VP                  RR7       R# )r  FrW  N)r	  r   rl   rE   rW  r	  r   rt   r	  r	  r   rJ   r	  r   r  r	  s   & r   test_removed_fileTestScandir.test_removed_file  s    &&(
		%**(77d?OOEMMO,))+,77d?/=JJLJJuJ-u{{}a0/</USr   c                D   \         P                  ! 4       '       g   V P                  R 4      # V P                  R4      p\        P
                  ! V\        P                  P                  V P                  R4      4       V P                  RR.4      pVR,          p\        P                  ! V4       V P                  VP                  4       ^ 4       V P                  VP                  4       4       V P                  VP                  4       4       V P                  VP                  RR7      4       V P                  VP                  RR7      4       V P                  VP!                  4       4       V P#                  \$        VP&                  4       VP'                  RR7       R# )zcannot create symbolic linkr]  zsymlink.txtFrW  N)r   rT  r~   r%   r   r   rE   rG   r	  rl   r  r	  rW  r	  r	  rt   r	  r   rJ   r   )r5   r"   r	  r	  s   &   r   test_broken_symlinkTestScandir.test_broken_symlink  s(   $$&&==!>??##J/


877<<		=9	;""J#>?&
		(5;;=!,()e<=u=>((*++UZZ8

5
)r   c           	        V P                  R 4       \        P                  ! V P                  4      p\	        \        P
                  ! V4      4      pV P                  \        V4      ^V4       V^ ,          pV P                  VP                  R4       V P                  VP                  \        P                  ! \        P                  P                  V P                  R 4      4      4       R# )r]  s   file.txtN)
r%   r   r  rE   rf  r	  rD   r@   r   rG   )r5   
path_bytesr	  r	  s   &   r   rl  TestScandir.test_bytes  s    $[[+
rzz*-.Wq'2
[1RWW\\$))Z%HI	Kr   c                :   V P                  R 4       \        \        3 Fe  pV! \        P                  ! V P
                  4      4      pV P                  \        4      ;_uu_ 4        \        P                  ! V4       RRR4       Kg  	  R#   + '       g   i     K|  ; ir	  )	r%   r   r   r   r  rE   r   r   r	  )r5   r&  r	  s   &  r   test_bytes_likeTestScandir.test_bytes_like  se    $j(CR[[34J""9--

:& .- )---s   $B		Bz.fd support for listdir required for this test.c           	        V P                  \        P                  \        P                  4       V P	                  R 4       R .p\
        P                  ! 4       '       dQ   \        P                  ! R \        P                  P                  V P                  R4      4       VP                  R4       \
        P                  ! V P                  4      ;_uu_ 4       p\        P                  ! V4      ;_uu_ 4       p\        V4      pRRR4       X Uu. uF  qUP                  NK  	  ppV P                  \        V4      V4       V P                  V\        P                   ! V4      4       V EF3  pV P                  VP                  VP                  4       V P                  \        P"                  ! V4      VP                  4       V P                  VP%                  4       VP                  R8H  4       \        P&                  \        P(                  9   g   K  \        P&                  ! VP                  VR7      pV P                  VP'                  4       V4       \        P&                  ! VP                  VRR7      pV P                  VP'                  RR7      V4       EK6  	  RRR4       R#   + '       g   i     EL; iu upi   + '       g   i     R# ; i)r]  rE  NrX  F)r   r  rW  )r  r   r	  rZ  r%   r   rT  r   rE   rG   rn  r  rf  r   rD   r  rW  r	  r	  r   r[  )r5   expected_namesr   r  r	  r	  r	  r  s   &       r   test_fdTestScandir.test_fd  s    	bjj"..1$$  ""JJz277<<		6#BC!!&)""499--B2r(  -45WEZZWE5VE]N;UBJJrN3   UZZ8  5!15::>  !1!1!3UZZ65IJ77b000B7B$$UZZ\26BNB$$UZZZ%FK ! .-5 .--s8   K5J(	KJ<!C,KBK(J93KK	zWASI maps '' to cwdc                P    V P                  \        \        P                  R 4       R# r  )r   rJ   r   r	  rm   s   &r   test_empty_pathTestScandir.test_empty_path  s    +RZZ<r   c                   V P                  R 4       \        P                  ! V P                  4      p\	        V4      pV P                  \        V4      ^V4       \	        V4      pV P                  \        V4      ^ V4       R# r	  )r%   r   r	  rE   rf  rD   r@   )r5   r  r	  entries2s   &   r   test_consume_iterator_twice'TestScandir.test_consume_iterator_twice  sb    $::dii(x.Wq'2 >X84r   c                h    R / . 3 F(  pV P                  \        \        P                  V4       K*  	  R# )gX9v?N)r   r   r   r	  )r5   objs   & r   test_bad_path_typeTestScandir.test_bad_path_type  s(    2r?CiS9 #r   c                L   V P                  R 4       V P                  R4       \        P                  ! V P                  4      p\	        V4       VP                  4        VP                  4        V P                  4       ;_uu_ 4        ?RRR4       R#   + '       g   i     R# ; ir]  z	file2.txtN)r%   r   r	  rE   r  rs   check_no_resource_warningr5   r  s   & r   
test_closeTestScandir.test_close  sl    $%::dii(X++-- .---s   BB#	c                T   V P                  R 4       V P                  R4       \        P                  ! V P                  4      ;_uu_ 4       p\	        V4       RRR4       V P                  4       ;_uu_ 4        ?RRR4       R#   + '       g   i     L4; i  + '       g   i     R# ; ir
  )r%   r   r	  rE   r  r
  r
  s   & r   test_context_manager TestScandir.test_context_manager  sl    $%ZZ		""hN #++-- .- #"---s   B7BB	B'	c                
   V P                  R 4       V P                  R4       \        P                  ! V P                  4      ;_uu_ 4       p\	        V4       VP                  4        RRR4       R#   + '       g   i     R# ; ir
  )r%   r   r	  rE   r  rs   r
  s   & r   test_context_manager_close&TestScandir.test_context_manager_close  sS    $%ZZ		""hNNN #"""s   A11B	c           	        V P                  R 4       V P                  R4       V P                  \        4      ;_uu_ 4        \        P                  ! V P
                  4      ;_uu_ 4       p\        V4       ^^ ,           RRR4       RRR4       V P                  4       ;_uu_ 4        ?RRR4       R#   + '       g   i     L<; i  + '       g   i     LG; i  + '       g   i     R# ; ir
  )r%   r   ZeroDivisionErrorr   r	  rE   r  r
  r
  s   & r   test_context_manager_exception*TestScandir.test_context_manager_exception  s    $%011DII&&(X! ' 2 ++-- .- '& 21 .--s0    )C)B2	>C&C2C=CC	C)	c                    V P                  R 4       V P                  R4       \        P                  ! V P                  4      p\	        V4       V P                  \        4      ;_uu_ 4        ?\        P                  ! 4        RRR4       \        P                  ! V P                  4      p\        V4       V P                  4       ;_uu_ 4        ?RRR4       R#   + '       g   i     L_; i  + '       g   i     R# ; ir
  )r%   r   r	  rE   r  assertWarnsResourceWarningr   
gc_collectrf  r
  r
  s   & r   test_resource_warning!TestScandir.test_resource_warning  s    $%::dii(Xo..  / ::dii(X++-- .- /. .--s   +CC,C)	,C=	)r	  rE   N)r]  )/r_   r`   ra   rb   r   r
  rn   r%   r	  r	  r	  r	  r	  r	  r   rD  r>   r?   r	  r	  r	  r	  r	  r	  r	  r	  r	  r	  rl  r	  r   r   rW  rZ  r	  r   rE  r 
  r
  r
  r
  r
  r
  r
  r
  rc   rd   re   s   @r   r	  r	    s$     / I I+
0<'KR __S\\W,._`A aA:?PNT,T&**
K' r~~5IKLKL0 __W__&;<= ==	5:	 r   r	  c                      a  ] tR tRt o ]! ]P                  4      tR tR tR t	R t
R tR tR tR	 tR
 tR tR tRtV tR# )
TestPEP519i  c                X    R F#  pV P                  WP                  V4      4       K%  	  R# )rf  N)rf  s   goodbyes   some/path/and/filerD   r	  )r5   bs   & r   test_return_bytesTestPEP519.test_return_bytes$  s"    <AQA/ =r   c                X    R F#  pV P                  WP                  V4      4       K%  	  R# )helloN)r(
  goodbyezsome/path/and/filer#
  )r5   r   s   & r   test_return_stringTestPEP519.test_return_string(  s"    9AQA/ :r   c                   R Fz  p\        V4      pV P                  WP                  V4      4       V P                  R\        P                  ! V4      4       V P                  R \        P
                  ! V4      4       K|  	  R# )path/like/object   path/like/objectN)r-
  r.
  )r   rD   r	  r   r  r\   )r5   r  pathlikes   &  r   test_fsencode_fsdecode!TestPEP519.test_fsencode_fsdecode,  s`    8A{HQH 560"++h2GH/X1FG 9r   c                    V P                  R V P                  \        R 4      4      4       V P                  \        \        P
                  4       V P                  \        R4      \        P
                  4       R# )z#feelthegilrV  N)rD   r	  r   assertIsSubclassr   PathLiker2   rm   s   &r   rf  TestPEP519.test_pathlike4  sL    H]4K(LMh4hsmR[[9r   c                    \        R R/ 4      p\        \         \        V! 4       3 F$  pV P                  \        V P
                  V4       K&  	  R# )blahNr,   )r   r   r   r   r   r	  )r5   vaporos   &  r   test_garbage_in_exception_out(TestPEP519.test_garbage_in_exception_out9  s;    VR$dB'Aia8 (r   c                F    V P                  \        V P                  4       R # r(   )r   r   r	  rm   s   &r   test_argument_required!TestPEP519.test_argument_required>  s    )T[[1r   c                2   V P                  \        V P                  \        ^*4      4       \	        RR/ 4      p^Vn        V P                  \        V P                  V! 4       4       V P                  \        V P                  \        \        4       4      4       R# )*   fooNr,   )r   r   r	  r   r   
__fspath__r
  )r5   cs   & r   test_bad_pathlikeTestPEP519.test_bad_pathlikeA  sl    )T[[(2,?B)T[[!#6+T[["#4#67	9r   c                     ! R  R\         P                  4      pV P                  \        V4       V P	                  \        \         P                  4       R# )c                       ] tR tRtRtR# )0TestPEP519.test_pathlike_subclasshook.<locals>.AiO  r,   Nr  r,   r   r   ArH
  O  r  r   rI
  N)r   r4
  assertNotIsSubclassr   r3
  r5   rI
  s   & r   test_pathlike_subclasshook%TestPEP519.test_pathlike_subclasshookL  s6    	 	  1-h4r   c                x    V P                  \        P                  \        ,          \        P
                  4       R # r(   )r2   r   r4
  r[   typesGenericAliasrm   s   &r   test_pathlike_class_getitem&TestPEP519.test_pathlike_class_getitemT  s!    bkk%0%2D2DEr   c                f     ! R  R\         P                  4      pV P                  V! 4       R4       R# )c                   *   a  ] tR tRt o RtR tRtV tR# )2TestPEP519.test_pathlike_subclass_slots.<locals>.AiX  c                    R # r  r,   rm   s   &r   rB
  =TestPEP519.test_pathlike_subclass_slots.<locals>.A.__fspath__Z  s    r   r,   N)r_   r`   ra   rb   	__slots__rB
  rc   rd   re   s   @r   rI
  rU
  X  s     I r   rI
  __dict__N)r   r4
  assertNotHasAttrrK
  s   & r   test_pathlike_subclass_slots'TestPEP519.test_pathlike_subclass_slotsW  s&    	 	 	ac:.r   c                    ! R  R4      p ! R R4      p ! R RV4      pRP                   pV P                  \        V! R4      4      ;_uu_ 4        V P                  V! 4       4       RRR4       V P	                  V P                  V! 4       4      R4       V P                  \        V! R4      4      ;_uu_ 4        V P                  V! 4       4       RRR4       V P                  \        V! R4      4      ;_uu_ 4        \        V! 4       4       RRR4       V P                  \        V! R4      4      ;_uu_ 4        \        V! 4       4       RRR4       R	P                   pV P                  \        V! R4      4      ;_uu_ 4        \        P                  ! V! 4       R
4       RRR4       V P                  \        V! R4      4      ;_uu_ 4        \        P                  ! V! 4       R4       RRR4       R#   + '       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)c                       ] tR tRtRtRtR# )/TestPEP519.test_fspath_set_to_None.<locals>.Fooi_  Nr,   r_   r`   ra   rb   rB
  rc   r,   r   r   Foor_
  _      Jr   ra
  c                   &   a  ] tR tRt o R tRtV tR# )/TestPEP519.test_fspath_set_to_None.<locals>.Barib  c                    R # )barr,   rm   s   &r   rB
  :TestPEP519.test_fspath_set_to_None.<locals>.Bar.__fspath__c  s    r   r,   N)r_   r`   ra   rb   rB
  rc   rd   re   s   @r   Barrd
  b  s      r   rh
  c                       ] tR tRtRtRtR# )/TestPEP519.test_fspath_set_to_None.<locals>.Bazif  Nr,   r`
  r,   r   r   Bazrj
  f  rb
  r   rk
  z1expected str, bytes or os.PathLike object, not {}Nrf
  z.should be string, bytes or os.PathLike, not {}foooobazzz)r  rt	  r   r	  rD   r    r   r   )r5   ra
  rh
  rk
  good_error_msgother_good_error_msgs   &     r   test_fspath_set_to_None"TestPEP519.test_fspath_set_to_None^  s   	 		 		# 	 AGG 	 ##I~e/DEEKK F 	SU+U3##I~e/DEEKK F ##I~e/DEEK F ##I~e/DEEK F >DD 	 ##I/CE/JKKIIceW% L ##I/CE/JKKIIceW% LK+ FEE
 FEE FEE FE LK LKKsH   G29H<H9H.II2H	H	H+	.H>	I	I%	r,   N)r_   r`   ra   rb   rk  r   r	  r%
  r*
  r0
  rf  r:
  r=
  rD
  rL
  rQ
  r[
  rp
  rc   rd   re   s   @r   r!
  r!
    sS      "))$F00H:
9
2	95F/%& %&r   r!
  c                   &   a  ] tR tRt o R tRtV tR# )
TimesTestsi  c                   \         P                  ! 4       pV P                  V\         P                  4       R F$  p\	        W4      pV P                  V\
        4       K&  	  \         P                  R8X  dW   V P                  VP                  ^ 4       V P                  VP                  ^ 4       V P                  VP                  ^ 4       R# R# )userr  N)ru
  systemchildren_userchildren_systemelapsed)r   r  r2   times_resultrq  r	  r   rD   rw
  rx
  ry
  )r5   r  fieldr  s   &   r   
test_timesTimesTests.test_times  s    
eR__5!EE)E!!%/!
 77d?U00!4U22A6U]]A. r   r,   N)r_   r`   ra   rb   r|
  rc   rd   re   s   @r   rs
  rs
    s     / /r   rs
  c                      a  ] tR tRt o R t]P                  ! ]P                  R	9   R4      ]P                  ! ]
RJ R4      R 4       4       tR tRtV tR# )
	ForkTestsi  c                    R p\        RV4       \        P                  '       d   \        RVRR7       R# \        RVRR7       R# )zif 1:
            import os
            from test import support
            pid = os.fork()
            if pid != 0:
                support.wait_process(pid, exitcode=0)
        r   mimalloc_debug)PYTHONMALLOCmalloc_debugN)r   r   Py_GIL_DISABLEDr   s   & r   	test_forkForkTests.test_fork  s:     	t$"""T46FGT4nEr   z'Only Linux and macOS detect this today.Nzrequires _testcapic                    R p\        RVRR7      w  r#pV P                  VP                  R4      R4       V P                  VP                  R4      R4       R# )a  if 1:
            import os, threading, warnings
            from _testcapi import _spawn_pthread_waiter, _end_spawned_pthread
            _spawn_pthread_waiter()
            try:
                with warnings.catch_warnings(record=True) as ws:
                    warnings.filterwarnings(
                            "always", category=DeprecationWarning)
                    if os.fork() == 0:
                        assert not ws, f"unexpected warnings in child: {ws}"
                        os._exit(0)  # child
                    else:
                        assert ws[0].category == DeprecationWarning, ws[0]
                        assert 'fork' in str(ws[0].message), ws[0]
                        # Waiting allows an error in the child to hit stderr.
                        exitcode = os.wait()[1]
                        assert exitcode == 0, f"child exited {exitcode}"
                assert threading.active_count() == 1, threading.enumerate()
            finally:
                _end_spawned_pthread()
        r   0)PYTHONOPTIMIZEr   rE  N)r   rD   r  r5   r   r  r  r  s   &    r   -test_fork_warns_when_non_python_thread_exists7ForkTests.test_fork_warns_when_non_python_thread_exists  sO    * 'tT#FG,b1G,b1r   c                p    R p\        RV4      w  r#pV P                  RV4       V P                  RV4       R# )aN  if 1:
            import atexit
            import os

            class AtFinalization:
                def __del__(self):
                    print("OK")
                    pid = os.fork()
                    if pid != 0:
                        print("shouldn't be printed")
            at_finalization = AtFinalization()
        r   s   OK
s"   can't fork at interpreter shutdownN)r   rD   r  r
  s   &    r   test_fork_at_finalization#ForkTests.test_fork_at_finalization  s:     'tT2#&;SAr   r,   )r  r  darwin)r_   r`   ra   rb   r
  r   r   r>   r?   rD  	_testcapir
  r
  rc   rd   re   s   @r   r
  r
    s`     F  )GGBD__Y$&(<=2 >D24B Br   r
  _fspathc                   >    ] tR tRtRt]! ]P                  4      tRt	R# )TestPEP519PurePythoni  z>Explicitly test the pure Python implementation of os.fspath().r,   N)
r_   r`   ra   rb   r0  rk  r   r
  r	  rc   r,   r   r   r
  r
    s    Lbjj)r   r
  __main__)s   contentr(   )r)   r  
contextlibr.  rL   r  r0  r  r  r   r  r~  r  r  r  r  r   rn  r   r>   	sysconfigrA   r  r,  rO
  r   r  r  r   r   test.supportr   r   r   r   r   r?   r	   r  ImportErrorr+	  r  pwdgetpwallpw_uidrA  rv  r
  r
   r   r  r  test.support.script_helperr   r   test.support.os_helperr   rM  r   r   r   versionr3  r  getgidr  r   r%   rD  rI  r-   TestCaser/   rh   rK  r  rl  BasicTestMappingProtocolrn  r5  r   r  r  r  r  r#  rO  rE  rd  rk  r  get_config_varOS_URANDOM_DONT_USE_FDr  contextmanagerr  r  r  r  rm  r  r  r  r  r   r*  rN  rn  rp  r  r  r  r  r  r2  r  rI  r  r  r  IsolatedAsyncioTestCaser  r  requires_linux_versionr  rL  ra  rk  r  r  r	  r%	  rR	  rq	  rG  r	  r	  r	  r	  r!
  rs
  requires_forkr
  r
  r_   main)us   0r   <module>r
     s  
          	          
          & " & + ( !#&<<>2>a>2I+1
 8 # + 
2yZZ\Q&M 33??#:#:#:00;;NK <<**95JJ"))+:J K  s||'>'>u'E'NP 0A8!! A8JF8!! F8Tl7** l7^mA"" mA` ]5=99 ]5~
r(!! r(j	 
WR)+BCZ% Z% DZ%z6Y 6 
WR)+BC	6j 	6 D	6v8$$ vr 
WR)+@A8#X&& 8# B8#v&:h'' &:R 
"9:,8$$ , ;,*8$$ *> 
WR-/DE'*X&& '* F'*Z ./14 ? ? 01Q6? ? 89Q> 
 
'=?	*79J'X&& J'9?J'Z " "@ 
WR)&(e+!! e+(e+P 
S\\W,.DE Bh''  B F BF 
"EFS*H%% S* GS*l 
WR(*<=#0!! #0 >#0J 
(*@ADAx(( DA BDAL 
(*@AG0(## G0 BG0R 
S\\W,.DEwKX&& wK FwKt 
S\\W,.DE,D)) ,D F,D^ 
RWW_&9:,(++ , ;,^ 
WR,.CD9+H%% 9+ E9+x 
S\\W,.DE
nB)) nB  FnB` 
S\\W,.DE8** 8 F8B 
S\\W,.DET@8$$ T@ FT@n "8,, " ">7h'' 7 1(++ 1 	GJx   GJ GJT 	z,"" z, z,~ 
OP	WR,.FG/"" / H Q/ 
WR/NNGB4N>@18,, 1@1, 
WR,.HIT833 T JTn  
13?A 	1b)NGX.. NG *ANGb 
WR!457VW@/H%% @/ X@/F 
WR02LM2&2x(( 2 ' N2 
WR+-BC1b)N8$$ N * DN` 
WR!124PQ	*,QR1b)CA8$$ CA * S RCAJ
F@8$$ F@P#3H%% #3N 	n2** n2 n2` 
WR+-@Aa&(++ a& Ba&H?((++ ?(D 
WR0DF	&&(DE	(*ST
4H%% 
4 U FF
4*8$$ *D8$$ D$_(## _De&"" e&N/"" /  	=B!! =B =BD 2y*z * zMMO km  H  E  G 3^$ I
  +I"{{*Gn+  Ds~   o !o &o, +p o<p p 'p1 	oo	o)(o),	o98o9<p ppp.-p.1	p>=p>