ó
‹wÛjc           @   s7  d  Z  d d l Z e j d d e ƒ e j d d e ƒ d d l Z d d l Z d d l Z d d l Z d d l m	 Z	 m
 Z
 e j d  d k s¤ e j d	  d
 k r½ e j d e j ƒ ‚ n  y d d l m Z [ Wn$ e k
 rú d d l m Z [ n Xd e j f d „  ƒ  YZ d „  Z e d k r3e ƒ  n  d S(   s   Test script for popen2.pyiÿÿÿÿNt   ignores   .*popen2 module is deprecated.*s   os\.popen. is deprecated.*(   t   run_unittestt   reap_childreni   t   beosi   t   atheoss   popen2() doesn't work on (   t   popen(   t   forkt
   Popen2Testc           B   sƒ   e  Z d  Z e j d k r$ d Z n  d Z e j ƒ  Z d „  Z d „  Z	 d d „ Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z RS(   t   catt   ntt   mores   ab cd
c         C   sD   t  j ƒ  |  j t  j d t g  t  j D] } | j ^ q& ƒ ƒ d  S(   Ns   Active pipes when test starts(   t   popen2t   _cleanupt   assertFalset   _activet   reprt   cmd(   t   selft   c(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   setUp*   s    
c         C   s�   x t  j D] } | j ƒ  q
 Wt  j ƒ  |  j t  j d ƒ d d  l } x | j D] } | j ƒ  qQ W| j ƒ  |  j | j d ƒ t ƒ  d  S(   Ns   popen2._active not emptyiÿÿÿÿs   subprocess._active not empty(   R   R   t   waitR   R   t
   subprocessR   (   R   t   instR   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   tearDown0   s    

c         C   sy   | j  | ƒ | j ƒ  | j ƒ  } |  j | | j ƒ  d | | f ƒ | d  k	 ru | j ƒ  } |  j | d | ƒ n  d  S(   Ns   wrote %r read %rs   unexpected %r on stderr(   t   writet   closet   readt   assertEqualt   stript   NoneR   (   R   t   teststrt   expected_outt   rt   wt   et   got(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   validate_output=   s    
c         C   s8   t  j  |  j ƒ \ } } |  j |  j |  j | | ƒ d  S(   N(   R   R   R$   R   t   expected(   R   R    R!   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   test_popen2H   s    c         C   s�   t  j d k rO t j |  j g ƒ \ } } } |  j |  j |  j | | | ƒ n  t j |  j ƒ \ } } } |  j |  j |  j | | | ƒ d  S(   Nt   posix(   t   ost   nameR   t   popen3R   R$   R   R%   (   R   R    R!   R"   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   test_popen3L   s
    "c         C   sÂ   t  j d k rŠ t  j |  j g ƒ \ } } |  j |  j |  j | | ƒ t  j d |  j g ƒ \ } } | j ƒ  } |  j | |  j d ƒ n  t  j |  j ƒ \ } } |  j |  j |  j | | ƒ d  S(   NR'   t   echos   
(	   R(   R)   R   R   R$   R   R%   R   R   (   R   R!   R    R#   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   test_os_popen2T   s    c         C   sñ   t  j d k r³ t  j |  j g ƒ \ } } } |  j |  j |  j | | | ƒ t  j d |  j g ƒ \ } } } | j ƒ  } |  j | |  j d ƒ | j ƒ  } |  j	 | d | ƒ n  t  j |  j ƒ \ } } } |  j |  j |  j | | | ƒ d  S(   NR'   R,   s   
s   unexpected %r on stderr(
   R(   R)   R*   R   R$   R   R%   R   R   R   (   R   R!   R    R"   R#   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   test_os_popen3a   s    !c         C   sÂ   t  j d k rŠ t  j |  j g ƒ \ } } |  j |  j |  j | | ƒ t  j d |  j g ƒ \ } } | j ƒ  } |  j | |  j d ƒ n  t  j |  j ƒ \ } } |  j |  j |  j | | ƒ d  S(   NR'   R,   s   
(	   R(   R)   t   popen4R   R$   R   R%   R   R   (   R   R!   R    R#   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   test_os_popen4p   s    N(   t   __name__t
   __module__R   R(   R)   R   R   R%   R   R   R   R$   R&   R+   R-   R.   R0   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyR       s   							c           C   s   t  t ƒ d  S(   N(   R   R   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt	   test_main}   s    t   __main__(   t   __doc__t   warningst   filterwarningst   DeprecationWarningR(   t   syst   unittestR   t   test.test_supportR   R   t   platformt   SkipTestR   t   ImportErrorR   t   TestCaseR   R3   R1   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_popen2.pyt   <module>   s,   &]	