ó
:îÜWg  c           @   sZ   d  d l  Z d  d l j j Z d  d l Z d  d l m Z d „  Z	 d d d „  ƒ  YZ
 d S(   iÿÿÿÿN(   t   cmdexecc           C   s   t  j j j ƒ  d S(   Ni   (   t   pyt   stdt   syst   exc_info(    (    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   exvalue   s    t   Test_exec_cmdc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s÷  t  d ƒ } | j } | ƒ  } d } | | k } | së t j d | f d | | f ƒ i d t j ƒ  k sx t j | ƒ r‡ t j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d	 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } } t j } | j } | | ƒ } | såd
 d i d t j ƒ  k sLt j t ƒ r[t j t ƒ n d d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k s£t j | ƒ r²t j | ƒ n d d 6t j | ƒ d	 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ns
   echo hallot   hallos   ==sD   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.strip
}()
} == %(py7)st   outt   py0t   py2t   py4t   py7t    s   assert %(py9)st   py9sf   assert %(py7)s
{%(py7)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.builtin
}._istext
}(%(py5)s)
}R   t   py5(   s   ==(   sD   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.strip
}()
} == %(py7)ss   assert %(py9)s(   R    t   stript
   @pytest_art   _call_reprcomparet   @py_builtinst   localst   _should_repr_global_namet	   _safereprt   AssertionErrort   _format_explanationt   NoneR   t   builtint   _istext(   t   selfR   t   @py_assert1t   @py_assert3t   @py_assert6t   @py_assert5t   @py_format8t   @py_format10(    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   test_simple   s"    	 	    Œ   	 	   ¬  c   
      C   sÐ  d d  l  } t d | j ƒ } d } | | k } | sÌ t j d | f d | | f ƒ i d t j ƒ  k sy t j | ƒ rˆ t j | ƒ n d d 6t j | ƒ d 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } t j } | j } | | ƒ } | s¾d	 d i d t j ƒ  k s%t j t ƒ r4t j t ƒ n d d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k s|t j | ƒ r‹t j | ƒ n d d 6t j | ƒ d 6}	 t	 t j
 |	 ƒ ƒ ‚ n  d  } } } d  S(   Niÿÿÿÿs   %s -c "print ('hello')" s   hello
s   ==s   %(py0)s == %(py3)sR   R	   t   py3R   s   assert %(py5)sR   sf   assert %(py7)s
{%(py7)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.builtin
}._istext
}(%(py5)s)
}R   R
   R   R   (   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(   R   R    t
   executableR   R   R   R   R   R   R   R   R   R   R   R   (
   R   R   R   t   @py_assert2R   t   @py_format4t   @py_format6R   R   R!   (    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   test_simple_newline   s        l   
	 	   ¬  c         C   s   t  j j t j t d ƒ d  S(   Ns   exit 1(   R   t   testt   raisesR    t   Error(   R   (    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   test_simple_error   s    c   
      C   s,  y t  d ƒ Wnt  j k
 r't ƒ  } | j } d } | | k } | sð t j d | f d | | f ƒ i d t j ƒ  k s t j | ƒ rœ t j	 | ƒ n d d 6t j	 | ƒ d 6t j	 | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } } t j } | j } | j } | | ƒ } | sÿd	 d i t j	 | ƒ d 6d t j ƒ  k sft j t ƒ rut j	 t ƒ n d d 6t j	 | ƒ d 6t j	 | ƒ d 6d t j ƒ  k s½t j | ƒ rÌt j	 | ƒ n d d 6t j	 | ƒ d 6}	 t
 t j |	 ƒ ƒ ‚ n  d  } } } } t j } | j } | j } | | ƒ } | sd	 d i t j	 | ƒ d 6d t j ƒ  k syt j t ƒ rˆt j	 t ƒ n d d 6t j	 | ƒ d 6t j	 | ƒ d 6d t j ƒ  k sÐt j | ƒ rßt j	 | ƒ n d d 6t j	 | ƒ d 6}	 t
 t j |	 ƒ ƒ ‚ n  d  } } } } n Xd  S(   Ns   exit 1i   s   ==s.   %(py2)s
{%(py2)s = %(py0)s.status
} == %(py5)st   eR	   R
   R   R   s   assert %(py7)sR   s   assert %(py9)s
{%(py9)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.builtin
}._istext
}(%(py7)s
{%(py7)s = %(py5)s.out
})
}R   R   R   s   assert %(py9)s
{%(py9)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.builtin
}._istext
}(%(py7)s
{%(py7)s = %(py5)s.err
})
}(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.status
} == %(py5)ss   assert %(py7)s(   R    R,   R   t   statusR   R   R   R   R   R   R   R   R   R   R   R   R   t   err(
   R   R.   R   t   @py_assert4R   R(   R!   R   t   @py_assert8R"   (    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   test_simple_error_exact_status   s8    		    |   	 	 	   ¼  	 	 	   ¼  c         C   s9  y t  d ƒ t d ƒ ‚ Wnt  j k
 r4t ƒ  } d } t | | ƒ } | sd d i d t j ƒ  k s| t j t ƒ r‹ t j	 t ƒ n d d 6d t j ƒ  k s³ t j | ƒ rÂ t j	 | ƒ n d d	 6t j	 | ƒ d
 6t j	 | ƒ d 6} t t j
 | ƒ ƒ ‚ n  d  } } d } t | | ƒ } | sÞd d i d t j ƒ  k sUt j t ƒ rdt j	 t ƒ n d d 6d t j ƒ  k sŒt j | ƒ r›t j	 | ƒ n d d	 6t j	 | ƒ d
 6t j	 | ƒ d 6} t t j
 | ƒ ƒ ‚ n  d  } } g  } | j } | } | s| j } | } n  | sd i d t j ƒ  k sBt j | ƒ rQt j	 | ƒ n d d 6t j	 | ƒ d 6}	 | j |	 ƒ | sàd i t j	 | ƒ d 6d t j ƒ  k s¶t j | ƒ rÅt j	 | ƒ n d d 6}
 | j |
 ƒ n  t j | d ƒ i  } d i | d 6} t t j
 | ƒ ƒ ‚ n  d  } } } } n Xd  S(   Ns   echoqweqwe123 hallos   command succeeded but shouldn'tR0   R   s5   assert %(py5)s
{%(py5)s = %(py0)s(%(py1)s, %(py3)s)
}t   hasattrR	   R.   t   py1R$   R   R   s    %(py4)s
{%(py4)s = %(py2)s.err
}R
   R   s    %(py8)s
{%(py8)s = %(py6)s.out
}t   py8t   py6i   s   assert %(py11)st   py11s   assert %(py11)s(   R    R   R,   R   R4   R   R   R   R   R   R   R   R0   R   t   appendt   _format_boolop(   R   R.   R&   R1   R(   R   R   t   @py_assert0t   @py_assert7t   @py_format5t   @py_format9R"   t   @py_format12(    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   test_err   sB    
	   œ  
   œ  
 	   	 	  Q   Q     (   t   __name__t
   __module__R#   R)   R-   R3   R@   (    (    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyR      s
   					(    (   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   R   t
   py.processR    R   R   (    (    (    sB   /home/ronny/Projects/pytest-dev/py/testing/process/test_cmdexec.pyt   <module>   s
     	