+
    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HtHtHtHtHtHtHtHtHtHtHtHt ^ RIHtHtHtHtHt ^ RI t ^ RI!t!^ RI"H#t#H$t$  ^ RI%t%] PN                  ! ]	PP                  ]	PR                  8H  ;'       g    ]	PT                  ]	PV                  8g  R4      t,]'       g   ]'       g	   ]'       d   ] PZ                  ! R4      h]! 4       RR l4       t. ! R R	] P^                  4      t0 ! R
 R]04      t1], ! R R]04      4       t2]3R8X  d   ] Ph                  ! 4        R# R#   ]& d    Rt% Li ; i)    N)captured_stdoutcaptured_stderr*skip_if_broken_multiprocessing_synchronizeverboserequires_subprocess
is_androidis_apple_mobile	is_wasm32requires_venv_with_pipTEST_HOME_DIRrequires_resourcecopy_python_src_ignore)can_symlinkEnvironmentVarGuardrmtreeTESTFNFakePath)patchMockz:cannot run venv.create from within a venv on this platformz&venv is not available on this platformc                    \         P                  ! V \         P                  \         P                  / \        P                  CR R/CR7      pVP                  4       w  r4VP                  '       d\   \        '       d.   V'       d&   \        TP                  T;'       g    RR4      4       \         P                  ! VP                  WV4      hV'       d%   VP                  VR4      VP                  VR4      3# W43# )
PYTHONHOME )stdoutstderrenvutf-8backslashreplace)
subprocessPopenPIPEosenvironcommunicate
returncoder   printdecodeCalledProcessError)cmdencodingpouterrs   &&   %/usr/lib/python3.14/test/test_venv.pycheck_outputr.   0   s    ,rzz,<,	.A }}HC|||7s#**X002DEF++LL#C) 	)JJx!34JJx!34
 	
 8O    c                   X   a  ] tR t^Ct o RtR tR tRR/R ltR tR t	RR	/R
 lt
RtV tR# )BaseTestc                x   \         P                  P                  \        P                  ! 4       4      V n        \         P                  R 8X  d   RV n        RV n        RV n	        M-RV n        RR\        P                  ! 4        23V n        RV n	        \        P                  p\         P                  P                  V4      R,          V n        \        P                   R8X  dT   \         P                  P#                  V4      '       d/   \         P                  P%                  V4      '       g
   RV n        R
# R	V n        R
# )ntScriptsIncludebinlibpythonincludewin32TFNLib)r!   pathrealpathtempfilemkdtempenv_dirnamebindirr7   r9   	sysconfig_get_python_version_abisys_base_executablesplitexeplatformlexistsexistscannot_link_exe)self
executables   & r-   setUpBaseTest.setUpG   s    ww''(8(8(:;77d?#DKDH$DLDK	(I(I(K'LMNDH$DL))
77==,R0LLG#
++GGNN:..#'D #(D r/   c                0    \        V P                  4       R # N)r   rB   rO   s   &r-   tearDownBaseTest.tearDownZ   s    t||r/   real_env_dirFc                   V'       d+   \         P                  P                  V P                  4      pMV P                  p\         P                  P	                  W P
                  V P                  4      # rT   )r!   r>   r?   rB   joinrD   rJ   )rO   rX   rB   s   &$ r-   envpyBaseTest.envpy]   sC    gg&&t||4GllGww||G[[$((;;r/   c           	     
   \        4       ;_uu_ 4       p\        4       ;_uu_ 4       pV! V/ VB  R R R 4       R R R 4       XP                  4       XP                  4       3#   + '       g   i     L8; i  + '       g   i     LC; irT   )r   r   getvalue)rO   funcargskwargsoutputerrors   &&*,  r-   run_with_captureBaseTest.run_with_captured   s\    & ""ed%f% #   %.."222 #" s!   A2	A	A2A/*A22B	c                Z    \         P                  P                  ! V P                  .VO5!  # rT   )r!   r>   rZ   rB   rO   r`   s   &*r-   get_env_fileBaseTest.get_env_filej   s    ww||DLL0400r/   r)   r   c                   \        V P                  ! V!  R VR7      ;_uu_ 4       pVP                  4       pRRR4       V#   + '       g   i     X# ; i)rr)   N)openrh   read)rO   r)   r`   fresults   &$*  r-   get_text_file_contentsBaseTest.get_text_file_contentsm   sC    $##T*C(CCqVVXF D DCs   A  A	)rD   rN   rB   rJ   r9   r7   Ni  )__name__
__module____qualname____firstlineno__maxDiffrQ   rV   r[   rd   rh   rq   __static_attributes____classdictcell____classdict__s   @r-   r1   r1   C   s;     G)&<E <31W  r/   r1   c                   f  a  ] tR t^rt o R tR tR tR tR tR t	R t
]R 4       t]R	 4       t]]P                  ! ]! 4       R
4      R 4       4       t]P&                  R8X  d   R6tM<R7R8R9RR]P*                  R,          ,          3RR]P*                  R,          ,          R33tR tR tR tR tR tR t]P                  ! ]! 4       R
4      R 4       t]R 4       t]P                  ! ]! 4       R
4      R 4       t]P>                  ! ] PB                  R8H  R4      R 4       t"]P>                  ! ] PB                  R8H  R4      R 4       t#]P                  ! ] PB                  R8H  R4      R 4       t$]P                  ! ] PB                  R8H  R4      R  4       t%]P                  ! ] PB                  R8H  ;'       d    ]! 4       R!4      R" 4       t&]R# 4       t']R$ 4       t(]P>                  ! ] PB                  R8H  R%4      R& 4       t)]P                  ! ]P&                  R'8H  R(4      R) 4       t*R* t+]P>                  ! ] PB                  R8H  R%4      ]R+ 4       4       t,]R, 4       t-]R- 4       t.]R. 4       t/]R/ 4       t0]R0 4       t1]R1 4       t2R2 t3]]P                  ! ] PB                  R8H  R4      R3 4       4       t4R4t5V t6R5# ):	BasicTestc                    V P                   ! V!  pV P                  \        P                  P	                  V4      4       R # rT   )rh   
assertTruer!   r>   isdir)rO   r`   fns   &* r-   r   BasicTest.isdiru   s+    %b)*r/   c                    \        V P                  4       V P                  \        P                  V P                  4       V P                  4        R # rT   )r   rB   rd   venvcreate_check_output_of_default_createrU   s   &r-   test_defaults_with_str_path%BasicTest.test_defaults_with_str_pathy   s4     	t||dkk4<<8,,.r/   c                    \        V P                  4       V P                  \        P                  \        V P                  4      4       V P                  4        R # rT   )r   rB   rd   r   r   r   r   rU   s   &r-   test_defaults_with_pathlike%BasicTest.test_defaults_with_pathlike   s9     	t||dkk8DLL+AB,,.r/   c                   V P                  V P                  4       V P                  V P                  4       V P                   ! V P                  !   V P	                  R 4      p\
        P                  ! R4      ^8H  ;'       d/    \        P                  R8H  ;'       d    \        P                  R8g  pV'       d0   V P                  \        P                  P                  V4      4       M.V P                  \        P                  P                  V4      4       V P!                  R4      p\        P"                  p\        P                  P%                  V4      pV P'                  RV,          V4       V P'                  R\        P                  P)                  \        P*                  4      ,          V4       \        P                  R8X  d   RMR	pR
\        P*                   RV RV P,                   2pV P'                  Ws4       V P	                  V P                  V P.                  4      p\        P                  P                  V4      '       gT   V P	                  V P                  4      p	\1        RV	,          4       \1        R\        P2                  ! V	4      ,          4       V P                  \        P                  P                  V4      RV,          4       R# )lib64Pposixdarwin
pyvenv.cfgz	home = %szexecutable = %sr3   r   z	 --copiesz
command = z -m venvz* --without-pip --without-scm-ignore-files Contents of %r:    %rFile %r should exist.N)r   rD   r9   r7   rh   structcalcsizer!   rC   rG   rK   r   r>   islinkassertFalserM   rq   rH   dirnameassertInr?   rP   rB   rJ   r%   listdir)
rO   r*   
conditionsdatarP   r>   copiesr(   r   bds
   &         r-   r   )BasicTest._check_output_of_default_create   s   

4;;

4<< 

DHHg&s+q0 1 1rww'7I 1 1||x/ 	OOBGGNN1-.RWW^^A./**<8))
wwz*kD($/'gg&&s~~678<	>ww}+CNN+8F8 <--1\\N<c t{{DHH5ww~~b!!""4;;/B#b()(RZZ^+,r*,Cb,HIr/   c                   R	R
RRRRRRRR\        4       3.	pV EF)  w  r#pV P                  W#VR7      ;_uu_ 4        \        V P                  4       V'       g   / pMW4/p\        P
                  ! R/ VB p\        4       Vn        \        4       Vn        V P                  VP                  V P                  4       V P                  R4      pV'       d   VP                  R4      '       d    R F  pV P                  VRV 24       K  	  M2\        P                  R8X  d	   VR8X  d   MV P!                  VRV 24       R R R 4       EK,  	  R #   + '       g   i     EKB  ; i)Nsymlinks--without-scm-ignore-filesscm_ignore_files)optattrvaluer   gitzcommand = .* r3   )NNN)z--copiesr   F)--without-pipwith_pipF)--system-site-packagessystem_site_packagesT)--clearclearT)	--upgradeupgradeT)--upgrade-depsupgrade_depsT)z--prompt="foobar"promptfoobar )r   r   r   r   z--prompt)	frozensetsubTestr   rB   r   
EnvBuilderr   upgrade_dependencies
_setup_piprd   r   rq   endswithassertNotRegexr!   rC   assertRegex)rO   optionsr   r   r   ra   br   s   &       r-   test_config_file_command_key&BasicTest.test_config_file_command_key   s-   +0D&*45)+=y{K

 !(Cu#>>t||$F"]FOO-f-)-&#v%%ahh=22<@s||E22 >++D]3%2HI > WWd]tZ'7$$TmC5+AB% ?> !(>>>s   B-E	)AE		Ec                   \         P                  P                  V P                  4      ^,          p\	        V P                  4       \
        P                  ! 4       pV P                  VP                  V P                  4       VP                  V P                  4      pV P                  R4      pV P                  VP                  V4       V P                  RV4       \	        V P                  4       \
        P                  ! RR7      pV P                  VP                  V P                  4       VP                  V P                  4      pV P                  R4      pV P                  VP                  R4       V P                  RV4       \	        V P                  4       \
        P                  ! RR7      p\         P                  P                  \         P                   ! 4       4      pV P                  VP                  V P                  4       VP                  V P                  4      pV P                  R4      pV P                  VP                  V4       V P                  RV,          V4       R# )	   r   z	prompt = z	My prompt)r   zprompt = 'My prompt'
.zprompt = '%s'
N)r!   r>   rI   rB   r   r   r   rd   r   ensure_directoriesrq   assertEqualr   assertNotInr   basenamegetcwd)rO   env_namebuildercontextr   cwds   &     r-   test_promptBasicTest.test_prompt   s   77==.q1t||//#gnndll;,,T\\:**<82d+t||//5gnndll;,,T\\:**<85.5t||//-ggryy{+gnndll;,,T\\:**<8-'#-t4r/   c           	     6  a a \         P                  ! 4       pR p\        P                  P	                  \
        P                  4      ^,          p\        P                  P                  \
        P                  4      p\
        P                  R8X  di   Rp\        P                  P                  \        P                  P                  V4      ^ ,          4      P                  R4      '       d   RpMRpVR,           p\        P                  ! 4       ;_uu_ 4       p\        P                  P                  \        P                  P                  WRV4      4      o\
        P                  R8X  d=   \        P                  P                  \        P                  P!                  S4      4      oVV 3R lpVP#                  V4      p\%        RV4      ;_uu_ 4        VP'                  V4       R	R	R	4       R	R	R	4       R	#   + '       g   i     L; i  + '       g   i     R	# ; i)
r6   r:   r4   _dpython_dr8   z.exec                 ^  < SP                  V R ,          . RO4       \        P                  P                  \        P                  P	                  V ^ ,          4      4      p\        P                  P                  \        P                  P	                  S4      4      pSP                  W#4       R# ):r   NNN)-mpipinstallr   r   )r   r!   r>   normcaser   )r(   ra   exe_direxpected_dir
expect_exerO   s   &,  r-   pip_cmd_checker<BasicTest.test_upgrade_dependencies.<locals>.pip_cmd_checker   ss      G	 ''**277??3q6+BC!ww//
0KL  7r/   zvenv.subprocess.check_outputN)r   r   r!   r>   rI   rG   rP   r   rH   rK   r   splitextr   r@   TemporaryDirectoryrZ   r?   r   r   r   )	rO   r   bin_path
python_exeexpected_exefake_env_dirr   fake_contextr   s	   f       @r-   test_upgrade_dependencies#BasicTest.test_upgrade_dependencies   sa   //#WW]]3>>215
ww''(<(<=<<7" Hww 0 0 <Q ?@II$OO)'%.J((**l))\\BJ ||w&WW--bgg.>.>z.JK
8 #55lCL5GG,,\: H/ +*. HG/ +**s%   B;HG4	"H4H?HH	c                   \        V P                  4       V P                  \        P                  V P                  4       V P                  4       R R.pRV P                  3RV P                  3R\        P                  3R\        P                  33 Fu  w  r#RV,          V^&   \        V4      w  rEV P                  \        P                  ! VP                  4       P                  4       4      \        P                  ! V4      V4       Kw  	  R# )-cNprefixexec_prefixbase_prefixbase_exec_prefixzimport sys; print(sys.%s))r   rB   rd   r   r   r[   rG   r   r   r.   r   pathlibPathstripr&   )rO   r(   r   expectedr+   r,   s   &     r-   test_prefixesBasicTest.test_prefixes  s     	t||dkk4<<8zz|T4(t||$DLL)COO,!5!56	!8F
 169CF#C(HCW\\#))+*<*<*>?$\\(3V=!8r/   c                   \        V P                  4       V P                  \        P                  V P                  R R7       V P                  4       RR.pRRR\        \        P                  ! 4       4      3R\        P                  ! 4       3R\        P                  ! 4       3R\        \        P                  ! R4      4      33 Fb  w  r#V P                  V4      ;_uu_ 4        R	V,          V^&   \        VR
R7      w  rEV P                  VP                  4       W54       RRR4       Kd  	  RV P                  4       3R\         P"                  33 F_  w  rcV P                  V4      ;_uu_ 4        RV R2V^&   \        VR
R7      w  rEV P                  VP                  4       W54       RRR4       Ka  	  R#   + '       g   i     EK  ; i  + '       g   i     K  ; i)Fr   r   Nis_python_build()get_makefile_filename()get_config_h_filename()!get_config_var("Py_GIL_DISABLED")Py_GIL_DISABLED%import sysconfig; print(sysconfig.%s)r   rl   rP   rH   import sys; print(sys.)zget_preferred_scheme("prefix")r   zget_default_scheme()r   )r   rB   rd   r   r   r[   strrE   is_python_buildget_makefile_filenameget_config_h_filenameget_config_varr   r.   r   r   rG   rH   rO   r(   callr   r+   r,   r   s   &      r-   test_sysconfigBasicTest.test_sysconfig  s   
 	t||dkk4<<%Hzz|T4( 7, #i&?&?&A"BC&	(G(G(IJ&	(G(G(IJ0))*;<=?	@ND d##@4GA'g>  h< $#	@ 4::<(  !5!56	
ND d##1$q9A'g>  h< $#
	 $## $##s   "<F3,9G3GGzNeeds symlinksc                   \        V P                  4       V P                  \        P                  V P                  R R7       V P                  4       RR.pRRR\        \        P                  ! 4       4      3R\        P                  ! 4       3R\        P                  ! 4       3R\        \        P                  ! R4      4      33 Fb  w  r#V P                  V4      ;_uu_ 4        R	V,          V^&   \        VR
R7      w  rEV P                  VP                  4       W54       RRR4       Kd  	  RV P                  4       33 F_  w  rcV P                  V4      ;_uu_ 4        RV R2V^&   \        VR
R7      w  rEV P                  VP                  4       W54       RRR4       Ka  	  R#   + '       g   i     K  ; i  + '       g   i     K  ; i)Tr   r   Nr   r   r   r   r   r   r   rl   rP   r   r   r   r   )r   rB   rd   r   r   r[   r   rE   r   r   r  r  r   r.   r   r   r  s   &      r-   test_sysconfig_symlinks!BasicTest.test_sysconfig_symlinks?  s{    	t||dkk4<<$Gzz|T4( 7, #i&?&?&A"BC&	(G(G(IJ&	(G(G(IJ0))*;<=?	@ND d##@4GA'g>  h< $#	@ 4::<(
ND d##1$q9A'g>  h< $#
	 $## $##s   "<F"9F6"F36Gr:   site-packagesr7   zpython%d.%d:N   Nc                ^   V F  p\         P                  P                  ! V P                  .VO5!  p\         P                  ! V4       \         P                  P                  WB4      p\        VR 4      ;_uu_ 4       pVP                  R4       RRR4       K  	  R#   + '       g   i     K  ; i)wb   Still here?N)r!   r>   rZ   rB   mkdirrm   write)rO   pathsfilenamesubdirsdr   ro   s   &&&    r-   create_contentsBasicTest.create_contentsr  sp    
 GT\\4G4AHHQKa*Bb$1'  	   s   ;BB,c                V   V P                  V P                  R 4       \        P                  ! V P                  4       V P                   F  p\
        P                  P                  ! V P                  .VR,           O5!  pV P                  \
        P                  P                  V4      4       \        VR4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       K  	  \        P                  ! RR7      pVP                  V P                  4       V P                   Fd  p\
        P                  P                  ! V P                  .VR,           O5!  pV P                  \
        P                  P                  V4      4       Kf  	  R#   + '       g   i     EK_  ; i)foorbr  NTr   )r  )r  ENV_SUBDIRSr   r   rB   r!   r>   rZ   r   rM   rm   r   rn   r   r   )rO   r  r   ro   r   s   &    r-   test_overwrite_existing!BasicTest.test_overwrite_existing~  s    	T--u5DLL!''GdllBg.@BBOOBGGNN2./b$1  >:   ( //-t||$''GdllBg.@BBRWW^^B/0 (  s   !FF(c                   \         P                  ! V4       F  p\         P                  P                  W4      p\         P                  P	                  V4      '       g&   \         P                  P                  V4      '       d   \         P                  ! V4       K  \         P                  P                  V4      '       g   K  \        V4       K  	  R # rT   )	r!   r   r>   rZ   r   isfileremover   r   )rO   r>   r   s   && r-   clear_directoryBasicTest.clear_directory  sq    **T"Bd'Bww~~b!!RWW^^B%7%7		"r""r
 #r/   c                   V P                   R ,           F  p\        P                  P                  ! V P                  .VO5!  p\        VR4      ;_uu_ 4       pVP                  R4       RRR4       V P                  \        \        3\        P                  V P                  4       V P                  V P                  4       K  	  R#   + '       g   i     Lf; i):N   Nr  r/   N)r  r!   r>   rZ   rB   rm   r  assertRaises
ValueErrorOSErrorr   r   r!  )rO   r  r   ro   s   &   r-   test_unoverwritable_fails#BasicTest.test_unoverwritable_fails  s    %%b))Edll3U3Bb$1  z73T[[$,,O  . *s   CCc                   R EFe  p\         P                  ! VR7      pV P                  VP                  V P                  4       V P                  V P                  4       V P                  V P                  4       V P
                  ! V P                  !   V P                  V P                  V P                  4      p\        P                  P                  V4      '       gT   V P                  V P                  4      p\        RV,          4       \        R\        P                  ! V4      ,          4       V P!                  \        P                  P                  V4      RV,          4       EKh  	  R# )F)r   r   r   r   NFT)r   r   rd   r   rB   r   rD   r9   r7   rh   rJ   r!   r>   rM   r%   r   r   )rO   r   r   r   r   s   &    r-   test_upgradeBasicTest.test_upgrade  s     %Goog6G!!'..$,,?JJt{{#JJt||$JJ!""4;;9B77>>"%%&&t{{3'",-hB/0OOBGGNN2.0G"0LM %r/   c                    R Fb  w  r\         P                  ! R VR7      pVP                  V P                  4       V P	                  R4      pV P                  RV,          V4       Kd  	  R# )T)r   r   r   z"include-system-site-packages = %s
N))Ttrue)Ffalse)r   r   r   rB   rq   r   )rO   sspsr   r   s   &    r-   test_isolationBasicTest.test_isolation  sT     9FCooDsKGNN4<<(..|<DMM?!CTJ	 9r/   c                   R F  p\         P                  ! RVR7      pVP                  V P                  4       V P	                  V P
                  V P                  4      pV'       g   Kf  V P                  '       d1   V P                  \        P                  P                  V4      4       K  V P                  \        P                  P                  V4      4       K  	  R# )FTr   r   Nr+  )r   r   r   rB   rh   rD   rJ   rN   r   r!   r>   r   r   )rO   uslr   r   s   &   r-   test_symlinkingBasicTest.test_symlinking  s    
 !CooD3?GNN4<<(""4;;9B s''' $$RWW^^B%78OOBGGNN2$67 !r/   c                $   \        V P                  4       V P                  \        P                  V P                  4       V P                  R R7      p\        VRR.4      w  r#V P                  VP                  4       VP                  4       4       R# )TrX   r   !import sys; print(sys.executable)N)
r   rB   rd   r   r   r[   r.   r   r   encode)rO   r[   r+   r,   s   &   r-   test_executableBasicTest.test_executable  sl    
 	t||dkk4<<8


-/!1 2elln5r/   c                6   \        V P                  4       \        P                  ! R R R7      pVP	                  V P                  4       V P                  R R7      p\        VRR.4      w  r4V P                  VP                  4       VP                  4       4       R# )Tr6  r;  r   r<  N)
r   rB   r   r   r   r[   r.   r   r   r=  )rO   r   r[   r+   r,   s   &    r-   test_executable_symlinks"BasicTest.test_executable_symlinks  st    
 	t||//t<t||$


-/!1 2elln5r/   r3   z&contains invalid characters on Windowsc                   \        V P                  4       \        P                  ! R 4      pVf   V P	                  R4       Rp\
        P                  P                  \
        P                  P                  V P                  4      V4      p\        P                  ! RR7      pVP                  V4       \
        P                  P                  W0P                  R4      p\
        P                  P                  V P                  R4      p\        VR4      ;_uu_ 4       pVP                  R	\        P                   ! V4       R
24       RRR4       \#        W.4      w  rVP%                  4       p
V P'                  VP)                  4       V
^ ,          9   4       V P+                  V
^,          VP)                  4       4       R#   + '       g   i     L; i)bashNbash required for this test
"';&&$e|'"Tr  activateztest_special_chars.shwsource r
python -c 'import sys; print(sys.executable)'
python -c 'import os; print(os.environ["VIRTUAL_ENV"])'
deactivate
r   rB   shutilwhichskipTestr!   r>   rZ   r?   r   r   r   rD   rm   r  shlexquoter.   
splitlinesr   r=  assertEndsWith)rO   rD  r   rB   r   rG  test_scriptro   r+   r,   liness   &          r-   test_special_chars_bash!BasicTest.test_special_chars_bash  s>   
 	t||||F#<MM78!'',,rww//=xH//-w77<<jAggll4<<1HI+s##qGGgekk(34 5# # $ $
   34 )U1X56E!Hhoo&78 $#s   *F<<G	c                   \        V P                  4       \        P                  ! R 4      ;'       g    \        P                  ! R4      pVf   V P	                  R4       Rp\
        P                  P                  \
        P                  P                  V P                  4      V4      p\        P                  ! RR7      pVP                  V4       \
        P                  P                  W0P                  R4      p\
        P                  P                  V P                  R4      p\        VR	4      ;_uu_ 4       pVP                  R
\        P                   ! V4       R24       RRR4       \#        W.4      w  rVP%                  4       p
V P'                  VP)                  4       V
^ ,          9   4       V P+                  V
^,          VP)                  4       4       R#   + '       g   i     L; i)tcshcshNzcsh required for this testrF  Tr  zactivate.cshztest_special_chars.cshrH  rI  rJ  rK  )rO   rY  r   rB   r   rG  rS  ro   r+   r,   rT  s   &          r-   test_special_chars_csh BasicTest.test_special_chars_csh  sO   
 	t||ll6"99fll5&9;MM67!'',,rww//=xH//-w77<<nEggll4<<1IJ+s##qGGgekk(34 5# # $ $
   23 )U1X56E!Hhoo&78 $#s   8*GG*	zonly relevant on Windowsc                T   \        V P                  4       R p\        P                  P	                  \        P                  P                  V P                  4      V4      p\        P                  ! RR7      pVP                  V4       \        P                  P	                  W P                  R4      p\        P                  P	                  V P                  R4      p\        VR4      ;_uu_ 4       pVP                  RV RV P                   RV P                   R	24       R
R
R
4       \        V.4      w  rxVP                  4       p	V P                  VP!                  4       V	^ ,          9   4       V P#                  V	^,          VP!                  4       4       R
#   + '       g   i     L; i)z'&&^$eTr  activate.batztest_special_chars.batrH  z@echo off
"z" & z* -c "import sys; print(sys.executable)" & z> -c "import os; print(os.environ['VIRTUAL_ENV'])" & deactivateN)r   rB   r!   r>   rZ   r?   r   r   r   rD   rm   r  rJ   r.   rQ  r   r=  rR  )
rO   r   rB   r   rG  
test_batchro   r+   r,   rT  s
   &         r-   test_special_chars_windows$BasicTest.test_special_chars_windows&  s.   
 	t||'',,rww//=xH//-w77<<nEWW\\$,,0HI
*c""aGG  zxxj Jxxj !!! " #  - )U1X56E!Hhoo&78 #"s   /0FF'	c                   \        V P                  4       \        P                  P	                  \        P                  P                  V P                  4      R 4      p\        P                  ! RR7      pVP                  V4       \        P                  P	                  WP                  R4      p\        VRV P                  RR.RR7      w  rEV P                  VP                  4       R	4       R
# )u   ϼўТλФЙTr  r]  &r   zprint(0)oemrl   0N)r   rB   r!   r>   rZ   r?   r   r   r   rD   r.   rJ   r   r   )rO   rB   r   rG  r+   r,   s   &     r-   test_unicode_in_batch_file$BasicTest.test_unicode_in_batch_file=  s    
 	t||'',,rww//=~N//-w77<<nEsDHHdJ7
 	c*r/   zsymlinks on Windowsc           	        \        V P                  4       \        P                  P	                  \        P                  P                  V P                  4      R 4      p\        R4      ;_uu_ 4       p\        4       Vn        \        P                  ! RRR7      pV P                  VP                  V4      w  rERpV P                  VRV RV 24       RRR4       R#   + '       g   i     R# ; i)r   z
os.symlinkTr6  z%'[A-Z]:\\\\(?:[^\\\\]+\\\\)*[^\\\\]+'zUnable to symlink z to N)r   rB   r!   r>   rZ   r?   r   r'  side_effectr   r   rd   r   r   )rO   rB   mock_symlinkr   _r,   filepath_regexs   &      r-   test_failed_symlinkBasicTest.test_failed_symlinkM  s     	t||'',,rww//=vF<  L'.yL$ooD4@G**7>>7CFAENS%77GtNK["\] !   s   0A CC+	c                4   \        4        \        V P                  4       V P                  \        P
                  V P                  4       \        V P                  R R7      RR.4      w  rV P                  VP                  4       RP                  4       4       R# )Tr;  r   zrfrom multiprocessing import Pool; pool = Pool(1); print(pool.apply_async("Python".lower).get(3)); pool.terminate()r8   N)r   r   rB   rd   r   r   r.   r[   r   r   r=  rO   r+   r,   s   &  r-   test_multiprocessingBasicTest.test_multiprocessing\  sr     	34t||dkk4<<8!>!  !
 	hoo&78r/   c                2   \        4        \        V P                  4       V P                  \        P
                  V P                  4       \        P                  P                  \        R 4      p\        P                  ! V P                  RR7      RV.4       R# )z_test_venv_multiprocessing.pyTr;  -IN)r   r   rB   rd   r   r   r!   r>   rZ   r   r   
check_callr[   )rO   scripts   & r-   test_multiprocessing_recursion(BasicTest.test_multiprocessing_recursiono  sc    
 	34t||dkk4<<8m-LMtzztz<dFKLr/   znot relevant on Windowsc                   \         P                  ! R 4      pVf   V P                  R4       \        V P                  4       \
        P                  ! RR7      pVP                  V P                  4       \        P                  P                  V P                  V P                  R4      p\        P                  P                  V P                  R4      p\        VR4      ;_uu_ 4       pVP                  RV R	24       RRR4       \        W.4      w  rgV P                  VR
P!                  4       4       V P                  VR
P!                  4       4       R#   + '       g   i     L`; i)rD  NrE  Tr  rG  ztest_strict.shrH  zset -euo pipefail
source z
deactivate
r   )rL  rM  rN  r   rB   r   r   r   r!   r>   rZ   rD   rm   r  r.   r   r=  )rO   rD  r   rG  rS  ro   r+   r,   s   &       r-   %test_deactivate_with_strict_bash_opts/BasicTest.test_deactivate_with_strict_bash_opts{  s    ||F#<MM78t||//-t||$77<<dkk:Fggll4<<1AB+s##qGG &Z (## $ $   34biik*biik* $#s   &EE$	r   zonly relevant on macOSc                ,   \        V P                  4       \        P                  ! 4       pVP	                  V P                  4       \        V P                  R R7      RR.4      w  r#V P                  VP                  4       RP                  4       4       R# )Tr;  r   z5import os; print("__PYVENV_LAUNCHER__" in os.environ)FalseN)
r   rB   r   r   r   r.   r[   r   r   r=  )rO   r   r+   r,   s   &   r-   test_macos_envBasicTest.test_macos_env  sl    t||//#t||$!>C!E Fgnn&67r/   c                   \        V P                  4       V P                  \        P                  ,           pV P	                  \
        \        P                  V4       V P	                  \
        \        P                  \        V4      4       R # rT   )	r   rB   r!   pathsepr%  r&  r   r   r   )rO   bad_itempaths   & r-   test_pathsep_errorBasicTest.test_pathsep_error  sS    
 	t||||bjj0*dkk<@*dkk8L3IJr/   c           	        \        V P                  4       \        P                  p\        P
                  P                  \        P                  ! 4       4      pV P                  \         V4       \        P
                  P                  W P                  4      p\        P                  ! V4       \        P
                  P                  \        P                  4      p\        P                   ! \        P                  \        P
                  P                  W44      4       \        P
                  P                  W!V P"                  ^,          4      p\        P$                  ! V4       \        P
                  P                  VR4      p\&        P(                  ! R4      '       d   RMRpR\        P*                  P,                   \        P*                  P.                   V 2p\        P
                  P                  VVV4      p	. p
\        P
                   EF  pVP1                  R4      '       d^   \        P
                  P3                  V4      '       d7   \        P4                  ! V\        P
                  P                  W!4      4       Kv  Kx  \        P
                  P3                  \        P
                  P                  VR4      4      '       d   \        P6                  ! V4      p\9        W4      pV F  pW9   d   K  VR8X  d   K  \        P
                  P                  W4      p\        P
                  P3                  V4      '       d   \        P:                  ! W4       Kp  \        P
                  P=                  V4      '       g   K  \        P>                  ! V\        P
                  P                  W^4      \8        R7       K  	  EK  V
PA                  V4       EK  	  \        P
                  P                  W P                  V4      R	R
RRV P                  .p\        PB                  P                  V
4      p\&        P(                  ! R4      pV'       d   \&        PD                  ! 4       '       dK   \        P
                  PG                  \        P
                  PI                  \        P                  4      4      p\        PJ                  R8X  d   RpMRpRVVV/p\        PL                  PO                  R4      ;p'       d   VVR&   \P        PR                  ! VVR7       \        P
                  P                  V P                  V P                  V4      pVRRR.p\U        V4      w  ppV PW                  V	PY                  4       V9   4       R# )r   zos.pyr   tr   r8   z.zipr
  )ignorer   r   r   r   LIBDIRr   DYLD_LIBRARY_PATHLD_LIBRARY_PATH
PYTHONPATHASAN_OPTIONS)r   z-Sr   zimport sys; print(sys.path)N)-r   rB   rG   
platlibdirr!   r>   r?   r@   rA   
addCleanuprZ   rD   r  r   rP   rL  copy2r7   makedirsrE   r  version_infomajorminorr   r  copyfiler   r   copyr   copytreeappendr  r   abspathr   rK   r"   getr   rt  r.   r   r=  )rO   r  non_installed_dirrD   r   libdirlandmark
abi_thread
stdlib_zipzip_landmark'additional_pythonpath_for_non_installedeachpathnamesignored_namesrC   r   r(   
pythonpathld_library_pathld_library_path_env	child_envasan_optionstarget_pythonr+   r,   s   &                        r-   %test_zippath_from_non_installed_posix/BasicTest.test_zippath_from_non_installed_posix  s    	t|| ^^
GG,,X-=-=-?@ 12/=
WW%%cnn5
S^^RWW\\&%EF/TXXa[I
F77<<0%445FGGSR
c..445c6F6F6L6L5Mj\Z
ww||$5$.$.0 35/ H  ((77>>(++OO %6CE , Xw ?@@

8, 6x G!D, . h5Bww~~b))B/r**BGGLL,F/EG " 8>>+ !. ww||-{{JG+|| ZZ__35

 $228<)";";"="= ggoobggoocnn.MNO<<8#"5"3j#_
	 ::>>.99<9(4In%cy1 T\\4;;
KdD*GH$S++-45r/   c                   \         P                  ! V P                  4      p\        V4       V P                  vw  r#W,          R ,          p\
        P                  ! V4       \        VR4      ;_uu_ 4       p\        V^4       F  w  rgRV 2pV P                  VRV4       K  	  RRR4       R#   + '       g   i     R# ; i)rG  r  zCR LF found in line s   
N)
r   r   rB   r   r  r   r   rm   	enumerateassertNotEndsWith)	rO   venv_dirscripts_dirrj  script_pathru  ilineerror_messages	   &        r-   .test_activate_shell_script_has_no_dos_newlines8BasicTest.test_activate_shell_script_has_no_dos_newlines  s     <<-x"..+,z9H+t$$$VQ/"6qc :&&tWmD 0 %$$$s   4.B,,B=	c                    V P                  \        P                  V P                  R 0R7       V P	                  R4      P                  4       pV P                  RV4       R# )r   r   
.gitignore*N)rd   r   r   rB   rq   rQ  r   )rO   
file_liness   & r-   test_scm_ignore_files_git#BasicTest.test_scm_ignore_files_git  sO     	dkk4<<05w 	 	800>IIK
c:&r/   c                V  aa R oRo ! VV3R lR\         P                  4      pV! RR0R7      pV P                  VP                  V P                  4       V P                  R4      P                  4       pV P                  RV4       V P                  S4      pV P                  VS4       R	# )
z
.bzrignorez# For Bazaar.
*
c                   0   <a  ] tR tRt o VV3R ltRtV tR# )FBasicTest.test_create_scm_ignore_files_multiple.<locals>.BzrEnvBuilderi  c                   < \         P                  P                  VP                  S4      p\	        VR RR7      ;_uu_ 4       pVP                  S4       RRR4       R#   + '       g   i     R# ; i)rH  r   rl   N)r!   r>   rZ   rB   rm   r  )rO   r   gitignore_pathfilebzrignore_namecontentss   &&  r-   create_bzr_ignore_file]BasicTest.test_create_scm_ignore_files_multiple.<locals>.BzrEnvBuilder.create_bzr_ignore_file  sH    !#goo~!N.#@@DJJx( A@@@s   AA/	r   N)rs   rt   ru   rv   r  rx   ry   )r{   r  r  s   @r-   BzrEnvBuilderr    s     ) )r/   r  r   bzrr  r  r  N)	r   r   rd   r   rB   rq   rQ  r   r   )rO   r  r   gitignore_lines	bzrignorer  r  s   &    @@r-   %test_create_scm_ignore_files_multiple/BasicTest.test_create_scm_ignore_files_multiple  s    
 &'	) 	)DOO 	)  %@gnndll;55lCNNPc?+//?	H-r/   c                0   V P                  \        P                  V P                  4       V P	                  \
        4      ;_uu_ 4        V P                  R 4       RRR4       V P                  RV P                  R4      4       R#   + '       g   i     L3; i)r  Nr   r   )rd   r   r   rB   r%  FileNotFoundErrorrq   r   rU   s   &r-   "test_create_scm_ignore_files_empty,BasicTest.test_create_scm_ignore_files_empty-  sj     	dkk4<<8011''5 2 	211,?	A 21s   BB	c                    V P                  \        P                  R V P                  .4       V P	                  R4      P                  4       pV P                  RV4       R# )r   r  r  N)rd   r   mainrB   rq   rQ  r   )rO   r  s   & r-   test_cli_with_scm_ignore_files(BasicTest.test_cli_with_scm_ignore_files;  sH    
 	dii/4<<)HI55lCNNPc?+r/   c                    R RV P                   .pV P                  \        P                  V4       V P	                  \
        4      ;_uu_ 4        V P                  R4       RRR4       R#   + '       g   i     R# ; i)r   r   r  N)rB   rd   r   r  r%  r  rq   rg   s   & r-   !test_cli_without_scm_ignore_files+BasicTest.test_cli_without_scm_ignore_filesE  sX    
  !=t||Ldii.011''5 2111s   A))A:	c           	        \         P                  P                  p\        P                  R 8X  d   R\
        \
        3R\
        P                  ! 4       \
        P                  ! 4       3.p^ RIp\        P                  ! R4      pV'       d,   . VORWD3NRVP                  V4      VP                  V4      3NpM8R\
        \
        3R\
        P                  ! 4       \
        P                  ! 4       3.pV Fd  w  rVpV P                  V RV 24      ;_uu_ 4        V'       d   V P                  V! Wg4      4       MV P                  V! Wg4      4       RRR4       Kf  	  R#   + '       g   i     K{  ; i)r:   TNProgramFilesF-)r   r   
_same_pathrG   rK   r   lowerupper_winapir!   getenvGetShortPathNameGetLongPathNamer   r   r   )rO   	same_pathtestsr  	progfilesrk   path1path2s   &       r-   test_venv_same_pathBasicTest.test_venv_same_pathP  s-   OO..	<<7" vv&v||~v||~6E 		.1I90 733I>@W@WXa@bc vv&7E  %OAeq011OOIe$;<$$Yu%<=	 21  %111s   8EE+c                   \        V P                  4       \        P                  ! V P                  4       V P                  pR V9   d   RV9   g   VP                  R R4      p\        P                  P                  V P                  V P                  V4      p \        P                  ! VRRV,          .4       R#   \        P                   d    T P                  RT,          4        R# i ; i)r8   pythonwr   z6import sys; assert sys._base_executable.endswith('%s')z venvwlauncher.exe did not run %sN)r   rB   r   r   rJ   replacer!   r>   rZ   rD   r   rt  r'   fail)rO   exenameenvpyws   &  r-   test_venvwlauncherBasicTest.test_venvwlaunchero  s     	t||DLL!((wyG';ooh	:GdllDKKA	D!!64 2=?F2G #H I,, 	DII87BC	Ds    B: :-C+*C+r   N))r4   )r5   r;   )r<   r
  )r6   )r9   )r7   )7rs   rt   ru   rv   r   r   r   r   r   r   r   requireVenvCreater   r  unittest
skipUnlessr   r  rG   rK   r  r  r  r  r!  r(  r,  r3  r8  r>  rA  skipIfr!   rC   rU  rZ  r_  re  rl  rp  rv  ry  r}  r  r  r  r  r  r  r  r  r  r  rx   ry   rz   s   @r-   r}   r}   r   s    +//J:CB58&;P = =$ = =@ (89= : =B ||w
 MC$4$4R$889MC$4$4R$88/J

(1$/N*K (898 :8. 	6 	6 (89
6 :
6 __RWW_&NO9 P92 __RWW_&NO9 P92 D*DE9 F9, D*DE+ F+ D::[].0^0^ 9 9$ 	M 	M __RWW_&?@+ A+$ 13KL8 M8K __RWW_&?@T6  AT6l E E  ' ' . ., A A , , 6 6>> D*DED F Dr/   r}   c                      a  ] tR tRt o R tR tR tR tR t]	P                  R 4       t]! 4       ]! R4      R	 4       4       tR
tV tR# )EnsurePipTesti  c                    \        V P                  R R7      RR.4      w  rVP                  R4      pV P                  VR4       VP                  R4      pV P                  VP	                  4       R4       R# )Tr;  r   z1try:
 import pip
except ImportError:
 print("OK")latin-1r   OKN)r.   r[   r&   r   r   ro  s   &  r-   assert_pip_not_installed&EnsurePipTest.assert_pip_not_installed  sk    !>B!D E jj#b!jj#d+r/   c                    \        V P                  4       V P                  \        P                  V P                  4       V P                  4        R # rT   r   rB   rd   r   r   r  rU   s   &r-   test_no_pip_by_default$EnsurePipTest.test_no_pip_by_default  s2    t||dkk4<<8%%'r/   c                    \        V P                  4       V P                  \        P                  V P                  R R7       V P                  4        R# )F)r   Nr  rU   s   &r-   test_explicit_no_pip"EnsurePipTest.test_explicit_no_pip  s7    t||dkk4<<%H%%'r/   c                :   \        \        P                  R 4      ;_uu_ 4       pV P                  VP	                  4       R4       RRR4       V P                  \        P                  P                  \        P                  4      4       R#   + '       g   i     LN; i)r  r/   N)rm   r!   devnullr   rn   r   r>   rM   )rO   ro   s   & r-   test_devnullEnsurePipTest.test_devnull  sZ    
 "**d##qQVVXs+ $ 	rzz23 $#s   !B

B	c                   \        V P                  4       \        4       ;_uu_ 4       pR VR&   RVR&   \        P                  ! 4       ;_uu_ 4       pW2R&   RpRpRpV3 F  w  rx\
        P                  P                  W74      p	\
        P                  ! V	4       \
        P                  P                  W4      p
\        V
R4      ;_uu_ 4       pVP                  V4       RRR4       K  	  V P                  4       ;_uu_ 4        V P                  \        P                  V P                  VR	R
7       RRR4       RRR4       RRR4       \        V P!                  R	R7      RRRRRRRR.	4      w  rVP#                  R4      pV P%                  VR4       VP#                  R4      pRP'                  \(        P*                  ! 4       4      pV P-                  W4       \
        P.                  ! V P                  4      P#                  R4      pV P1                  W4       \        4       ;_uu_ 4       pV P                  4       ;_uu_ 4        R VR&   \        V P!                  R	R7      RRRRRRR.4      w  rRRR4       RRR4       VP#                  R4      p\2        P4                  ! RRV\2        P6                  R7      p ^ RIpV P%                  VP=                  4       R4       VP#                  R4      pV P1                  RV4       V'       g   V P?                  4        R# R#   + '       g   i     EK  ; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL ; i  + '       g   i     EL; i  + '       g   i     EL; i  \:         d-    \2        P4                  ! RRT\2        P6                  R7      p ELi ; i)r  PYTHONWARNINGS1PIP_NO_INSTALLHOMEz[global]
no-install=1r   rH  NT)r   r   r;  z-Wzignore::DeprecationWarningzignore::ImportWarningrs  r   z	--versionr  r   zpip {}zensurepip._uninstallzl^(WARNING: )?The directory .* or its parent directory is not owned or is not writable by the current user.*$)flagsz<^WARNING: Disabling truststore since ssl support is missing$zSuccessfully uninstalled pip)r   zpip.ini)z.pipzpip.conf) r   rB   r   r@   r   r!   r>   rZ   r  rm   r  nicer_errorrd   r   r   r.   r[   r&   r   format	ensurepipversionassertStartsWithfsencoder   resub	MULTILINEsslImportErrorrstripr  )rO   r   envvarshome_dir
bad_configwin_locationposix_locationr   fnamedirpathfpathro   r+   r,   expected_versionrB   r  s   &&               r-   do_test_with_pipEnsurePipTest.do_test_with_pip  s   t|| ""g )1G$% ),G$% ,,..("*5
  2!5'5&7NG ggll8=GHHW%GGLL8EeS))Q
+ *)	 '8 %%''))$++t||?S37 * 9 (# / #H  !>1,dUK!) * jj#b!jj##??9+<+<+>?c4++dll+229=g#
 !""g!!## -5()')F6140)2 3	 $ # jj# ff NOQ.	) 	r* jj#4c: $))+ $E *))
 (''# /.. #""l $## #""0  	)&&N2<<)C	)s   (MA;M	L$M	.L./M	7M(M>+M*	,M>6N L+$
M	.L?9	M	M	MM'	*M;5	M>>N	3O	O	c              #  (  "    R x  R #   \         P                   dq   pTP                  ;'       g    RP                  RR7      pTP                  ;'       g    RP                  RR7      pT P                  T RT RT 24        R p?R # R p?ii ; i5i)Nr/   r  )errorsz

**Subprocess Output**
z

**Subprocess Error**
)r   r'   rb   r&   r   r  )rO   excr+   r,   s   &   r-   r  EnsurePipTest.nicer_error  s     		,, 	::$$,,I,>C::$$,,I,>CII% **- /)),/ 	s0   B
 BB8B
,B
B
BBcpuc                J    V P                  R 4       V P                  R4       R# )FTN)r"  rU   s   &r-   test_with_pipEnsurePipTest.test_with_pip  s      	e$d#r/   r   N)rs   rt   ru   rv   r  r  r  r  r"  
contextlibcontextmanagerr  r   r   r*  rx   ry   rz   s   @r-   r  r    s^     ,(
(
4^,@  $ u$  $r/   r  __main__rT   )5r,  r  r!   os.pathr   r  rL  r   r   rG   rE   r@   rO  test.supportr   r   r   r   r   r   r	   r
   r   r   r   r   test.support.os_helperr   r   r   r   r   r  r   unittest.mockr   r   ctypesr  r  r   r   rH   rP   r  SkipTestr.   TestCaser1   r}   r  rs   r  r   r/   r-   <module>r6     sF     	   	    
   E E E E6 6   % ''JJ#//! . .
s~~-@B 
 I


D
EE $-x   -^ND NDb X$H X$ X$v zMMO y  Fs   0E 	EE