
    X-Ph                       d Z ddlmZ ddlZddlZ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 ddlmZmZ dgZej                            ej                            e          d	d	          Zej        Z G d
 de          ZdS )zTest cases for invoking mypyc on the command line.

These are slow -- do not add test cases unless you have a very good reason to do so.
    )annotationsN)test_temp_dir)DataDrivenTestCase)normalize_error_messages)MypycDataSuiteassert_test_outputzcommandline.testz..c                  "    e Zd ZeZeZdZddZdS )	TestCommandLineTtestcaser   returnNonec                .   d                     |j                  }t          j        d|          }|
J d            |                    d                                          }d|j        z  }t          j                             t          |          }t          |d          5 }|                    |           d d d            n# 1 swxY w Y   t          j                                        }t          |d<   d}		 t          j        t"          j        d	d
g|t          j        t          j        d|          }
d|j        v s|
j        dk    r|	|
j        z  }	n,d|j        v r#|
j                            d          \  }}}|	|z  }	|
j        dk    r |	t          j        t2          |gd          z  }	t"          j        dk    rdnd}t7          j        d| d          }|D ]}t          j        |           nK# t"          j        dk    rdnd}t7          j        d| d          }|D ]}t          j        |           w xY wd |j        D             }t=          |	                                                                           }tC          ||d|           d S )N
z# *cmd: *(.*)z*Test case missing "# cmd: <files>" section   z_%s.pyw
PYTHONPATH    z-mmypyctmp)stdoutstderrcwdenvErrorOutputr   WarningOutputs   running build_ext)r   win32pydsoz	tmp/**/*.T)	recursivec                :    g | ]}|                     d d          S )ztmp/ )replace).0xs     [/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypyc/test/test_commandline.py
<listcomp>z,TestCommandLine.run_case.<locals>.<listcomp>N   s&    CCCaAIIfb))CCCr   zInvalid output)expected)"joininputresearchgroupsplitnameospathr   openwriteenvironcopy	base_path
subprocessrunsys
executablePIPESTDOUT
returncoder   	partitioncheck_outputpython3_pathplatformglobremoveoutputr   decode
splitlinesr   )selfr   textmargsprogramprogram_pathfr   outcmdmessages_suffixso_pathsr0   r'   actuals                     r%   run_casezTestCommandLine.run_case!   s   yy((I&--}}J}}}wwqzz!! X]*w||M7;;,$$ 	GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 joo%L	 .w66!!(  C --11D1Dsz! HM11 "%!5!56J!K!K!Qx~""z.g/FERRRR!lg55UU4Fy!5V!5!5FFFH     	$  "lg55UU4Fy!5V!5!5FFFH     	$ 
 DC8?CCC *#**,,*A*A*C*CDD8V-=QQQQQQs    "CCC:B2G3 3AH;N)r   r   r   r   )__name__
__module____qualname__filesr   r5   optional_outrT    r   r%   r
   r
      s=        EIL1R 1R 1R 1R 1R 1Rr   r
   )__doc__
__future__r   rA   r/   os.pathr*   r6   r8   mypy.test.configr   mypy.test.datar   mypy.test.helpersr   mypyc.test.testutilr   r   rX   r0   r(   dirname__file__r5   r9   r?   r
   rZ   r   r%   <module>rd      s   
 # " " " " "  				  				     



 * * * * * * - - - - - - 6 6 6 6 6 6 B B B B B B B B	 GLL22D$??	~6R 6R 6R 6R 6Rn 6R 6R 6R 6R 6Rr   