ó
[³XMc           @   s\   d  Z  e Z d d l m Z m Z d d l m Z d d l m	 Z	 d e f d „  ƒ  YZ
 d S(   sš   
Tests for L{twisted.internet._baseprocess} which implements process-related
functionality that is useful in all platforms supporting L{IReactorProcess}.
iÿÿÿÿ(   t   getWarningMethodt   setWarningMethod(   t   TestCase(   t   BaseProcesst   BaseProcessTestsc           B   s    e  Z d  Z d „  Z d „  Z RS(   s·   
    Tests for L{BaseProcess}, a parent class for other classes which represent
    processes which implements functionality common to many different process
    implementations.
    c         C   sk   d d d „  ƒ  Y} t  d ƒ } t | ƒ  ƒ } | j | ƒ | j j j t  ƒ |  j | | j j j ƒ d S(   s¸   
        L{BaseProcess._callProcessExited} calls the C{processExited} method of
        its C{proto} attribute and passes it a L{Failure} wrapping the given
        exception.
        t	   FakeProtoc           B   s   e  Z d Z d  „  Z RS(   c         S   s   | |  _  d  S(   N(   t   reason(   t   selfR   (    (    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyt   processExited   s    N(   t   __name__t
   __module__t   NoneR   R   (    (    (    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyR      s   s   fake reasonN(    (   t   RuntimeErrorR   t   _callProcessExitedt   protoR   t   trapt   assertIdenticalt   value(   R   R   R   t   process(    (    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyt   test_callProcessExited   s    c            sÀ   d d d „  ƒ  Y} t  ƒ  } t | ƒ  ƒ } |  j t t ƒ  ƒ g  ‰  ‡  f d †  } t | ƒ | j | ƒ ˆ  \ \ } } } |  j | d | j | j f ƒ |  j	 | t
 ƒ |  j | d ƒ d S(   sµ   
        L{BaseProcess._callProcessExited} emits a L{DeprecationWarning} if the
        object referred to by its C{proto} attribute has no C{processExited}
        method.
        R   c           B   s   e  Z RS(    (   R	   R
   (    (    (    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyR   /   s   c            s   ˆ  j  |  | | f ƒ d  S(   N(   t   append(   t   messaget   categoryt
   stacklevel(   t   warnings(    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyt   collect7   s    sX   Since Twisted 8.2, IProcessProtocol.processExited is required.  %s.%s must implement it.i    N(    (   t   objectR   t
   addCleanupR   R    R   t   assertEqualR
   R	   R   t   DeprecationWarning(   R   R   R   R   R   R   R   R   (    (   R   sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyt   test_callProcessExitedMissing)   s    	
(   R	   R
   t   __doc__R   R   (    (    (    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyR      s   	N(   R   t   typet   __metaclass__t   twisted.python.deprecateR    R   t   twisted.trial.unittestR   t   twisted.internet._baseprocessR   R   (    (    (    sJ   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_baseprocess.pyt   <module>   s
   