HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_tools/__pycache__/test_pathfix.cpython-310.opt-1.pyc
o

�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�9/usr/local/lib/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)�env�capture_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	r�rmtreer�mkdirr�basenamer%r4)rZtmpdirZexpected_stderrrrr
�test_recursive;s

��z$TestPathfixFunctional.test_recursivecCs4|�|�dddg�d�|�|�dddg�d�dS)Nr5r6r7r8�#! /usr/bin/env python -R�r%r4r
rrr
�test_pathfixH�����z"TestPathfixFunctional.test_pathfixcCs4|�|�dgd��d�|�|�dgd��d�dS)Nr=)r6r7�-kz#! /usr/bin/python3 -Rr5r8r>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)
Nr5)r6r7�-a�sz#! /usr/bin/python3 -sz#! /usr/bin/env python -Sz#! /usr/bin/env python -V)r6r7rC�vrAz#! /usr/bin/python3 -vV)r6r7rCZRsz#! /usr/bin/python3 -Rsz!#! /usr/bin/env python -W default)r6r7rCrDrAz#! /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)r6r7rCz	W defaultrA�z%-a option doesn't support whitespaces)r-r*)r4r
rrr
�test_pathfix_adding_errors{s
�z0TestPathfixFunctional.test_pathfix_adding_errorsN)rrrr)�__name__�
__module__�__qualname__rrrrr"rr4r<r?rBrFrHrrrr
rs
�'
r�__main__)rrrZunittest�testrZtest.supportrZtest.test_toolsrrZTestCaserrI�mainrrrr
�<module>su�