ó
P'—^c           @@  s®   d  d l  m Z d  d l m Z d  d l m Z m Z m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d e f d	 „  ƒ  YZ
 d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   i    (   t   absolute_import(   t	   bootsteps(   t   AppCaset   Mockt   patcht   test_StepFormatterc           B@  s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C@  s§   t  j ƒ  } t ƒ  } t | _ |  j | j | ƒ | j ƒ t ƒ  } t | _ t | _	 |  j | j | ƒ | j
 ƒ t ƒ  } t | _ | _	 |  j | j | ƒ d ƒ d  S(   Nt    (   R   t   StepFormatterR   t   Truet   lastt   assertEqualt   _get_prefixt   blueprint_prefixt   Falset   conditionalt   conditional_prefix(   t   selft   ft   st   s2t   s3(    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_get_prefix
   s    						c         C@  s   t  j ƒ  } t ƒ  | _ t ƒ  } t | _ | j | d d ƒ| j j | | j i d d 6ƒ t	 | _ | j | d d ƒ| j j | | j
 i d d 6ƒ d  S(   Nt   xi   (   R   R   R   t	   draw_nodeR   R	   t   nodet   assert_called_witht   node_schemeR   t   blueprint_scheme(   R   R   t   step(    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt	   test_node   s    		 	c         C@  sÁ   t  j ƒ  } t ƒ  | _ t ƒ  t ƒ  } } t | _ | j | | d d ƒ| j j | | | j i d d 6d d 6d d 6ƒ t	 | _ | j | | d d ƒ| j j | | | j i d d 6ƒ d  S(   NR   i   t   nonet	   arrowheadt   darkseagreen3t   color(
   R   R   R   t	   draw_edgeR   R	   t   edgeR   t   edge_schemeR   (   R   R   t   at   b(    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt	   test_edge%   s    		(   t   __name__t
   __module__R   R   R'   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR      s   		t	   test_Stepc           B@  su   e  Z d  e j f d „  ƒ  YZ d „  Z d d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z RS(   t   Defc           B@  s   e  Z d  Z RS(   s   test_Step.Def(   R(   R)   t   name(    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR+   8   s   c         C@  s   g  |  _  d  S(   N(   t   steps(   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   setup;   s    t   test_blueprint_namec         @  sl   d t  j f ‡  f d †  ƒ  Y} |  j | j d ƒ d t  j f ‡  f d †  ƒ  Y} |  j | j d ˆ  ƒ d  S(   Nt   Xc           @  s   e  Z ˆ  Z d  Z RS(   R0   (   R(   R)   t	   blueprintR,   (    (   t   bp(    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR0   @   s   t   Yc           @  s   e  Z d  ˆ  Z RS(   s   %s.Y(   R(   R)   R,   (    (   R2   (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR3   E   s   s   %s.Y(   R   t   StepR
   R,   (   R   R2   R0   R3   (    (   R2   sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR/   >   s    c         C@  s   |  j  |  j |  ƒ ƒ d  S(   N(   t
   assertTrueR+   (   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt	   test_initI   s    c         C@  s   |  j  |  ƒ j |  ƒ d  S(   N(   R+   t   create(   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_createL   s    c         C@  sQ   |  j  |  ƒ } t | _ |  j | j |  ƒ ƒ t | _ |  j | j |  ƒ ƒ d  S(   N(   R+   R   t   enabledR5   t
   include_ifR   t   assertFalse(   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_include_ifO   s
    		c         C@  s/   |  j  |  j |  ƒ j |  j |  ƒ |  j ƒ d  S(   N(   t   assertIsInstanceR+   t   instantiate(   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_instantiateW   s    !c         C@  sd   |  j  |  ƒ } t ƒ  | _ d | j _ |  j | j |  ƒ ƒ |  j | j d ƒ | j j |  ƒ d  S(   Nt   George(	   R+   R   R7   t   return_valueR5   t   includeR
   t   objR   (   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_include_when_enabled[   s    c         C@  sQ   |  j  |  ƒ } t | _ t ƒ  | _ |  j | j |  ƒ ƒ |  j | j j ƒ d  S(   N(   R+   R   R9   R   R7   R;   RB   t
   call_count(   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_include_when_disabledd   s
    	c         C@  s&   |  j  |  ƒ } |  j t | ƒ ƒ d  S(   N(   R+   R5   t   repr(   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt	   test_reprl   s    (   R(   R)   R   t   StartStopStepR+   R.   R/   R6   R8   R<   R?   RD   RF   RH   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR*   6   s   								t   test_ConsumerStepc           B@  s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C@  s6   t  j |  ƒ } |  j t ƒ  | j |  ƒ Wd  QXd  S(   N(   R   t   ConsumerStept   assertRaisest   NotImplementedErrort   get_consumers(   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_interfaces   s    c         @  s±   t  ƒ  ‰  t  ƒ  |  _ d t j f ‡  f d †  ƒ  Y} | |  ƒ } |  j | j |  ƒ ˆ  g ƒ | j |  ƒ ˆ  j j ƒ  | j	 |  ƒ ˆ  j
 j ƒ  | j |  ƒ ˆ  j j j ƒ  d  S(   NR4   c           @  s   e  Z ‡  f d  †  Z RS(   c         @  s   ˆ  g S(   N(    (   R   t   c(   t   consumer(    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRN   ~   s    (   R(   R)   RN   (    (   RQ   (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR4   |   s   (   R   t
   connectionR   RK   R
   RN   t   startt   consumeR   t   stopt   cancelt   shutdownt   channelt   close(   R   R4   R   (    (   RQ   sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_start_stop_shutdownx   s    	c         C@  sB   t  ƒ  |  _ d t j f d „  ƒ  Y} | |  ƒ } | j |  ƒ d  S(   NR4   c           B@  s   e  Z d  „  Z RS(   c         S@  s   d S(   N(    (    (   R   RP   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRN   ‘   s    (   R(   R)   RN   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR4      s   (   R   RR   R   RK   RS   (   R   R4   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_start_no_consumersŒ   s    (   R(   R)   RO   RZ   R[   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRJ   q   s   		t   test_StartStopStepc           B@  sE   e  Z d  e j f d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z RS(   R+   c           B@  s   e  Z d  Z RS(   s   test_StartStopStep.Def(   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR+   š   s   c         C@  s   g  |  _  d  S(   N(   R-   (   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR.      s    c         C@  s¬   |  j  |  ƒ } t ƒ  | _ | j |  ƒ |  j |  j ƒ |  j |  j d | ƒ | j |  ƒ | j j j	 ƒ  | j
 |  ƒ | j j
 j	 ƒ  d  | _ |  j | j |  ƒ ƒ d  S(   Ni    (   R+   R   R7   RB   R5   R-   t   assertIsRS   RC   R   RU   t   Nonet   assertIsNone(   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_start__stop    s    	c         C@  s9   |  j  |  ƒ } t | _ | j |  ƒ |  j |  j ƒ d  S(   N(   R+   R   R9   RB   R;   R-   (   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRF   ´   s    	c         C@  sY   |  j  |  ƒ } t ƒ  | _ | j |  ƒ t | j d ƒ | j |  ƒ | j j j ƒ  d  S(   Nt	   terminate(	   R+   R   R7   RB   t   delattrRC   Ra   RU   R   (   R   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_terminateº   s    (	   R(   R)   R   RI   R+   R.   R`   RF   Rc   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR\   ˜   s
   			t   test_Blueprintc           B@  sr   e  Z d  e j f d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z RS(   t	   Blueprintc           B@  s   e  Z d  Z RS(   Rd   (   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRe   Æ   s   c         @  sÅ   d t  j f d „  ƒ  Y‰  d t  j f d „  ƒ  Y‰ d t  j f d „  ƒ  Y} d |  j f ‡  ‡ f d †  ƒ  Y} | d	 |  j ƒ } |  j ˆ  | j ƒ  ƒ |  j ˆ | j ƒ  ƒ |  j | | j ƒ  ƒ d  S(
   Nt   tnAc           B@  s   e  Z d  Z RS(   s   test_Blueprint.A(   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRf   Ë   s   t   tnBc           B@  s   e  Z d  Z RS(   s   test_Blueprint.B(   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRg   Î   s   t   xxAc           B@  s   e  Z d  Z RS(   s   xx.A(   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRh   Ñ   s   Re   c           @  s   e  Z ˆ  ˆ g Z RS(    (   R(   R)   t   default_steps(    (   Rf   Rg   (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRe   Ô   s   t   app(   R   R4   Re   Rj   t   assertInt
   _all_stepst   assertNotIn(   R   Rh   Re   R1   (    (   Rf   Rg   sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_steps_added_to_unclaimedÉ   s    "c         C@  sB   |  j  d |  j ƒ } |  j | j |  j ƒ |  j | j d ƒ d  S(   NRj   Rd   (   Re   Rj   R]   R
   R,   (   R   R1   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR6   Ü   s    c         C@  sW   |  j  d |  j ƒ } d  | _ t ƒ  | _ | j d ƒ | j j d d d d t ƒd  S(   NRj   i   RY   t   closingt   reverse(	   Re   Rj   R^   t   on_closeR   t   send_allRY   R   R   (   R   R1   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_close__on_close_is_Noneá   s    		c         C@  sM   t  ƒ  } |  j d |  j ƒ } d  d  d  g | _ | j | d d d t ƒd  S(   NRj   RY   t   ClosingRp   (   R   Re   Rj   R^   R-   Rr   R   (   R   t   parentR1   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_send_all_with_None_stepsê   s    	c         C@  s‡   t  j t f } t  _ z` |  j d |  j ƒ } t ƒ  | _ t d ƒ | j j _ | j	 d d ƒ | j j j
 d d ƒ Wd  | t  _ Xd  S(   NRj   t   luket   timeouti
   (   R   t   IGNORE_ERRORSt   KeyErrorRe   Rj   R   t   shutdown_completet   waitt   side_effectt   joinR   (   R   t   prevR1   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_join_raises_IGNORE_ERRORSð   s    c         C@  s0  d t  j f d „  ƒ  Y} d t  j f d „  ƒ  Y} d t  j f d „  ƒ  Y} d t  j f d „  ƒ  Y} |  j | | g d	 |  j ƒ} |  j | | g d	 |  j ƒ} | j t ƒ  ƒ | j t ƒ  ƒ | j | ƒ |  j | | j ƒ |  j | | j ƒ |  j | | j ƒ |  j	 t
 | ƒ ƒ |  j	 t | ƒ ƒ d  S(
   Nt   b1s1c           B@  s   e  Z RS(    (   R(   R)   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR   ý   s   t   b1s2c           B@  s   e  Z e Z RS(    (   R(   R)   R   R	   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR‚      s   t   b2s1c           B@  s   e  Z RS(    (   R(   R)   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRƒ     s   t   b2s2c           B@  s   e  Z e Z RS(    (   R(   R)   R   R	   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR„     s   Rj   (   R   R4   Re   Rj   t   applyR   t   connect_withRk   t   graphR5   RG   t   str(   R   R   R‚   Rƒ   R„   t   b1t   b2(    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_connect_withû   s    c         C@  sò   d t  j f d „  ƒ  Y} |  j | g d |  j ƒ} | j ƒ  | _ |  j t ƒ  | j | j ƒ Wd  QXd | _	 | j ƒ  | _ | j | j ƒ t
 d ƒ O } t ƒ  } | _ t d ƒ | j _ |  j t ƒ  | j | j ƒ Wd  QXWd  QXd  S(   NR4   c           B@  s   e  Z d Z RS(   s   xyxxx.fsdasewe.Unknown(   s   xyxxx.fsdasewe.Unknown(   R(   R)   t   requires(    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR4     s   Rj   s    celery.bootsteps.DependencyGrapht   foo(    (   R   R4   Re   Rj   t   claim_stepsR-   RL   t   ImportErrort   _finalize_stepsRŒ   R   R   RA   Rz   t   topsortR}   (   R   R4   R&   t   Dept   g(    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_topsort_raises_KeyError  s    	c         @  sB  d t  j f d „  ƒ  Y} d t  j f d „  ƒ  Y‰  d t  j f ‡  f d †  ƒ  Y‰ d t  j f ‡ f d †  ƒ  Y} d	 t  j f d
 „  ƒ  Y} | | | g d |  j ƒ} | j |  ƒ |  j | j d ˆ  ƒ |  j | j d ˆ ƒ |  j | j d | ƒ |  j | j d | ƒ |  j | | j ƒ |  j	 | | j
 | j d ƒ d  S(   Nt   MyBlueprintc           B@  s   e  Z d  Z d „  Z RS(   t
   test_applyc         S@  s
   d d g S(   Nt   At   B(    (   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   modules/  s    (   R(   R)   R,   R™   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR•   ,  s   R˜   c           B@  s   e  Z d  Z RS(   s   test_apply.B(   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR˜   2  s   t   Cc           @  s   e  Z d  Z ˆ  g Z RS(   s   test_apply.C(   R(   R)   R,   RŒ   (    (   R˜   (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRš   5  s   R—   c           @  s   e  Z d  Z ˆ  g Z RS(   s   test_apply.A(   R(   R)   R,   RŒ   (    (   Rš   (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR—   9  s   t   Dc           B@  s   e  Z d  Z e Z RS(   s   test_apply.D(   R(   R)   R,   R   R	   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR›   =  s   Rj   i    i   i   i   (   R   Re   R4   Rj   R…   R=   t   orderRk   t   typesR]   R,   (   R   R•   R—   R›   R   (    (   R˜   Rš   sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR–   *  s    c         C@  sO   d t  j f d „  ƒ  Y} | d |  j ƒ } | j |  ƒ |  j | j ƒ  ƒ d  S(   NR•   c           B@  s   e  Z d  Z RS(   t   qwejwioqjewoqiej(   R(   R)   R,   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyR•   M  s   Rj   (   R   Re   Rj   R…   R_   t
   _find_last(   R   R•   R   (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   test_find_last_but_no_stepsK  s    (   R(   R)   R   Re   Rn   R6   Rs   Rv   R€   R‹   R”   R–   R    (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyRd   Ä   s   									!N(   t
   __future__R    t   celeryR   t   celery.tests.caseR   R   R   R   R*   RJ   R\   Rd   (    (    (    sD   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/worker/test_bootsteps.pyt   <module>   s   .;',