
    9\h                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
  e
              G d dej                  Zedk    r ej                     dS dS )    N)support)	os_helper)
scriptsdirskip_if_missingc                   t    e Zd Zej                            ed          Zd Z	 	 ddZ	d Z
d Zd Zd	 Zd
 ZdS )TestPathfixFunctionalz
pathfix.pyc                 Z    |                      t          j        t          j                   d S )N)
addCleanupr   unlinkTESTFNselfs    F/opt/python-3.11.14/usr/lib/python3.11/test/test_tools/test_pathfix.pysetUpzTestPathfixFunctional.setUp   s"    	()*:;;;;;    r    c                 h   |r#t           j                            |d          }|}nt          j        }|}t          |dd          5 }	|	                    | ddz              d d d            n# 1 swxY w Y   t          j                    }
t          j
        t          j        | j        g|d|i t           j        d|
id	
          }|dk    r|j        dk    r| d}|                     |j        ||           |                     |j                            |
          |                    dt           j                  |           |                     |j                            |
          |                    dt           j                  |           t          |dd          5 }	|	                                }d d d            n# 1 swxY w Y   |                    d          }|                     |dd          ddg           |d         }|j        dk    r|                     ||           |S )Nzscript-A_1.pywutf8)encoding
zprint("Hello world")
z-nPYTHONIOENCODINGT)envcapture_outputr   r   z: updating
r   zprint("Hello world"))ospathjoinr   r   openwritesysgetfilesystemencoding
subprocessrun
executablescriptenviron
returncodeassertEqualstdoutdecodereplacelinesepstderrreadsplit)r   shebangpathfix_flagsexitcoder+   r/   	directoryfilenamepathfix_argfr   procoutputlinesnew_shebangs                  r   pathfixzTestPathfixFunctional.pathfix   s    	# w||I??H#KK 'H"K(C&111 	?QGGwNNN%==>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? ,..~^T[ 00!0#.0<2:<18<<	! ! ! R<<DOq00 ...F(D999++H55v~~dBJ7W7WY]^^^++H55v~~dBJ7W7WY]^^^(C&111 	QVVXXF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 T""qrr%;R$@AAAAh?aWk222s$   A..A25A2(G		GGc                 0   t           j        dz   }|                     t           j        |           t	          j        |           dt          j                            |           d}|                     | 	                    dddg||          d           d S )	Nz.dzrecursedown('z')
#! /usr/bin/env python-i/usr/bin/python3)r5   r/   #! /usr/bin/python3)
r   r   r
   rmtreer   mkdirr   basenamer*   r=   )r   tmpdirexpected_stderrs      r   test_recursivez$TestPathfixFunctional.test_recursive;   s    !D(	(&111
H"'*:*:6*B*BHHHLL()* &	  ( (
 "	# 	# 	# 	# 	#r   c                     |                      |                     dddg          d           |                      |                     dddg          d           d S )Nr?   r@   rA   rB   #! /usr/bin/env python -Rr*   r=   r   s    r   test_pathfixz"TestPathfixFunctional.test_pathfixH   s    LL()*, , "		# 	# 	#
 	LL+)*, , "		# 	# 	# 	# 	#r   c                     |                      |                     dg d          d           |                      |                     dg d          d           d S )NrJ   )r@   rA   -kz#! /usr/bin/python3 -Rr?   rB   rK   r   s    r   test_pathfix_keeping_flagsz0TestPathfixFunctional.test_pathfix_keeping_flagsT   s    LL+0002 2 %		& 	& 	&
 	LL(0002 2 "		# 	# 	# 	# 	#r   c                    |                      |                     dg d          d           |                      |                     dg d          d           |                      |                     dg d          d           |                      |                     dg d          d	           |                      |                     d
g d          d           d S )Nr?   )r@   rA   -asz#! /usr/bin/python3 -sz#! /usr/bin/env python -Sz#! /usr/bin/env python -V)r@   rA   rQ   vrN   z#! /usr/bin/python3 -vV)r@   rA   rQ   Rsz#! /usr/bin/python3 -Rsz!#! /usr/bin/env python -W default)r@   rA   rQ   rR   rN   z#! /usr/bin/python3 -sW defaultrK   r   s    r   test_pathfix_adding_flagz.TestPathfixFunctional.test_pathfix_adding_flag`   s6   LL(5557 7 %		& 	& 	&
 	LL+5557 7 %		& 	& 	&
 	LL+;;;= = &		' 	' 	'
 	LL(6668 8 &		' 	' 	'
 	LL3;;;= = .		/ 	/ 	/ 	/ 	/r   c                 <    |                      dg ddd           d S )Nz#! /usr/bin/env python -E)r@   rA   rQ   z	W defaultrN      z%-a option doesn't support whitespaces)r4   r/   )r=   r   s    r   test_pathfix_adding_errorsz0TestPathfixFunctional.test_pathfix_adding_errors{   s9    '???:	 	 	< 	< 	< 	< 	<r   N)r   r   r   r   )__name__
__module____qualname__r   r   r   r   r'   r   r=   rH   rL   rO   rU   rX    r   r   r   r      s        W\\*l33F< < < MO% % % %N# # #
# 
# 
#
# 
# 
#/ / /6< < < < <r   r   __main__)r   r$   r"   unittesttestr   test.supportr   test.test_toolsr   r   TestCaser   rY   mainr\   r   r   <module>rd      s    				     



        " " " " " " 7 7 7 7 7 7 7 7    r< r< r< r< r<H- r< r< r<j zHMOOOOO r   