ó
ÎhOc           @   sä   d  d l  Z  d d d „  ƒ  YZ d g Z d d „ Z d e  j e f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d „  Z d e  j e f d „  ƒ  YZ	 d e
 f d „  ƒ  YZ d e
 f d „  ƒ  YZ d e f d „  ƒ  YZ d d d „  ƒ  YZ d S(   iÿÿÿÿNt   CEBasec           B   s2   e  Z d  „  Z e e ƒ Z d „  Z e e ƒ Z RS(   c         C   s   d d l  m } | S(   Niÿÿÿÿ(   t   ConflictError(   t   repoze.retryR   (   t   selfR   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _getConflictError   s    c         C   s   d d l  m } | S(   Niÿÿÿÿ(   t   RetryException(   R   R   (   R   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _getRetryException   s    (   t   __name__t
   __module__R   t   propertyR   R   R   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR       s   		s   Content-Types
   text/plainc         C   s   d  S(   N(    (   t   resultt   headerst   exc_info(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _faux_start_response   s    t
   RetryTestsc           B   s°   e  Z d Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   d d l  m } | S(   Niÿÿÿÿ(   t   Retry(   R   R   (   R   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _getTargetClass   s    c         O   s   |  j  ƒ  | | Ž  S(   N(   R   (   R   t   argt   kw(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _makeOne   s    c         K   s   i  S(   N(    (   R   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _makeEnv!   s    c         C   s\   t  d d ƒ } |  j | d d d |  j ƒ} t | d ƒ rX |  j | j |  j f ƒ n  d  S(   Nt	   conflictsi   t   triesi   t	   retryable(   t   DummyApplicationR   R   t   hasattrt   assertEqualR   (   R   t   applicationt   retry(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_retryable_is_not_sequence$   s
    c         C   sP   t  d d ƒ } |  j | d d d |  j f ƒ} |  j t | |  j ƒ  t ƒ d  S(   NR   i   R   i   R   (   R   R   R   t   assertRaisest   AssertionErrorR   R   (   R   R   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt2   test_conflict_not_raised_start_response_not_called+   s
    c         C   sÐ   t  d d ƒ } |  j | d d d |  j f ƒ} |  j ƒ  } d d  l } | j ƒ  | d <|  j |  j | | t ƒ |  j | j d ƒ | d } x t	 | d ƒ r¬ | j
 } q‘ Pq‘ |  j | j ƒ  j d	 ƒ ƒ d  S(
   NR   i   R   i   R   iÿÿÿÿs   wsgi.errorst   errorss   repoze.retry retrying(   R   R   R   R   t   StringIOt   failUnlessRaisesR   R   t   calledR   R!   t
   failUnlesst   getvaluet
   startswith(   R   R   R   t   envR"   R!   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt.   test_conflict_raised_start_response_not_called2   s    
c         G   s   | |  _  d  S(   N(   t   _dummy_start_response_result(   R   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   _dummy_start_responseE   s    c         C   s‹   t  d d d t ƒ } |  j | d d d |  j f ƒ} |  j |  j | |  j ƒ  |  j ƒ |  j | j d ƒ |  j |  j	 d t
 d  f ƒ d  S(   NR   i   t   call_start_responseR   i   R   s   200 OK(   R   t   TrueR   R   R#   R   R+   R   R$   R*   t   _MINIMAL_HEADERSt   None(   R   R   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt*   test_conflict_raised_start_response_calledH   s    
c         C   sš   t  d d d t ƒ } |  j | d d d |  j f ƒ} t | |  j ƒ  |  j ƒ ƒ } |  j | j d ƒ |  j |  j	 d t
 d  f ƒ |  j | d g ƒ d  S(	   NR   i   R,   R   i   R   s   200 OKt   hello(   R   R-   R   R   t   unwindR   R+   R   R$   R*   R.   R/   (   R   R   R   R
   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt.   test_conflict_not_raised_start_response_calledR   s    c         C   s~   t  d d d t d t ƒ } |  j | d d d t f ƒ} t | |  j ƒ  t ƒ ƒ } |  j | d g ƒ |  j | j d ƒ d  S(	   NR   i   t	   exceptionR,   R   i   R   R1   (	   R   t	   RetryableR-   R   R2   R   R   R   R$   (   R   R   R   R
   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt!   test_alternate_retryble_exception\   s    	c         C   sþ   t  d d d t ƒ } t  d d d t d t ƒ } |  j | d d d |  j t f ƒ} t | |  j ƒ  t ƒ ƒ } |  j | d g ƒ |  j | j	 d ƒ |  j | d d d |  j t f ƒ} t | |  j ƒ  t ƒ ƒ } |  j | d g ƒ |  j | j	 d ƒ d  S(	   NR   i   R,   R4   R   i   R   R1   (
   R   R-   R5   R   R   R2   R   R   R   R$   (   R   t   app1t   app2t   retry1R
   t   retry2(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt"   test_alternate_retryble_exceptionse   s    		c         C   sß   t  d d d t ƒ } |  j | d d d |  j f ƒ} |  j ƒ  } d d } t t | ƒ ƒ | d	 <d
 d l m } | | ƒ } | | d <t | | |  j	 ƒ ƒ |  j
 | j d ƒ |  j | d | k ƒ |  j
 | j | ƒ d  S(   NR   i   R,   R   i   R   t   xiè  t   CONTENT_LENGTHiÿÿÿÿ(   R"   s
   wsgi.input(   R   R-   R   R   R   t   strt   lenR"   R2   R+   R   R$   t   failIft
   wsgi_input(   R   R   R   R(   t   dataR"   RA   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt9   test_wsgi_input_seeked_to_zero_on_conflict_withcontentlenw   s    

c         C   sß   t  d d d t ƒ } |  j | d d d |  j f ƒ} |  j ƒ  } d d } t t | ƒ ƒ | d
 <d d l m } | | ƒ } | | d <t | | |  j	 ƒ ƒ |  j
 | j d ƒ |  j | d | k ƒ |  j
 | j | ƒ d  S(   NR   i   R,   R   i   R   R<   i   i   R=   iÿÿÿÿ(   R"   s
   wsgi.inputi   i  (   R   R-   R   R   R   R>   R?   R"   R2   R+   R   R$   R@   RA   (   R   R   R   R(   RB   R"   RA   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_largechunksize†   s    

c         C   sá   t  d d d t ƒ } |  j | d d d |  j f d d ƒ} |  j ƒ  } d } t t | ƒ ƒ | d <d d l m } | | ƒ } | | d <t | | |  j	 ƒ ƒ |  j
 | j d ƒ |  j | d | k ƒ |  j
 | j | ƒ d  S(   NR   i   R,   R   i   R   t	   highwateri
   R<   i   R=   iÿÿÿÿ(   R"   s
   wsgi.inputt   xxxxxxxxxxxxxxxxxxxx(   R   R-   R   R   R   R>   R?   R"   R2   R+   R   R$   R@   RA   (   R   R   R   R(   RB   R"   RA   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_over_highwater•   s    
c         C   sú   d d l  m } |  j ƒ  } d | d <t | ƒ | d <t d d d t ƒ } |  j | d	 d
 d |  j f ƒ} t | | |  j	 ƒ ƒ } |  j
 | j d ƒ d } |  j
 | | g ƒ |  j
 |  j d d ƒ |  j
 |  j d d d t t | ƒ ƒ f g ƒ d  S(   Niÿÿÿÿ(   t   timeoutt   100R=   s
   wsgi.inputR   i    R,   R   i   R   s*   Not enough data in request or socket errors   400 Bad Requesti   s   Content-Types
   text/plains   Content-Length(   s   Content-Types
   text/plain(   t   socketRH   R   t   ErrorRaisingStreamR   R-   R   R   R2   R+   R   R$   R*   R>   R?   (   R   RH   R(   R   R   R
   t   msg(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_socket_timeout_error¤   s     
c         C   s   d d l  m } |  j ƒ  } t d ƒ | d <t | ƒ | d <t d d d	 t ƒ } |  j | d
 d d |  j f ƒ} t	 | | |  j
 ƒ ƒ } |  j | j d ƒ d } |  j | | g ƒ |  j |  j d d ƒ |  j |  j d d d t t | ƒ ƒ f g ƒ d  S(   Niÿÿÿÿ(   RH   i   i   R=   s
   wsgi.inputR   i    R,   R   i   R   s*   Not enough data in request or socket errors   400 Bad Requests   Content-Types
   text/plains   Content-Lengthi    (   s   Content-Types
   text/plain(   RJ   RH   R   R>   RK   R   R-   R   R   R2   R+   R   R$   R*   R?   (   R   RH   R(   R   R   R
   RL   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt&   test_socket_timeout_error_chunked_read¶   s     c         C   sê   |  j  ƒ  } d | d <t t ƒ | d <t d d d t ƒ } |  j | d d d	 |  j f ƒ} t | | |  j ƒ ƒ } |  j	 | j
 d ƒ d
 } |  j	 | | g ƒ |  j	 |  j d d ƒ |  j	 |  j d d d t t | ƒ ƒ f g ƒ d  S(   NRI   R=   s
   wsgi.inputR   i    R,   R   i   R   s*   Not enough data in request or socket errors   400 Bad Requesti   s   Content-Types
   text/plains   Content-Length(   s   Content-Types
   text/plain(   R   RK   t   IOErrorR   R-   R   R   R2   R+   R   R$   R*   R>   R?   (   R   R(   R   R   R
   RL   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_io_errorÈ   s    
c         C   sð   |  j  ƒ  } t d ƒ | d <t t ƒ | d <t d d d t ƒ } |  j | d d	 d
 |  j f ƒ} t | | |  j	 ƒ ƒ } |  j
 | j d ƒ d } |  j
 | | g ƒ |  j
 |  j d d ƒ |  j
 |  j d d d t t | ƒ ƒ f g ƒ d  S(   Ni   i   R=   s
   wsgi.inputR   i    R,   R   i   R   s*   Not enough data in request or socket errors   400 Bad Requests   Content-Types
   text/plains   Content-Lengthi    (   s   Content-Types
   text/plain(   R   R>   RK   RO   R   R-   R   R   R2   R+   R   R$   R*   R?   (   R   R(   R   R   R
   RL   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt"   test_io_timeout_error_chunked_readÙ   s    N(   R   R   R/   R*   R   R   R   R   R    R)   R+   R0   R3   R6   R;   RC   RD   RG   RM   RN   RP   RQ   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR      s&   								
	
									t   WSGIConformanceTestsc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s    d d  l  } | j d d ƒ d  S(   Niÿÿÿÿt   actiont   error(   t   warningst   filterwarnings(   R   RU   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   setUpì   s    c         C   s   d d  l  } | j ƒ  d  S(   Niÿÿÿÿ(   RU   t   resetwarnings(   R   RU   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   tearDownð   s    c         O   sD   d d l  m } | | ƒ } |  j ƒ  | | | Ž } | | ƒ } | S(   Niÿÿÿÿ(   t	   validator(   t   wsgiref.validateRZ   R   (   R   t   appR   R   RZ   t   rhsR   t   lhs(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR   ô   s
    c         K   s;   d d l  m } i  } | | ƒ | j | ƒ d | d <| S(   Niÿÿÿÿ(   t   setup_testing_defaultst    t   QUERY_STRING(   t   wsgiref.utilR_   t   update(   R   R   R_   R(   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR   û   s    

(   R   R   RW   RY   R   R   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyRR   ê   s   			c         C   s,   t  |  ƒ } t |  d ƒ r( |  j ƒ  n  | S(   Nt   close(   t   listR   Rd   (   R
   t   result2(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR2     s    t   FactoryTestsc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s‡   d d l  m } t ƒ  } | | i  ƒ } |  j | j | k ƒ |  j | j d ƒ |  j | j d ƒ |  j | j |  j |  j	 f ƒ d  S(   Niÿÿÿÿ(   t
   make_retryi   (
   R   Rh   t   objectR%   R   R   R   R   R   R   (   R   Rh   R\   t
   middleware(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_make_retry_defaults  s    	c         C   sz   d d l  m } t ƒ  } | | i  d d ƒ} |  j | j | k ƒ |  j | j d ƒ |  j | j |  j |  j	 f ƒ d  S(   Niÿÿÿÿ(   Rh   R   i   (
   R   Rh   Ri   R%   R   R   R   R   R   R   (   R   Rh   R\   Rj   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   test_make_retry_override_tries  s    	c         C   su   d d l  m } t ƒ  } | | i  d d t ƒ} |  j | j | k ƒ |  j | j d ƒ |  j | j t	 f ƒ d  S(   Niÿÿÿÿ(   Rh   R   s   %s:Retryablei   (
   R   Rh   Ri   R   R%   R   R   R   R   R5   (   R   Rh   R\   Rj   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt&   test_make_retry_override_retryable_one  s    	c         C   s~   d d l  m } t ƒ  } | | i  d d t t f ƒ} |  j | j | k ƒ |  j | j d ƒ |  j | j t	 t
 f ƒ d  S(   Niÿÿÿÿ(   Rh   R   s    %s:Retryable %s:AnotherRetryablei   (   R   Rh   Ri   R   R%   R   R   R   R   R5   t   AnotherRetryable(   R   Rh   R\   Rj   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt+   test_make_retry_override_retryable_multiple%  s    	(   R   R   Rk   Rl   Rm   Ro   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyRg   
  s   				R5   c           B   s   e  Z RS(    (   R   R   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR5   /  s   Rn   c           B   s   e  Z RS(    (   R   R   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyRn   2  s   R   c           B   s    e  Z e d d  „ Z d „  Z RS(   c         C   sI   d |  _  | |  _ | |  _ | d  k r3 |  j } n  | |  _ d |  _ d  S(   Ni    R`   (   R$   R   R,   R/   R   R4   RA   (   R   R   R,   R4   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   __init__6  s    				c         C   sr   |  j  r | d t ƒ n  |  j |  j k  rF |  j d 7_ |  j ‚ n  | j d ƒ rk | d j ƒ  |  _ n  d g S(   Ns   200 OKi   s
   wsgi.inputR1   (   R,   R.   R$   R   R4   t   gett   readRA   (   R   t   environt   start_response(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   __call__@  s    	N(   R   R   t   FalseR/   Rp   Ru   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyR   5  s   	RK   c           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  d  S(   N(   t   exc(   R   Rw   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyRp   L  s    c         C   s   |  j  ƒ  ‚ d  S(   N(   Rw   (   R   t   amt(    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyRr   N  s    c         C   s   |  j  ƒ  ‚ d  S(   N(   Rw   (   R   Rx   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   readlineP  s    c         C   s   |  j  ƒ  ‚ d  S(   N(   Rw   (   R   Rx   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt	   readlinesR  s    c         C   s   |  S(   N(    (   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   __iter__T  s    c         C   s   |  j  ƒ  ‚ d  S(   N(   Rw   (   R   (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   nextV  s    (   R   R   Rp   Rr   Ry   Rz   R{   R|   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyRK   K  s   					(    (   s   Content-Types
   text/plain(    (   t   unittestR    R.   R/   R   t   TestCaseR   RR   R2   Rg   t	   ExceptionR5   Rn   R   RK   (    (    (    s[   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/repoze/retry/tests.pyt   <module>   s   	Ô	%