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/__pycache__/test_cmd_line_script.cpython-310.opt-1.pyc
o

�i���@s
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZmZmZmZmZmZmZmZe
jZgd�ZdZefdd	�Zed
fdd�ZGd
d�dej�Z dd�Z!e"dkr�e�#�dSdS)�N)�support)�
import_helper)�	os_helper)�make_pkg�make_script�make_zip_pkg�make_zip_script�assert_python_ok�assert_python_failure�spawn_python�kill_python)Ztest1Ztest2Ztest3a�# Script may be run with optimisation enabled, so don't rely on assert
# statements being executed
def assertEqual(lhs, rhs):
    if lhs != rhs:
        raise AssertionError('%r != %r' % (lhs, rhs))
def assertIdentical(lhs, rhs):
    if lhs is not rhs:
        raise AssertionError('%r is not %r' % (lhs, rhs))
# Check basic code execution
result = ['Top level assignment']
def f():
    result.append('Lower level reference')
f()
assertEqual(result, ['Top level assignment', 'Lower level reference'])
# Check population of magic variables
assertEqual(__name__, '__main__')
from importlib.machinery import BuiltinImporter
_loader = __loader__ if __loader__ is BuiltinImporter else type(__loader__)
print('__loader__==%a' % _loader)
print('__file__==%a' % __file__)
print('__cached__==%a' % __cached__)
print('__package__==%r' % __package__)
# Check PEP 451 details
import os.path
if __package__ is not None:
    print('__main__ was located through the import system')
    assertIdentical(__spec__.loader, __loader__)
    expected_spec_name = os.path.splitext(os.path.basename(__file__))[0]
    if __package__:
        expected_spec_name = __package__ + "." + expected_spec_name
    assertEqual(__spec__.name, expected_spec_name)
    assertEqual(__spec__.parent, __package__)
    assertIdentical(__spec__.submodule_search_locations, None)
    assertEqual(__spec__.origin, __file__)
    if __spec__.cached is not None:
        assertEqual(__spec__.cached, __cached__)
# Check the sys module
import sys
assertIdentical(globals(), sys.modules[__name__].__dict__)
if __spec__ is not None:
    # XXX: We're not currently making __main__ available under its real name
    pass # assertIdentical(globals(), sys.modules[__spec__.name].__dict__)
from test import test_cmd_line_script
example_args_list = test_cmd_line_script.example_args
assertEqual(sys.argv[1:], example_args_list)
print('sys.argv[0]==%a' % sys.argv[0])
print('sys.path[0]==%a' % sys.path[0])
# Check the working directory
import os
print('cwd==%a' % os.getcwd())
cCst|||�}t��|S�N)r�	importlib�invalidate_caches)�
script_dir�script_basename�source�	to_return�r�6/usr/local/lib/python3.10/test/test_cmd_line_script.py�_make_test_scriptPsr�cCst||||||�}t��|Sr
)rrr)Zzip_dirZzip_basenameZpkg_namerr�depthrrrr�_make_test_zip_pkgUs

�rc@s�eZdZ	dpdd�Zdd�dd�Zdd�dd�Zd	d
�Zdd�Zej	dqdd��Z
dqdd�Zdqdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&ej	dHdI��Z'dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dRdS�Z,dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4ddde�Z5dfdg�Z6dhdi�Z7djdk�Z8e9�:e;j<�=dl�dm�dndo��Z>dS)r�CmdLineTestNc
Cstdkrtd|�tt|��|�|d�d|}
d|}d|}d|}
d|}|	dur2t��}	d	|	}tdkrNtd
�t|�t|�t|
�t|�|�|
�d�|�|�|�d�|�|�|�d�|�|�|
�d�|�|�|�d�|�|�|�d�|�dS)NrzOutput from test script %r:rz__loader__==%az__file__==%az__package__==%rzsys.argv[0]==%azsys.path[0]==%azcwd==%azExpected output:�utf-8)�verbose�print�repr�assertEqual�os�getcwd�assertIn�encode)�self�script_nameZ	exit_code�data�
expected_file�expected_argv0�expected_path0�expected_package�expected_loader�expected_cwdZprinted_loaderZprinted_fileZprinted_packageZ
printed_argv0Z
printed_path0Zprinted_cwdrrr�
_check_output]s0zCmdLineTest._check_output��cwdcOsdt|t�r|g}gt���|�|�t�}
t|
d|d�|	��\}}}
|�||||
||||||�	dS)NF��
__isolatedZ__cwd)�
isinstance�strrZ!optim_args_from_interpreter_flags�example_argsr	r-)r$�script_exec_argsr'r(r)r*r+r/�cmd_line_switches�env_vars�run_args�rc�out�errrrr�
_check_scriptzs$

������zCmdLineTest._check_scriptc
Os�t|t�r	|f}nt|�}||}t|d|d�|��\}}}	tdkr6td|����tt|	��td|�|�|�d�|	�dS)NFr0rzOutput from test script zExpected output: %rr)	r2r3�tupler
rrrr"r#)
r$r5Zexpected_msgr/r6r7r8r9r:r;rrr�_check_import_error�s
��zCmdLineTest._check_import_errorcCs2tdd�\}}}ttjj��d�}|�||�dS)N�-czprint(__loader__)r)r	rr�	machinery�BuiltinImporterr#r")r$r9r:r;�expectedrrr�test_dash_c_loader�szCmdLineTest.test_dash_c_loadercCsVt�}z|j�d�|j��Wt|�}nt|�}wttjj��	d�}|�
||�dS)Nsprint(__loader__)
r)r�stdin�write�flushrrrr@rAr#r")r$�pr:rBrrr�test_stdin_loader�szCmdLineTest.test_stdin_loaderFccs��|rtdtjd�}|j}n
tdtjd�}|j}z	|�d�}|dkr$n|��q|VWt|�|�	�dSt|�|�	�w)Nz-i)�stderrT�s>>> )
r�
subprocess�PIPErI�STDOUT�stdout�read�readliner�close)r$�separate_stderrrGrIr&rrr�interactive_python�s$�
��
zCmdLineTest.interactive_pythoncCs\|�|��}|j�d�|j��|�d|j�����Wd�dS1s'wYdS)Ns
print('foo')
sfoo)rSrDrErFrrNrP�strip)r$rRrGrrr�check_repl_stdout_flush�s

"�z#CmdLineTest.check_repl_stdout_flushcCs�|�|��4}|j�d�|j��|r|jn|j}|�d|���|�d|���|�d|���Wd�dS1s<wYdS)Ns1/0
s
Traceback sFile "<stdin>"sZeroDivisionError)rSrDrErFrIrNr"rP)r$rRrGrIrrr�check_repl_stderr_flush�s
"�z#CmdLineTest.check_repl_stderr_flushcC�|��dSr
�rU�r$rrr�test_repl_stdout_flush��z"CmdLineTest.test_repl_stdout_flushcC�|�d�dS�NTrXrYrrr�&test_repl_stdout_flush_separate_stderr��z2CmdLineTest.test_repl_stdout_flush_separate_stderrcCrWr
�rVrYrrr�test_repl_stderr_flush�r[z"CmdLineTest.test_repl_stderr_flushcCr\r]r`rYrrr�&test_repl_stderr_flush_separate_stderr�r_z2CmdLineTest.test_repl_stderr_flush_separate_stderrc
CsTt���}t|d�}|j||||dtjj|d�Wd�dS1s#wYdS)N�script)r,�r�temp_dirrr<rr@�SourceFileLoader�r$rr%rrr�test_basic_script�s


�"�zCmdLineTest.test_basic_scriptc	Cspt���*}|�tj�|�|�t|d�}tj�|�}|�||||dt	j
j�Wd�dS1s1wYdS)Nrc)rZtemp_cwd�
assertTruer �path�isabsr�basenamer<rr@rf)r$rr%Z
relative_namerrr�test_script_abspath�s


�"�zCmdLineTest.test_script_abspathc	Csrt���+}t|d�}tj|dd�t�|�t�|�}|�	||||dt
jj�Wd�dS1s2wYdS)NrcT��doraise�
rrer�
py_compile�compiler �remover�make_legacy_pycr<rr@�SourcelessFileLoader�r$rr%�pyc_filerrr�test_script_compiled�s



�"�z CmdLineTest.test_script_compiledc	CsPt���}t|d�}|�||||dtjj�Wd�dS1s!wYdS)N�__main__�rdrgrrr�test_directory�s


�"�zCmdLineTest.test_directoryc	Csrt���+}t|d�}tj|dd�t�|�t�|�}|�	||||dt
jj�Wd�dS1s2wYdS)NryTrnrzrprvrrr�test_directory_compiled�s




�"�z#CmdLineTest.test_directory_compiledcCsBt���}d|}|�||�Wd�dS1swYdS)N�"can't find '__main__' module in %r)rrer>)r$r�msgrrr�test_directory_error	s
"�z CmdLineTest.test_directory_errorc	Cs^t���!}t|d�}t|d|�\}}|�||||dtj�Wd�dS1s(wYdS)Nry�test_ziprz)rrerrr<�	zipimport�zipimporter)r$rr%�zip_name�run_namerrr�test_zipfiles

�"�zCmdLineTest.test_zipfilec	C�rt���+}t|d�}tj|dtjjd�}t|d|�\}}|�||||dt	j
�Wd�dS1s2wYdS�NryT)ro�invalidation_moder�rz)rrerrqrr�PycInvalidationMode�	TIMESTAMPrr<r�r��r$rr%�
compiled_namer�r�rrr�test_zipfile_compiled_timestamp�

��"�z+CmdLineTest.test_zipfile_compiled_timestampc	Cr�r�)rrerrqrrr��CHECKED_HASHrr<r�r�r�rrr�"test_zipfile_compiled_checked_hashr�z.CmdLineTest.test_zipfile_compiled_checked_hashc	Cr�r�)rrerrqrrr��UNCHECKED_HASHrr<r�r�r�rrr�$test_zipfile_compiled_unchecked_hash)r�z0CmdLineTest.test_zipfile_compiled_unchecked_hashcCs\t��� }t|d�}t|d|�\}}d|}|�||�Wd�dS1s'wYdS)NZnot_mainr�r})rrerrr>)r$rr%r�r�r~rrr�test_zipfile_error3s

"�zCmdLineTest.test_zipfile_errorc
Csnt���)}tj�|d�}t|�t|d�}|jddg|||dtj	j
|d�Wd�dS1s0wYdS)N�test_pkgrc�-m�test_pkg.scriptr.�rrer rj�joinrrr<rr@rf�r$r�pkg_dirr%rrr�test_module_in_package:s

�"�z"CmdLineTest.test_module_in_packagecCs`t���"}t|ddd�\}}|jddg|||dtj||d�Wd�dS1s)wYdS)Nr�r�rcr�r��Z
PYTHONPATHr/�rrerr<r�r��r$rr�r�rrr�!test_module_in_package_in_zipfileDs
�"�z-CmdLineTest.test_module_in_package_in_zipfilecCsdt���$}t|ddddd�\}}|jddg|||dtj||d	�Wd�dS1s+wYdS)
Nr�r�rc�)rr�ztest_pkg.test_pkg.scriptztest_pkg.test_pkgr�r�r�rrr�$test_module_in_subpackage_in_zipfileKs
�"�z0CmdLineTest.test_module_in_subpackage_in_zipfilec
Csnt���)}tj�|d�}t|�t|d�}|jddg|||dtj	j
|d�Wd�dS1s0wYdS)Nr�ryr�r.r�r�rrr�test_packageSs

�"�zCmdLineTest.test_packagec
Cs�t���:}tj�|d�}t|�t|d�}tj|dd�}t�	|�t
�|�}|jddg|||dt
jj|d�Wd�dS1sAwYdS)Nr�ryTrnr�r.)rrer rjr�rrrqrrrsrrtr<rr@ru)r$rr�r%r�rwrrr�test_package_compiled]s



�"�z!CmdLineTest.test_package_compiledcCs\t��� }tj�|d�}t|�d}|jddg||d�Wd�dS1s'wYdS)Nr�z7'test_pkg' is a package and cannot be directly executedr�r.�rrer rjr�rr>)r$rr�r~rrr�test_package_errorjs
"�zCmdLineTest.test_package_errorcCsrt���+}tj�|d�}t|�tj�|d�}t|�d}|jddg||d�Wd�dS1s2wYdS)Nr�ryz^Cannot use package as __main__ module; 'test_pkg' is a package and cannot be directly executedr�r.r�)r$rr�Zmain_dirr~rrr�test_package_recursionrs
"�z"CmdLineTest.test_package_recursioncCs�t���l}tj|d��Mtj�|d�}t|d�t|d�}tddgt	�Rddi�\}}}t
d	kr6tt|��d
d}|�
|�d�|�|�||||||dtjj�Wd�n1s[wYWd�dSWd�dS1sswYdS)N�rjr�z1import sys; print('init_argv0==%r' % sys.argv[0])rcr�r�r1Frzinit_argv0==%rr)rre�
change_cwdr rjr�rrr	r4rrrr"r#r-rr@rf)r$rr�r%r9r:r;rBrrr�test_issue8202}s$



���"�zCmdLineTest.test_issue8202c
Cs�t���d}tj|d��Etdddd��.}|�d�tdddd	�\}}}td
kr-tt|��dd}|�	|�
d�|�Wd�n1sDwYWd�n1sSwYWd�dSWd�dS1skwYdS)
Nr�r?�wr��encodingr&z2import sys; print("sys.path[0]==%r" % sys.path[0])F)r1rzsys.path[0]==%rrz)rrer��openrEr	rrrr"r#)r$r�fr9r:r;rBrrr�"test_issue8202_dash_c_file_ignored�s$

�����"�z.CmdLineTest.test_issue8202_dash_c_file_ignoredc
Cs�t���e}t|d�}tj|d��Atdddd��*}|�d�tddgt�Rdd	i�\}}}|�||||||d
t	j
j�Wd�n1sEwYWd�n1sTwYWd�dSWd�dS1slwYdS)N�otherr�r�r�rr�r&r1Frz)rrerr�r�rEr	r4r-rr@rf)r$rr%r�r9r:r;rrr�"test_issue8202_dash_m_file_ignored�s$


�
�����"�z.CmdLineTest.test_issue8202_dash_m_file_ignoredc	Cs�t���l}tj�|d�}t|dddd��#}|�d�|�d�td�D]}|�d	�q#|�d�Wd�n1s:wYtj|d
��t	|�\}}}Wd�n1sWwY|�
d|�|�
d|�Wd�dS1sswYdS)Nz
issue20884.pyr��latin1�
)r��newlinez#coding: iso-8859-1
z"""
�zQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
r��)rrer rjr�r�rE�ranger�r	r)r$rr%r��_r9r:r;rrr�test_issue20884�s


��"�zCmdLineTest.test_issue20884c	gs��t���9}tj|d��tj�|d�}t|g|�R�|VWd�n1s)wYWd�dSWd�dS1sAwYdS)Nr�r�)rrer�r rjr�r)r$�argsrr�rrr�setup_test_pkg�s�

�P�zCmdLineTest.setup_test_pkgcGs@tdg|�Rddi�\}}}tdkrtt|��|�|d�|S)Nr�r1Fr)r
rrrr)r$r�r9r:r;rrr�check_dash_m_failure�s
z CmdLineTest.check_dash_m_failurecCsX|���}t|dd�}|jdgt�R�}|�d|�Wd�dS1s%wYdS)Nr�z+if __name__ == '__main__': raise ValueErrorztest_pkg.others
ValueError)r�rr�r4r")r$r�r%r;rrr�test_dash_m_error_code_is_one�s
�"�z)CmdLineTest.test_dash_m_error_code_is_onec	Cstd}|D]3\}}|�|��"td|�\}}}|�|d�|�||�|�d|�Wd�n1s2wYqdS)N))�builtinssNo code object available)z
builtins.xs=Error while finding module specification.*ModuleNotFoundError)zbuiltins.x.ys]Error while finding module specification.*ModuleNotFoundError.*No module named.*not a package)zos.pathsloader.*cannot handle)rs=No module named.*is a package and cannot be directly executed)zimportlib.nonexistentsNo module named)z	.unittests#Relative module names not supportedr�r�	Traceback)�subTestr
r�assertRegex�assertNotIn)r$Ztests�nameZregexr9r�r;rrr�test_dash_m_errors�s���zCmdLineTest.test_dash_m_errorsc
Cs�t���X}tj|d��9t�d�tdd��Wd�n1s!wY|�d�}|�|d�|�d|�|�d|�Wd�n1sGwYWd�dSWd�dS1s_wYdS)Nr�r�ztest_pkg/__init__.pyc�wbsGError while finding module specification.*ImportError.*bad magic numbersis a packager�)	rrer�r �mkdirr�r�r�r��r$rr;rrr�test_dash_m_bad_pyc�s

�
�
�P�zCmdLineTest.test_dash_m_bad_pycc
Cs�t���G}tj|d��(tdd��Wd�n1swY|�d�}|�d|�Wd�n1s6wYWd�dSWd�dS1sNwYdS)Nr�z
asyncio.pyr�s>Try using 'asyncio' instead of 'asyncio.py' as the module name)rrer�r�r�r"r�rrr�*test_hint_when_triying_to_import_a_py_file�s

��
�P�z6CmdLineTest.test_hint_when_triying_to_import_a_py_filec
Cs�ttttf}|D]N}|j}d�|�}|�|��7|�|��"}|�d�}|�	|�
d�|�|�	d|�|�	d|�Wd�n1sBwYWd�n1sQwYqdS)Nz%raise {0}('Exception in __init__.py')r��asciisException in __init__.pyr�)�ImportError�AttributeError�	TypeError�
ValueError�__name__�formatr�r�r�r"r#)r$�
exceptions�	exceptionZinitr�r;rrr�test_dash_m_init_tracebacks"
�
����z&CmdLineTest.test_dash_m_init_tracebackcCsl|���(}d}t|d|�|�d�}|�d|�|�d|�|�d|�Wd�dS1s/wYdS)Nz1raise ImportError('Exception in __main__ module')ryr�sImportErrorsException in __main__ moduler�)r�rr�r")r$r��mainr;rrr�test_dash_m_main_tracebacks

"�z&CmdLineTest.test_dash_m_main_tracebackcCs�t�d�}t���D}t|d|�}t|�\}}}|�d��d�}|�t	|�d�|�
|d�d��|�
|d�d	��|�
|d
�d��Wd�dS1sPwYdS)Nz|            try:
                raise ValueError
            except:
                raise NameError from None
            rcr�r��rZ	Tracebackrz  File ��	NameError)�textwrap�dedentrrerr
�decode�splitr�lenri�
startswith�r$rcrr%�exitcoderNrI�textrrr�test_pep_409_verbiages

"�z!CmdLineTest.test_pep_409_verbiagecCs�tjrtjdvrt�tj�}ntjrtj}n|�d�d}tt�	�||�}|�
tj|�t|�\}}}|�
t|�|���d�d||f�|�
d|�dS)N)�win32�darwinzneed os_helper.TESTFN_NONASCIIzprint(ascii(__file__))
r�zstdout=%r stderr=%rr)rZTESTFN_UNDECODABLE�sys�platformr �fsdecodeZTESTFN_NONASCIIZskipTestrr!Z
addCleanup�unlinkr	rr��rstripr�)r$r�rr%r9rNrIrrr�test_non_ascii,s 


�zCmdLineTest.test_non_asciicCslt�d�}t���#}t|d|�}t|�\}}}|�d�}|�|��d�Wd�dS1s/wYdS)Nz�            import sys
            error = None
            try:
                raise ValueError('some text')
            except ValueError as err:
                error = err

            if error:
                sys.exit(error)
            rcr�z	some text)	r�r�rrerr
r�rr�r�rrr�)test_issue20500_exit_with_exception_valueCs


"�z5CmdLineTest.test_issue20500_exit_with_exception_valuecCsnd}t���'}t|d|�}t|�\}}}t�t�|�d���}|�d|�Wd�dS1s0wYdS)Nz
1 + 1 = 2
rcr�z
    ^^^^^
)	rrerr
�io�
TextIOWrapper�BytesIOrOr"r�rrr�*test_syntaxerror_unindented_caret_positionUs
"�z6CmdLineTest.test_syntaxerror_unindented_caret_positioncCs�t�d�}t���M}t|d|�}t|�\}}}t�t�|�d��	�}|�
d|�d}t|d|�}t|�\}}}t�t�|�d��	�}|�d|�|�
d|�Wd�dS1sYwYdS)Nz;            if True:
                1 + 1 = 2
            rcr�z
    1 + 1 = 2
    ^^^^^
zif True:
    1 + 1 = 2
�)r�r�rrerr
r�r�r�rOr"r�r�rrr�(test_syntaxerror_indented_caret_position^s

�"�z4CmdLineTest.test_syntaxerror_indented_caret_positioncCshd}t���$}t|d|�}t|�\}}}|�|��dd�gd��Wd�dS1s-wYdS)Nzfoo = f"""{}
foo"""
rc���)s
    foo"""s          ^s3SyntaxError: f-string: empty expression not allowed�rrerr
r�
splitlines�r$rcrr%r�rNrIrrr�#test_syntaxerror_multi_line_fstringus
�"�z/CmdLineTest.test_syntaxerror_multi_line_fstringcCsjd}t���%}t|d|�}td|�\}}}|�|��dd�gd��Wd�dS1s.wYdS)Nzfoo = """\q"""
rcz-Werrorr�)s    foo = """\q"""s          ^^^^^^^^s)SyntaxError: invalid escape sequence '\q'r�r�rrr�3test_syntaxerror_invalid_escape_sequence_multi_line�s

��"�z?CmdLineTest.test_syntaxerror_invalid_escape_sequence_multi_linec		Cst�d�}d|_t���s}t���V}t|d|�}td||d�}t|����	�}|�
|d|�|�||�td||d�}t|����	�}|�
||�td||d�}t|����	�}|�
|||�Wd�n1sjwYWd�dSWd�dS1s�wYdS)N�c            import sys
            for entry in sys.path:
                print(entry)
            ryz-Esr.rz-I)r�r��maxDiffrrerrrr�r�rr�)	r$rc�work_dirrr%rGZout_by_nameZ
out_by_dirZout_by_dir_isolatedrrr�-test_consistent_sys_path_for_direct_execution�s
P�z9CmdLineTest.test_consistent_sys_path_for_direct_executioncCs�t�d�}d|_t���e}tj�|d�}t�|�t	|d|�}t
dd|d�}t|����
�}|�|d|�|�||�t
dd|d�}t|����
�}|�||�tdd|d�\}}	}
|
���
�}|�d	|d
�Wd�dS1stwYdS)Nr�Z
script_pkgryz-smzscript_pkg.__main__r.rz-ImzNo module named script_pkg���)r�r�r�rrer rjr�r�rrrr�r�rr�r
r")r$rcr�rr%rGZ
out_by_moduleZout_by_packager�rNrIZtraceback_linesrrr�-test_consistent_sys_path_for_module_execution�s&


�"�z9CmdLineTest.test_consistent_sys_path_for_module_executioncCsTd}|�tj�|��t|dtjtjd�}|��\}}|�d|�|�	|j
d�dS)Nznonexistingscript.pyT)r�rNrIz: can't open file r)ZassertFalser rj�existsrrKrL�communicater"ZassertNotEqual�
returncode)r$rc�procr:r;rrr�test_nonexisting_script�s�z#CmdLineTest.test_nonexisting_scriptz	/dev/fd/0zrequires /dev/fd platformc
Cs�d}t���J}t|d|�}t|d��&}td|����dddd|��fd	�}|��\}}|�|d
�Wd�n1s;wYWd�dSWd�dS1sSwYdS)Nz print("12345678912345678912345")z	script.py�rz/dev/fd/Frrr�)�	close_fds�pass_fdss12345678912345678912345
)rrerr�r�filenor�r)r$rcr�r%�fprGr:r;rrr�test_script_as_dev_fd�s
$��"�z!CmdLineTest.test_script_as_dev_fdr
)F)?r��
__module__�__qualname__r-r<r>rCrH�
contextlib�contextmanagerrSrUrVrZr^rarbrhrmrxr{r|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�unittestZ
skipUnlessr rjr�rrrrrr\sx
� ��


	











	%rcCst��dSr
)r�
reap_childrenrrrr�tearDownModule�r[rry)$rr�importlib.machineryr�r
r�r Zos.pathrqrKr�r��testrZtest.supportrrZtest.support.script_helperrrrrr	r
rrrr4Ztest_sourcerrZTestCaserrr�r�rrrr�<module>s@(5
��