Your IP : 216.73.216.213


Current Path : /opt/alt/python310/lib64/python3.10/test/test_tools/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/test_tools/__pycache__/test_pathfix.cpython-310.pyc

o

0�i��@sxddlZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
e
�Gdd�dej�Ze
dkr:e��dSdS)�N)�support)�	os_helper)�
scriptsdir�skip_if_missingc@sXeZdZej�ed�Zdd�Z		ddd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdS)�TestPathfixFunctionalz
pathfix.pycCs|�tjtj�dS)N)�
addCleanupr�unlink�TESTFN��self�r�C/opt/alt/python310/lib64/python3.10/test/test_tools/test_pathfix.py�setUpszTestPathfixFunctional.setUpr�cCs�|rtj�|d�}|}ntj}|}t|ddd��}	|	�|�d�d�Wd�n1s-wYt��}
t	j
tj|jg|�d�|�itj
�d|
i�d	d
�}|dkr]|jdkr]|�d
�}|�|j||�|�|j�|
�|�dtj�|�|�|j�|
�|�dtj�|�t|ddd��}	|	��}Wd�n1s�wY|�d�}
|�|
dd�ddg�|
d}|jdkr�|�||�|S)Nz
script-A_1.py�w�utf8)�encoding�
zprint("Hello world")
z-nZPYTHONIOENCODINGT)�envZcapture_outputrrz: updating
�r�zprint("Hello world"))�os�path�joinrr	�open�write�sys�getfilesystemencoding�
subprocess�run�
executable�script�environ�
returncode�assertEqual�stdout�decode�replace�linesep�stderr�read�split)rZshebangZ
pathfix_flags�exitcoder%r)�	directory�filenameZpathfix_arg�fr�proc�output�linesZnew_shebangrrr
�pathfixsD�
����
  
�

zTestPathfixFunctional.pathfixcCsXtjd}|�tj|�t�|�dtj�|��d�}|�|j	dddg||d�d�dS)	Nz.dz
recursedown('z')
�#! /usr/bin/env python�-i�/usr/bin/python3)r-r)�#! /usr/bin/python3)
rr	rZrmtreer�mkdirr�basenamer$r3)rZtmpdirZexpected_stderrrrr
�test_recursive;s

��z$TestPathfixFunctional.test_recursivecCs4|�|�dddg�d�|�|�dddg�d�dS)Nr4r5r6r7�#! /usr/bin/env python -R�r$r3r
rrr
�test_pathfixH�����z"TestPathfixFunctional.test_pathfixcCs4|�|�dgd��d�|�|�dgd��d�dS)Nr;)r5r6�-kz#! /usr/bin/python3 -Rr4r7r<r
rrr
�test_pathfix_keeping_flagsTr>z0TestPathfixFunctional.test_pathfix_keeping_flagscCs||�|�dgd��d�|�|�dgd��d�|�|�dgd��d�|�|�dgd��d	�|�|�d
gd��d�dS)
Nr4)r5r6�-a�sz#! /usr/bin/python3 -sz#! /usr/bin/env python -Sz#! /usr/bin/env python -V)r5r6rA�vr?z#! /usr/bin/python3 -vV)r5r6rAZRsz#! /usr/bin/python3 -Rsz!#! /usr/bin/env python -W default)r5r6rArBr?z#! /usr/bin/python3 -sW defaultr<r
rrr
�test_pathfix_adding_flag`sF����������z.TestPathfixFunctional.test_pathfix_adding_flagcCs|jdgd�ddd�dS)Nz#! /usr/bin/env python -E)r5r6rAz	W defaultr?�z%-a option doesn't support whitespaces)r,r))r3r
rrr
�test_pathfix_adding_errors{s
�z0TestPathfixFunctional.test_pathfix_adding_errorsN)rrrr)�__name__�
__module__�__qualname__rrrrr!rr3r:r=r@rDrFrrrr
rs
�'
r�__main__)rrrZunittest�testrZtest.supportrZtest.test_toolsrrZTestCaserrG�mainrrrr
�<module>su�