ó
[³XMc           @   s‰   d  d l  m Z d  d l m Z d  d l m Z d d d „  ƒ  YZ d d d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e j	 f d „  ƒ  YZ
 d S(   iÿÿÿÿ(   t   unittest(   t   service(   t   LocalAsRemotet   Dummyc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyR   
   s   t   DummyTransportc           B   s   e  Z d  „  Z RS(   c         C   s   d S(   Nt   INETs	   127.0.0.1i    (   R   s	   127.0.0.1i    (    (   t   self(    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   getHost   s    (   R   R   R	   (    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyR      s   t   DummyManholeClientc           B   sh   e  Z d  Z e ƒ  Z e ƒ  e _ d „  Z d „  Z d „  Z	 d „  Z
 d „  Z e Z e	 Z e
 Z e Z RS(   i    c         C   s   g  |  _  d  S(   N(   t   messages(   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   __init__   s    c         C   s   |  j  j | ƒ d  S(   N(   R   t   extend(   R   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   console   s    c         C   s   d  S(   N(    (   R   t   xplorer(    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   receiveExplorer   s    c         C   s   t  |  j ƒ |  _ d  S(   N(   t   lenR   t   zero(   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   setZero   s    c         C   s   |  j  |  j S(   N(   R   R   (   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   getMessages"   s    (   R   R   R   R   t   brokerR   t	   transportR   R   R   R   R   t   sync_consolet   sync_receiveExplorert   sync_setZerot   sync_getMessages(    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyR
      s   						t   ManholeTestc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sÀ   Various tests for the manhole service.

    Both the the importIdentity and importMain tests are known to fail
    when the __name__ in the manhole namespace is set to certain
    values.
    c         C   sJ   t  j ƒ  |  _  t  j |  j  ƒ |  _ t ƒ  |  _ |  j j |  j d  ƒ d  S(   N(   R   t   Servicet   Perspectivet   pR
   t   clientt   attachedt   None(   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   setUp2   s    c         C   sT   |  j  j d ƒ |  j j ƒ  |  j  j d ƒ |  j j ƒ  d } |  j | d ƒ d S(   sJ   Making sure imported module is the same as one previously loaded.
        s#   from twisted.manhole import services6   int(service is sys.modules['twisted.manhole.service'])i    t   results   1
N(   s   results   1
(   R   t   perspective_doR   R   R   t   failUnlessEqual(   R   t   msg(    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   test_importIdentity8   s
    c         C   sj   |  j  j ƒ  |  j j d ƒ |  j  j ƒ  rf |  j  j ƒ  d } | d d k rf |  j | d ƒ qf n  d S(   s   Trying to import __main__s   import __main__i    t	   exceptiont   stderri   N(   R(   s   stderr(   R   R   R   R$   R   t   fail(   R   R&   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   test_importMainA   s    (   R   R   t   __doc__R"   R'   R+   (    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyR   +   s   			N(    (    (   t   twisted.trialR    t   twisted.manholeR   t   twisted.spread.utilR   R   R   R
   t   TestCaseR   (    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/test_manhole.pyt   <module>   s   