Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/test_tools/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/test_tools/__pycache__/test_pathfix.cpython-39.opt-2.pyc

a

XC?h��@shddlZddlZddlZddlZddlmZddlmZmZe�Gdd�dej	�Z
edkrde��dS)�N)�support)�
scriptsdir�skip_if_missingc@sTeZdZej�ed�Zdd�Zddd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdS)�TestPathfixFunctionalz
pathfix.pycCs|�tjtj�dS)N)�
addCleanupr�unlink�TESTFN��self�r�A/opt/alt/python39/lib64/python3.9/test/test_tools/test_pathfix.py�setUpszTestPathfixFunctional.setUpr�cCs�|rtj�|d�}|}n
tj}|}t|ddd��$}	|	�|�d�d�Wd�n1sZ0Yt��}
t	j
tj|jg|�d�|�itj
�d|
i�d	d
�}|dkr�|jdkr�|�d
�}|�|j||�|�|j�|
�|�dtj�|�|�|j�|
�|�dtj�|�t|ddd��}	|	��}Wd�n1�s80Y|�d�}
|�|
dd�ddg�|
d}|jdk�r�|�||�|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)r
ZshebangZ
pathfix_flags�exitcoder$r(�	directory�filenameZpathfix_arg�fr�proc�output�linesZnew_shebangrrr�pathfixs@2
����
  (
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)
rrrZrmtreer�mkdirr�basenamer#r2)r
ZtmpdirZexpected_stderrrrr�test_recursive:s

��z$TestPathfixFunctional.test_recursivecCs4|�|�dddg�d�|�|�dddg�d�dS)Nr3r4r5r6�#! /usr/bin/env python -R�r#r2r	rrr�test_pathfixGs����z"TestPathfixFunctional.test_pathfixcCs4|�|�dgd��d�|�|�dgd��d�dS)Nr:)r4r5�-kz#! /usr/bin/python3 -Rr3r6r;r	rrr�test_pathfix_keeping_flagsSs����z0TestPathfixFunctional.test_pathfix_keeping_flagscCs||�|�dgd��d�|�|�dgd��d�|�|�dgd��d�|�|�dgd��d	�|�|�d
gd��d�dS)
Nr3)r4r5�-a�sz#! /usr/bin/python3 -sz#! /usr/bin/env python -Sz#! /usr/bin/env python -V)r4r5r?�vr=z#! /usr/bin/python3 -vV)r4r5r?ZRsz#! /usr/bin/python3 -Rsz!#! /usr/bin/env python -W default)r4r5r?r@r=z#! /usr/bin/python3 -sW defaultr;r	rrr�test_pathfix_adding_flag_sF����������z.TestPathfixFunctional.test_pathfix_adding_flagcCs|jdgd�ddd�dS)Nz#! /usr/bin/env python -E)r4r5r?z	W defaultr=�z%-a option doesn't support whitespaces)r+r()r2r	rrr�test_pathfix_adding_errorszs�z0TestPathfixFunctional.test_pathfix_adding_errorsN)rrrr)�__name__�
__module__�__qualname__rrrrr r
r2r9r<r>rBrDrrrrr
s�
'
r�__main__)
rrrZunittest�testrZtest.test_toolsrrZTestCaserrE�mainrrrr�<module>su