ó
:îÜWç  c           @   s  d  d l  Z d  d l j j Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 e j
 j j d ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d S(   iÿÿÿÿNs   not hasattr(os, 'fork')c          C   s£  t  j j t ƒ }  |  j } | j } | ƒ  } | sÀ d d i d t j ƒ  k s^ t j	 |  ƒ rm t j
 |  ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d 6t j
 | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } } |  j ƒ  |  j } | j } | ƒ  } | } | sd d i d t j ƒ  k s+t j	 |  ƒ r:t j
 |  ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d 6t j
 | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } } } d  S(	   Nt    s]   assert %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.tempdir
}.check
}()
}t   fft   py0t   py2t   py4t   py6sa   assert not %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.tempdir
}.check
}()
}(   t   pyt   processt
   ForkedFunct   boxf1t   tempdirt   checkt   @py_builtinst   localst
   @pytest_art   _should_repr_global_namet	   _safereprt   AssertionErrort   _format_explanationt   Nonet
   waitfinish(   R   t   @py_assert1t   @py_assert3t   @py_assert5t   @py_format7t   @py_assert7t   @py_format8(    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_waitfinish_removes_tempdir   s"    	 	 	  u  
	 	 	   u  c         C   s¹  |  j  t d d „  ƒ t j j t ƒ } | j } | j } | ƒ  } | sÖ d d i d t j	 ƒ  k st t
 j | ƒ rƒ t
 j | ƒ n d d 6t
 j | ƒ d 6t
 j | ƒ d 6t
 j | ƒ d	 6} t t
 j | ƒ ƒ ‚ n  d  } } } | j ƒ  | j } | j } | ƒ  } | } | s£d d
 i d t j	 ƒ  k sAt
 j | ƒ rPt
 j | ƒ n d d 6t
 j | ƒ d 6t
 j | ƒ d 6t
 j | ƒ d	 6} t t
 j | ƒ ƒ ‚ n  d  } } } } d  S(   Nt   forkc           S   s
   t  j ƒ  S(   N(   t   ost   getpid(    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   <lambda>   s    R    s]   assert %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.tempdir
}.check
}()
}R   R   R   R   R   sa   assert not %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.tempdir
}.check
}()
}(   t   setattrR   R   R   R   R	   R
   R   R   R   R   R   R   R   R   R   t   __del__(   t   monkeypatchR   R   R   R   R   R   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_tempdir_gets_gc_collected   s$    	 	 	  u  
	 	 	   u  c          C   s@  t  j j t ƒ j ƒ  }  |  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  } } } |  j } d } | | k } | s²t j d | f d | | f ƒ i d t j	 ƒ  k sOt j
 |  ƒ r^t j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } } |  j } d } | | k } | s†t j d | f d | | f ƒ i d t j	 ƒ  k s#t j
 |  ƒ r2t j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } } |  j } d } | | k } | sZ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  } } } |  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  } } } d  S(!   Ns	   some out
s   ==s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)st   resultR   R   t   py5R    s   assert %(py7)st   py7s	   some err
s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)si    s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)si   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)ss   assert %(py7)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)ss   assert %(py7)s(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)ss   assert %(py7)s(   R   R   R   R	   R   t   outR   t   _call_reprcompareR   R   R   R   R   R   R   t   errt
   exitstatust   signalt   retval(   R$   R   t   @py_assert4R   t   @py_format6R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_basic_forkedfunc   sR    	    |   	    |   	    |   	    |   	    |   c          C   sç  d „  }  t  j j |  ƒ j ƒ  } | 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  } } } | j } d } | | k } | s»t j d | f d | | f ƒ i d t j ƒ  k sXt j	 | ƒ rgt j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } | j } | } | sLd	 d i d t j ƒ  k s
t j	 | ƒ rt j
 | ƒ n d d 6t j
 | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } | j } | } | sÙd	 d i d t j ƒ  k s—t j	 | ƒ r¦t j
 | ƒ n d d 6t j
 | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } d  S(   Nc           S   s   t  j d ƒ d  S(   Ni   (   R   t   _exit(    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   func   s    i   s   ==s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   i    s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss+   assert not %(py2)s
{%(py2)s = %(py0)s.out
}s+   assert not %(py2)s
{%(py2)s = %(py0)s.err
}(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   R   R   R   R   R*   R   R(   R   R   R   R   R   R   R   R+   R'   R)   (   R1   R$   R   R-   R   R.   R   t   @py_format4(    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_exitstatus   s<    		    |   	    |   	   U  
	   U  c          C   sÅ  d „  }  t  j j |  ƒ } | j ƒ  } | j } | j } | | 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 6d t j	 ƒ  k sÔ t j
 | ƒ rã t j | ƒ n d d 6t j | ƒ d	 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } | j } | j } d } | | ƒ } d }	 | |	 k }
 |
 sFt j d |
 f d | |	 f ƒ i t j | ƒ d 6d t j	 ƒ  k sÃt j
 | ƒ rÒt j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d	 6t j |	 ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } }
 }	 | 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  } } } | j } | } | s·d
 d i d t j	 ƒ  k sut j
 | ƒ r„t j | ƒ n d d 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } d  S(#   Nc           S   s   t  d ƒ ‚ d  S(   Ni*   (   t
   ValueError(    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   fun&   s    s   ==s\   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py6)s
{%(py6)s = %(py4)s.EXITSTATUS_EXCEPTION
}R$   R   R   R   R   R   R    s   assert %(py8)st   py8s   ValueError: 42iÿÿÿÿs   !=sd   %(py8)s
{%(py8)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.err
}.find
}(%(py6)s)
} != %(py11)st   py11s   assert %(py13)st   py13i    s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)sR%   s   assert %(py7)sR&   s.   assert not %(py2)s
{%(py2)s = %(py0)s.retval
}(   s   ==(   s\   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py6)s
{%(py6)s = %(py4)s.EXITSTATUS_EXCEPTION
}s   assert %(py8)s(   s   !=(   sd   %(py8)s
{%(py8)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.err
}.find
}(%(py6)s)
} != %(py11)ss   assert %(py13)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   R   R   R   R   R*   t   EXITSTATUS_EXCEPTIONR   R(   R   R   R   R   R   R   R   R)   t   findR+   R,   (   R5   R   R$   R   R   R   R   t   @py_format9R   t   @py_assert10t   @py_assert9t   @py_format12t   @py_format14R-   R.   R   R2   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_execption_in_func%   sH    		 	   ³   	 	      ¬   	    |   	   U  c          C   s@  t  j j t ƒ j ƒ  }  |  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  } } } |  j } d } | | k } | s²t j d | f d | | f ƒ i d t j	 ƒ  k sOt j
 |  ƒ r^t j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } } |  j } d } | | k } | s†t j d | f d | | f ƒ i d t j	 ƒ  k s#t j
 |  ƒ r2t j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } } |  j } d } | | k } | sZ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  } } } |  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  } } } d  S(!   Nt   someouts   ==s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   t   someerrs+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)si    s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)si   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)ss   assert %(py7)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)ss   assert %(py7)s(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)ss   assert %(py7)s(   R   R   R   t   boxf2R   R'   R   R(   R   R   R   R   R   R   R   R)   R*   R+   R,   (   R$   R   R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_forkedfunc_on_fds/   sR    	    |   	    |   	    |   	    |   	    |   c          C   sÄ  t  j j t ƒ j ƒ  }  |  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  } } } |  j } d } | | k } | s²t j d | f d | | f ƒ i d t j	 ƒ  k sOt j
 |  ƒ r^t j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s   ==s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   t   ss+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)ss   assert %(py7)s(   R   R   R   t   boxf3R   R+   R   R(   R   R   R   R   R   R   R   R'   (   R$   R   R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_forkedfunc_on_fds_output7   s"    	    |   	    |   c          C   sÍ  d „  }  t  j j |  ƒ j ƒ  } | 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  } } } | j } d } | | k } | s»t j d | f d | | f ƒ i d t j ƒ  k sXt j	 | ƒ rgt j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } d  S(   Nc          S   s6   d d  l  }  |  j j d ƒ t j t j ƒ  d ƒ d  S(   Niÿÿÿÿs   hello
i   (   t   syst   stdoutt   writeR   t   killR   (   RH   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyRF   >   s    i   s   ==s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   s   hello
s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)ss   assert %(py7)s(   R   R   R   R   R+   R   R(   R   R   R   R   R   R   R   R'   (   RF   R$   R   R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_forkedfunc_on_stdout=   s$    		    |   	    |   c          C   s  t  j j t ƒ j ƒ  }  |  j } | d  k } | sÿ t j d | f d | d  f ƒ i d t	 j
 ƒ  k su t j |  ƒ r„ t j |  ƒ n d d 6t j | ƒ d 6d t	 j
 ƒ  k s¼ t j d  ƒ rË t j d  ƒ n d d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } t j d k  r+t  j j d ƒ n  |  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  } } } d  S(   Nt   iss.   %(py2)s
{%(py2)s = %(py0)s.retval
} is %(py4)sR$   R   R   R   R   R    s   assert %(py6)sR   i   i   s4   signal detection does not work with python prior 2.4i   s   ==s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)sR%   s   assert %(py7)sR&   (   RM   (   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} is %(py4)ss   assert %(py6)s(   i   i   (   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   R   R   R   t   boxsegR   R,   R   R   R(   R   R   R   R   R   R   RH   t   version_infot   testt   skipR+   (   R$   R   R   t   @py_format5R   R-   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_forkedfunc_signalF   s$    	   £   
	    |   c          C   s  t  j j t ƒ j ƒ  }  |  j } | s” d d i d t j ƒ  k sR t j	 |  ƒ ra t j
 |  ƒ n d d 6t j
 | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } |  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  } } } |  j } d } | | k } | s4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  } } } |  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  } } } d  S(   NR    s'   assert %(py2)s
{%(py2)s = %(py0)s.out
}R$   R   R   i    s   ==s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)sR%   s   assert %(py7)sR&   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)si   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)s(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)ss   assert %(py7)s(   R   R   R   t   boxhugeR   R'   R   R   R   R   R   R   R   R   R*   R(   R+   R,   (   R$   R   t   @py_format3R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_forkedfunc_huge_dataM   s<    	  U  	    |   	    |   	    |   c          C   s1  x*t  d ƒ D]}  t j j t ƒ j ƒ  } | j } | s§ d d i d t j ƒ  k se t	 j
 | ƒ rt t	 j | ƒ n d d 6t	 j | ƒ d 6} t t	 j | ƒ ƒ ‚ n  d  } | j } d } | | k } | ss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  } } } | j } d } | | k } | sG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  } } } | 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  } } } q Wd  S(   Ni2   R    s'   assert %(py2)s
{%(py2)s = %(py0)s.out
}R$   R   R   i    s   ==s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)sR%   s   assert %(py7)sR&   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)si   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)s(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)ss   assert %(py7)s(   t   rangeR   R   R   RT   R   R'   R   R   R   R   R   R   R   R   R*   R(   R+   R,   (   t   iR$   R   RU   R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_box_seqT   s>    	  U  	    |   	    |   	    |   c          C   sI  d „  }  t  j j |  ƒ j ƒ  } | 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  } } } | j } d } | | k } | s»t j d | f d | | f ƒ i d t j ƒ  k sXt j	 | ƒ rgt j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } | 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  } } } | j } d } | | k } | sc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  } } } | j } d } | | k } | s7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  } } } d  S("   Nc          S   s>   t  j j t ƒ j ƒ  }  |  j GHt j j |  j	 d ƒ |  j
 S(   Ns   
(   R   R   R   RC   R   R'   RH   t   stderrRJ   R)   R,   (   R$   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   boxfun^   s    s   someout
s   ==s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   s   someerr
s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)si    s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)si   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)ss   assert %(py7)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)ss   assert %(py7)s(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)ss   assert %(py7)s(   R   R   R   R   R'   R   R(   R   R   R   R   R   R   R   R)   R*   R+   R,   (   R[   R$   R   R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_box_in_a_box]   sT    		    |   	    |   	    |   	    |   	    |   c    
         sh  d d d „  ƒ  Y}  |  ƒ  } d d  l  ‰  ‡  f d †  } t j j | ƒ } t j | j d ƒ | j ƒ  } t j j	 j
 d k  r t j j d ƒ n  | j } d } | | k } | sV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  } } } d  S(   Nt   Ac           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyR]   l   s   iÿÿÿÿc              s   ˆ  j  d ƒ d  S(   Ni
   (   t   sleep(    (   t   time(    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   box_funq   s    i   i   i   s4   signal detection does not work with python prior 2.4s   ==s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   (    (   i   i   (   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   Ra   R   R   R   R   RK   t   pidR   t   stdRH   RO   RP   RQ   R+   R   R(   R   R   R   R   R   R   R   (
   R]   t   infoRb   R   R$   R   R-   R   R.   R   (    (   Ra   sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   test_kill_func_forkedk   s"    		    |   c   
      C   sg  d „  } d „  } d „  } t  j j | d | d | ƒj ƒ  } | 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  } } } | j } d } | | k } | sÙt j d | f d | | f ƒ i d	 t j ƒ  k svt j	 | ƒ r…t j
 | ƒ n d	 d
 6t j
 | ƒ d 6t j
 | ƒ d 6} d i | d 6}	 t t j |	 ƒ ƒ ‚ n  d  } } } | j } d } | | k } | s­t j d | f d | | f ƒ i d	 t j ƒ  k sJt j	 | ƒ rYt j
 | ƒ n d	 d
 6t j
 | ƒ d 6t j
 | ƒ d 6} d i | d 6}	 t t j |	 ƒ ƒ ‚ n  d  } } } | 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  } } } | j } d } | | k } | sU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  } } } d  S(&   Nc           S   s   d S(   Ni   (    (    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   _boxed}   s    c           S   s!   t  j j d ƒ t  j j ƒ  d  S(   Ns	   some out
(   RH   RI   RJ   t   flush(    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt	   _on_start€   s    c           S   s!   t  j j d ƒ t  j j ƒ  d  S(   Ns	   some err
(   RH   RZ   RJ   Rh   (    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   _on_exit„   s    t   child_on_startt   child_on_exits	   some out
s   ==s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)sR$   R   R   R%   R    s   assert %(py7)sR&   s	   some err
s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)si    s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)si   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.out
} == %(py5)ss   assert %(py7)s(   s   ==(   s+   %(py2)s
{%(py2)s = %(py0)s.err
} == %(py5)ss   assert %(py7)s(   s   ==(   s2   %(py2)s
{%(py2)s = %(py0)s.exitstatus
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.signal
} == %(py5)ss   assert %(py7)s(   s   ==(   s.   %(py2)s
{%(py2)s = %(py0)s.retval
} == %(py5)ss   assert %(py7)s(   R   R   R   R   R'   R   R(   R   R   R   R   R   R   R   R)   R*   R+   R,   (
   R"   Rg   Ri   Rj   R$   R   R-   R   R.   R   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt
   test_hooks|   sZ    				    |   	    |   	    |   	    |   	    |   c           C   s$   t  j j d ƒ t  j j d ƒ d S(   Ns	   some out
s	   some err
i   (   RH   RI   RJ   RZ   (    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyR	   –   s    c           C   s6   t  j d d j d ƒ ƒ t  j d d j d ƒ ƒ d S(   Ni   RA   t   asciii   RB   (   R   RJ   t   encode(    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyRC   ›   s    c           C   s3   t  j d d j d ƒ ƒ t  j t  j ƒ  d ƒ d  S(   Ni   RE   Rn   i   (   R   RJ   Ro   RK   R   (    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyRF       s    c           C   s   t  j t  j ƒ  d ƒ d  S(   Ni   (   R   RK   R   (    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyRN   ¤   s    c          C   sŸ   d j  d ƒ }  t j d |  d ƒ t j d |  d ƒ t j d |  d ƒ t j d |  d ƒ t j d |  d ƒ t j d |  d ƒ t j d |  d ƒ d S(   Nt    Rn   i   i'  i   i   (   Ro   R   RJ   (   RE   (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyRT   §   s    (!   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   t   pytestR   RH   R   RP   t   markt   skipift
   pytestmarkR   R#   R/   R3   R@   RD   RG   RL   RS   RV   RY   R\   Rf   Rm   R	   RC   RF   RN   RT   (    (    (    sE   /home/ronny/Projects/pytest-dev/py/testing/process/test_forkedfunc.pyt   <module>   s.     $						
															