
    ~fe                    T    d dl mZ d dlZd dlmZmZ d dlmZmZ ddZ	d	d
dZ
d	d
dZy)    )annotationsN)PIPEPopen)AnySequencec                    t        | t        t              }|j                         \  }}|j                  dd      }|j                  dd      }|||j                  fS )z8Get stdout, stderr, and exit code from running a command)stdoutstderrutf8replace)r   r   communicatedecode
returncode)cmdpouterrout_strerr_strs         P/var/www/cvtools/html/venv/lib/python3.12/site-packages/traitlets/tests/utils.pyget_output_error_coder      sP    c$t,A}}HCjj+Gjj+GGQ\\))    c                    t         j                  d| g}|r|j                  |       |j                  d       t	        |      \  }}}|dk(  sJ |       d|vsJ d|v sJ d|v sJ ||fS )z/test that `python -m PKG [subcommand] -h` works-mz-hr   	TracebackOptions
--help-allsys
executableextendappendr   pkg
subcommandr   r   r   rcs         r   check_help_outputr'      s    >>4
%C

:JJt(-LCb7C7c!!!38Or   c                    t         j                  d| g}|r|j                  |       |j                  d       t	        |      \  }}}|dk(  sJ |       d|vsJ d|v sJ d|v sJ ||fS )z*test that `python -m PKG --help-all` worksr   r   r   r   r   zClass optionsr   r#   s         r   check_help_all_outputr)      s    >>4
%C

:JJ|(-LCb7C7c!!!c!!!8Or   )r   zstr | Sequence[str]returnztuple[str, str, Any])N)r$   strr%   zSequence[str] | Noner*   ztuple[str, str])
__future__r   r   
subprocessr   r   typingr   r   r   r'   r)    r   r   <module>r0      s     " 
 "  *r   