ó
O'—^c           @@  sÛ  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z y d  d l m Z Wn e	 k
 rw d  d l Z n Xd  d l
 m Z d  d l m Z m Z m Z d  d l m Z y d  d l Z e j Wn e k
 rê d  d l Z n Xe j d  d k Z e j Z e j Z e j Z d	 e j f d
 „  ƒ  YZ d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% e	 f d „ Z& d „  Z' d „  Z( d „  Z) d S(   i    (   t   absolute_importN(   t   wraps(   t   mock(   t   SkipTest(   t   builtinst   string_tt   StringIO(   t   ensure_bytesi   t   Casec           B@  s   e  Z d  „  Z e Z RS(   c         O@  s"   |  j  t | ƒ t | ƒ | | Ž S(   N(   t   assertEqualt   sorted(   t   selft   at   bt   argst   kwargs(    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   assertItemsEqual"   s    (   t   __name__t
   __module__R   t   assertSameElements(    (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR       s   	t   Mockc           B@  s   e  Z d  „  Z RS(   c         O@  sb   | j  d d  ƒ p i  } t t |  ƒ j | | Ž  x* | j ƒ  D] \ } } t |  | | ƒ q> Wd  S(   Nt   attrs(   t   popt   Nonet   superR   t   __init__t   itemst   setattr(   R   R   R   R   t	   attr_namet
   attr_value(    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR   )   s    (   R   R   R   (    (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR   '   s   t   _ContextMockc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s“   Dummy class implementing __enter__ and __exit__
    as the with statement requires these to be implemented
    in the class, not just the instance.c         C@  s   |  S(   N(    (   R   (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt	   __enter__5   s    c         G@  s   d  S(   N(    (   R   t   exc_info(    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   __exit__8   s    (   R   R   t   __doc__R   R!   (    (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR   0   s   	c          O@  sQ   t  |  | Ž  } | j t ƒ  d ƒ | j t ƒ  d ƒ | | j _ d  | j _ | S(   NR   R!   (   R   t   attach_mockR   R   t   return_valueR   R!   (   R   R   t   obj(    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   ContextMock<   s    t   MockPoolc           B@  s   e  Z d d  „ Z d „  Z RS(   c         C@  s   | p t  ƒ  |  _ d  S(   N(   R&   t   value(   R   R(   (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR   I   s    c         K@  s   |  j  S(   N(   R(   (   R   R   (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   acquireL   s    N(   R   R   R   R   R)   (    (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR'   G   s   c         @  s   t  ˆ  ƒ ‡  f d †  ƒ } | S(   Nc          @  sa   t  ƒ  t _ t  ƒ  t _ z) ˆ  |  t | d t j d t j ƒŽ  SWd  t j t _ t j t _ Xd  S(   Nt   stdoutt   stderr(   R   t   sysR*   R+   t   dictt
   __stdout__t
   __stderr__(   R   R   (   t   fun(    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   _innerR   s    (   R   (   R0   R1   (    (   R0   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   redirect_stdoutsP   s    c          @  s   ‡  f d †  } | S(   Nc         @  s"   t  ˆ  ƒ ‡  ‡ f d †  ƒ } | S(   Nc          @  sñ   g  } x¨ ˆ D]  } t  | t ƒ rI t s7 t | ƒ } n  t j | ƒ } n  | j | ƒ | t j | j	 <| j	 } d | k r | j
 d ƒ \ } } } t t j | | | ƒ q q Wz ˆ  |  | Ž  SWd  x$ | D] } t j j | j	 d  ƒ qÌ WXd  S(   Nt   .(   t
   isinstanceR   t   PY3R   t   typest
   ModuleTypet   appendR,   t   modulesR   t
   rpartitionR   R   R   (   R   R   t   gent   modulet   namet   parentt   _t   attr(   R0   R9   (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   __innerd   s     	(   R   (   R0   RA   (   R9   (   R0   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR1   b   s    (    (   R9   R1   (    (   R9   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   module_exists`   s    c          @  s   ‡  f d †  } | S(   Nc         @  s"   t  ˆ  ƒ ‡  ‡ f d †  ƒ } | S(   Nc          @  sF   t  j ‰  ‡ ‡  f d †  } | t  _ z ˆ |  | Ž  SWd  ˆ  t  _ Xd  S(   Nc         @  s3   |  ˆ  k r t  d |  ƒ ‚ n ˆ |  | | Ž Sd  S(   Ns   No module named %s(   t   ImportError(   R=   R   R   (   t   modnamest
   realimport(    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   myimp…   s    (   R   t
   __import__(   R   R   RF   (   R0   RD   (   RE   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyRA      s    		(   R   (   R0   RA   (   RD   (   R0   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyR1      s    (    (   RD   R1   (    (   RD   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   mask_modules~   s    c         @  s   ‡  f d †  } | S(   Nc         @  s"   t  ˆ  ƒ ‡ ‡  f d †  ƒ } | S(   Nc          @  s;   t  j j ˆ  ƒ r. t d ˆ j ˆ  f ƒ ‚ n  ˆ |  | Ž  S(   Ns   SKIP %s: %s set
(   t   ost   environt   getR   R   (   R   R   (   t   env_var_nameR0   (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   _skips_if_environ™   s    (   R   (   R0   RM   (   RL   (   R0   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt
   _wrap_test—   s    (    (   RL   RN   (    (   RL   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   skip_if_environ•   s    c         @  s   ‡  f d †  } | S(   Nc         @  s"   t  ˆ  ƒ ‡  ‡ f d †  ƒ } | S(   Nc          @  sH   y' t  ˆ ƒ t d ˆ  j ˆ f ƒ ‚ Wn t k
 r: n Xˆ  |  | Ž  S(   Ns   SKIP %s: %s available
(   RG   R   R   RC   (   R   R   (   R0   R<   (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   _skip_if_module§   s    
(   R   (   R0   RP   (   R<   (   R0   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyRN   ¦   s    	(    (   R<   RN   (    (   R<   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   skip_if_module¥   s    c         @  s   ‡  ‡ f d †  } | S(   Nc         @  s%   t  ˆ  ƒ ‡  ‡ ‡ f d †  ƒ } | S(   Nc          @  sH   y t  ˆ ƒ Wn* ˆ k
 r: t d ˆ  j ˆ f ƒ ‚ n Xˆ  |  | Ž  S(   Ns   SKIP %s: %s available
(   RG   R   R   (   R   R   (   R0   t   import_errorsR<   (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   _skip_if_not_module¶   s    (   R   (   R0   RS   (   RR   R<   (   R0   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyRN   µ   s    !(    (   R<   RR   RN   (    (   RR   R<   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   skip_if_not_module´   s    
c         C@  s   t  d ƒ |  ƒ S(   Nt	   QUICKTEST(   RO   (   R0   (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   skip_if_quickÂ   s    c         @  s1   |  j  ‰  t ˆ  ƒ ‡  f d †  ƒ } | |  _  |  S(   Nc         @  s/   t  t d d  ƒ r! t d ƒ ‚ n  ˆ  |  ƒ d  S(   Nt   pypy_version_infos   pypy incompatible(   t   getattrR,   R   R   (   R   (   t   setup(    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   around_setupÉ   s    (   t   setUpR   (   t   clsRZ   (    (   RY   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   case_no_pypyÆ   s    		c         @  s1   |  j  ‰  t ˆ  ƒ ‡  f d †  ƒ } | |  _  |  S(   Nc         @  s#   t  r t d ƒ ‚ n  ˆ  |  ƒ d  S(   Ns   Python3 incompatible(   R5   R   (   R   (   RY   (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyRZ   Õ   s    (   R[   R   (   R\   RZ   (    (   RY   s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   case_no_python3Ò   s    		(*   t
   __future__R    RI   R,   R6   t	   functoolsR   t   unittestR   RC   t   noseR   t
   kombu.fiveR   R   R   t   kombu.utils.encodingR   t   skipt   AttributeErrort	   unittest2t   version_infoR5   t	   MagicMockt   patcht   callt   TestCaseR   R   R   R&   t   objectR'   R2   RB   RH   RO   RQ   RT   RV   R]   R^   (    (    (    s2   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/case.pyt   <module>   sD   													