ó
äÛi^c           @   sG   d  d l  Z  d  d l m Z m Z d   Z d d  Z d d  Z d S(   iĸĸĸĸN(   t   Popent   PIPEc         C   s^   t  |  d t d t } | j   \ } } | j d d  } | j d d  } | | | j f S(   s8   Get stdout, stderr, and exit code from running a commandt   stdoutt   stderrt   utf8t   replace(   R    R   t   communicatet   decodet
   returncode(   t   cmdt   pt   outt   err(    (    s4   lib/python2.7/site-packages/traitlets/tests/utils.pyt   get_output_error_code   s
    c         C   sĒ   t  j d |  g } | r( | j |  n  | j d  t |  \ } } } | d k sb t |   d | k st t  d | k s t  d | k s t  | | f S(   s/   test that `python -m PKG [subcommand] -h` workss   -ms   -hi    t	   Tracebackt   Optionss
   --help-all(   t   syst
   executablet   extendt   appendR   t   AssertionError(   t   pkgt
   subcommandR	   R   R   t   rc(    (    s4   lib/python2.7/site-packages/traitlets/tests/utils.pyt   check_help_output   s    c         C   sĒ   t  j d |  g } | r( | j |  n  | j d  t |  \ } } } | d k sb t |   d | k st t  d | k s t  d | k s t  | | f S(   s*   test that `python -m PKG --help-all` workss   -ms
   --help-alli    R   R   s   Class parameters(   R   R   R   R   R   R   (   R   R   R	   R   R   R   (    (    s4   lib/python2.7/site-packages/traitlets/tests/utils.pyt   check_help_all_output   s    (   R   t
   subprocessR    R   R   t   NoneR   R   (    (    (    s4   lib/python2.7/site-packages/traitlets/tests/utils.pyt   <module>   s   		