
\c           @   s*   d  d l  m Z d e f d     YZ d S(   i   (   t   Clientt   ClusterTestc           B   sS   e  Z d Z i  Z d    Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(   c         C   s7   |  j  d d d |  j |  _ t |  j j  |  _ d  S(   Ni   t   scheduler_porti    (   t   Clustert   kwargst   clusterR    t   scheduler_addresst   client(   t   self(    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   setUp   s    c         C   s   |  j  j   |  j j   d  S(   N(   R   t   closeR   (   R   (    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   tearDown   s    c         C   s%   t  |  j j    d k s! t  d  S(   Ni   (   t   lenR   t   ncorest   AssertionError(   R   (    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt
   test_cores   s    c         C   s4   |  j  j d   d  } | j   d k s0 t  d  S(   Nc         S   s   |  d S(   Ni   (    (   t   x(    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   <lambda>   t    i   i   (   R   t   submitt   resultR   (   R   t   future(    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   test_submit   s    c         C   s   |  j  j   } |  j j d d  } |  j  j   } t |  d t |  k sU t  t d   | j   D  sw t  |  j j |  |  j  j   } | | k s t  d  S(   NR   i   i   c         s   s   |  ] } | d  k Vq d S(   i   N(    (   t   .0t   v(    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pys	   <genexpr>   s    (	   R   R   R   t   start_workerR   R   t   anyt   valuest   stop_worker(   R   t   at   wt   bt   c(    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   test_start_worker   s    ""c      	   C   sF   |  j  |  j   . } t |   } | j   s6 t  Wd  QXWd  QXd  S(   N(   R   R   R    R   R   (   R   R    t   e(    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   test_context_manager$   s    c         C   s&   |  j  d d d |  j  Wd  QXd  S(   Ni    R   (   R   R   (   R   (    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   test_no_workers)   s    N(   t   __name__t
   __module__t   NoneR   R   R	   R   R   R   R!   R#   R$   (    (    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyR      s   						N(   R   R    t   objectR   (    (    (    s<   lib/python2.7/site-packages/distributed/deploy/utils_test.pyt   <module>   s   