
    e
                        d Z ddlZddlZddlZddlZddlmZmZ ddlm	Z	 ddl
mZ ddl
mZ ddlmZ ddlmZ  e             G d	 d
ej        ej        ej                              Zedk    r ej                     dS dS )zTests for distutils.spawn.    N)
unix_shellrequires_subprocess)	os_helper)find_executable)spawn)DistutilsExecError)supportc                   \    e Zd Z ej        ej        dv d          d             Zd Zd Z	dS )SpawnTestCase)ntposixzRuns only under posix or ntc                    |                                  }t          j        dk    r?t          j                            |d          }|                     |dt          z             n6t          j                            |d          }|                     |d           t          j        |d           | 	                    t          t          |g           t          j        dk    r?t          j                            |d          }|                     |dt          z             n6t          j                            |d          }|                     |d           t          j        |d           t          |g           d S )	Nwin32zfoo.shz#!%s
exit 1zfoo.batzexit 1i  z#!%s
exit 0zexit 0)mkdtempsysplatformospathjoin
write_filer   chmodassertRaisesr   r   )selftmpdirexes      ,  /home/conda/feedstock_root/build_artifacts/python-split_1708115622739/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/distutils/tests/test_spawn.py
test_spawnzSpawnTestCase.test_spawn   s3     <7""',,vx00COOC*!<====',,vy11COOC***
e,ecU;;; <7""',,vx00COOC*!<====',,vy11COOC***
ese    c           
      \
   t          j                    5 }t           j        }|dz   }t          j                            ||          }t          |d          5  	 d d d            n# 1 swxY w Y   t          j        |t          j	                   t          ||          }|                     ||           t          j        dk    r't          ||          }|                     ||           t          j        |          5  t          |          }|                     ||           d d d            n# 1 swxY w Y   d|z   }t          ||          }|                     |           t          j                    5 }d|d<   t"          j                            d|d	
          5  t"          j                            d|          5  t          |          }|                     |           t          j        |          5  t          |          }|                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j                    5 }t          j        |d<   t"          j                            ddd	
          5  t"          j                            dd          5  t          |          }|                     |           t          j        |          5  t          |          }|                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j                    5 }|                    dd            t"          j                            dt,          d	          5  t"          j                            d|          5  t          |          }|                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t"          j                            d|d	
          5  t"          j                            dd          5  t          |          }|                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nz.exewb)r   r   
dontexist_ PATHzdistutils.spawn.os.confstrT)return_valuecreatezdistutils.spawn.os.defpath)side_effectr%   )r   temp_dirTESTFNr   r   r   openr   statS_IXUSRr   assertEqualr   r   
change_cwdassertIsNoneEnvironmentVarGuardunittestmockpatchpathseppop
ValueError)r   tmp_dirprogram_noeextprogramfilenamervdont_exist_programenvs           r   test_find_executablez"SpawnTestCase.test_find_executable0   s   !! N	3W&-N %v-Gw||GW55Hh%%                HXt|,,, !w777BR***|w&&$^'BBB  X... %g.. . .$W--  W---. . . . . . . . . . . . . . .
 ".!7 !37CCCBb!!! .00 6C F](()E6=d ) L L 
6 
6](()E)02 2
6 
6 )11B%%b))) #-g66 6 6,W55((W5556 6 6 6 6 6 6 6 6 6 6 6 6 6 6
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
6 
66 6 6 6 6 6 6 6 6 6 6 6 6 6 6 .00 6C jF](()E68 ) G G 	6 	6](()ErJJ	6 	6 )11B%%b))) #-g66 6 6,W55((W5556 6 6 6 6 6 6 6 6 6 6 6 6 6 6	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	66 6 6 6 6 6 6 6 6 6 6 6 6 6 6 .00 3C%%% ](()E5?04 ) 6 6 3 3 ](()E)02 23 3
 )11B$$R2223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ](()E6=d ) L L 3 3](()ErJJ3 3 )11B$$R222	3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3{N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3 N	3s0  AT!A$T!$A(	(T!+A(	,BT! &D2&T!2D6	6T!9D6	:AT!;(I4#!I9I	=&H/#I	/H33I	6H37I	:II

II
II4I!!I4$I!%I4(T!4I8	8T!;I8	<T!2N!M>%9M'	&MM'	MM'	MM'	M>'M++M>.M+/M>2N>NNNN	T!N	T!N	T!3>T	1!Q&Q	8QQQQQT	QT	"Q#%T	!S2)&S	S2SS2"S#S2&T	2S66T	9S6:T	=T!	T	T!T	T!!T%(T%c                     |                      t                    5 }t          dg           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Nzdoes-not-existzcommand 'does-not-exist' failed)r   r   r   assertInstr	exception)r   ctxs     r   test_spawn_missing_exez$SpawnTestCase.test_spawn_missing_exe   s    122 	&c#$%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&7S]9K9KLLLLLs   8<<N)
__name__
__module____qualname__r0   
skipUnlessr   namer   r=   rC    r   r   r   r      st        
 XO368 8 8 84O3 O3 O3bM M M M Mr   r   __main__)__doc__r   r*   r   unittest.mockr0   test.supportr   r   r   distutils.spawnr   r   distutils.errorsr   distutils.testsr	   TempdirManagerLoggingSilencerTestCaser   rD   mainrI   r   r   <module>rU      s*       				  



     8 8 8 8 8 8 8 8 " " " " " " + + + + + + ! ! ! ! ! ! / / / / / / # # # # # # tM tM tM tM tMG*+%tM tM tMn zHMOOOOO r   