ó
ßüÚ\c           @   sw   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d  d l m Z m	 Z	 m
 Z
 d   Z d   Z d   Z d S(	   iĸĸĸĸN(   t   gen(   t   rpc(   t   RemoteClient(   t   loopt   valid_python_scriptt   invalid_python_scriptc            s/   t  j   f d    } |  j | d d d  S(   Nc          3   sĄ   t  d d d t     }  |  j d  Vt |  j  } | j d d d d  V} | i d	 d
 6d d 6k sq t    j d  j   d k s t  |  j	   Vd  S(   Nt   ips	   127.0.0.1t	   local_diri    t   filenames	   script.pyt   file_payloads   x=1t   OKt   statusi   t   nbytes(
   R   t   strt   _startR   t   addresst   upload_filet   AssertionErrort   joint   readt   _close(   t   remote_clientt   remote_processt   upload(   t   tmpdir(    sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyt   test   s    	 !t   timeouti   (   R    t	   coroutinet   run_sync(   R   R   R   (    (   R   sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyt!   test_remote_client_uploads_a_file   s    c            s/   t  j   f d    } |  j | d d d  S(   Nc          3   sŠ   t  d d d t     }  |  j d  Vt |  j  } | j d d d d  V| j d d  V} | d	 d
 t j j	   k s t
  | d d k s t
  |  j   Vd  S(   NR   s	   127.0.0.1R   i    R   s	   script.pyR	   s   print("hello world!")t   stdouts   hello world!t
   returncode(   R   R   R   R   R   R   t   executet   ost   linesept   encodeR   R   (   R   t   rrt   message(   R   (    sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyR   !   s    #R   i   (   R    R   R   (   R   R   R   (    (   R   sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyt.   test_remote_client_execution_outputs_to_stdout    s    c            s/   t  j   f d    } |  j | d d d  S(   Nc          3   s   t  d d d t     }  |  j d  Vt |  j  } | j d d d d  V| j d d  V} d	 | d
 k sx t  | d d k s t  |  j   Vd  S(   NR   s	   127.0.0.1R   i    R   s	   script.pyR	   s   a+1s   'a' is not definedt   stderrR   i   (	   R   R   R   R   R   R   R    R   R   (   R   R$   R%   (   R   (    sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyR   2   s    R   i   (   R    R   R   (   R   R   R   R   (    (   R   sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyt+   test_remote_client_execution_outputs_stderr1   s    (   R!   t   tornadoR    t   distributedR   t   distributed.submitR   t   distributed.utils_testR   R   R   R   R&   R(   (    (    (    sJ   lib/python2.7/site-packages/distributed/tests/test_submit_remote_client.pyt   <module>   s   		