
    j                    ^    d dl mZ d dlZd dlmZ d dlmZmZ d dlm	Z	 dd
Z
dddZdddZdS )    )annotationsN)Sequence)PIPEPopen)Anycmdstr | Sequence[str]returntuple[str, str, Any]c                    t          | t          t                    }|                                \  }}|                    dd          }|                    dd          }|||j        fS )z8Get stdout, stderr, and exit code from running a command)stdoutstderrutf8replace)r   r   communicatedecode
returncode)r   pouterrout_strerr_strs         \/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/traitlets/tests/utils.pyget_output_error_coder   	   s\    c$t,,,A}}HCjj++Gjj++GGQ\))    pkgstr
subcommandSequence[str] | Nonetuple[str, str]c                    t           j        d| g}|r|                    |           |                    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   r   r   r   r   r   rcs         r   check_help_outputr-      s    >4
%C 

:JJt(--LCb777C777c!!!!38Or   c                    t           j        d| g}|r|                    |           |                    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777C777c!!!!c!!!!8Or   )r   r	   r
   r   )N)r   r   r   r   r
   r    )
__future__r   r'   collections.abcr   
subprocessr   r   typingr   r   r-   r/    r   r   <module>r5      s    " " " " " " 



 $ $ $ $ $ $ " " " " " " " "      * * * *          r   