ó
¿b›]c           @   sË   d  d l  m Z d  d l Z d  d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d	 l m	 Z	 d d
 l m
 Z
 d d l m Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   dequeNi   (   t   config(   t   fixtures(   t	   profilingi   (   t   create_engine(   t   MetaData(   t   util(   t   Sessiont   ReplayFixtureTestc           B   s>   e  Z e j d  „  ƒ Z d „  Z d „  Z d „  Z d „  Z RS(   c         o   s	   d  Vd  S(   N(    (   t   selft   argt   kw(    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyt
   _dummy_ctx   s    c            s<  t  ƒ  ‰ t j j j ‰  ‡  ‡ f d †  } t t j j d | d t ƒ} t | ƒ |  _	 | |  _
 t | ƒ |  _ |  j ƒ  z |  j d |  j ƒ Wd  |  j ƒ  | j ƒ  X‡ f d †  } t t j j d | d t ƒ} t | ƒ |  _	 | |  _
 t | ƒ |  _ |  j ƒ  z |  j d t j ƒ Wd  |  j j ƒ  | j ƒ  Xd  S(   Nc              s   ˆ j  ˆ  ƒ  ƒ S(   N(   t   recorder(    (   t   creatort   dbapi_session(    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR      s    R   t   use_native_hstoret   ctxc              s
   ˆ  j  ƒ  S(   N(   t   player(    (   R   (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR   )   s    (   t   ReplayableSessionR   t   dbt   poolt   _creatorR   t   urlt   FalseR   t   metadatat   engineR   t   sessiont   setup_enginet
   _run_stepsR   t   teardown_enginet   disposeR   t   count_functionst   close(   R	   R   R   R   (    (   R   R   s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyt   test_invocation   s0    		

	
c         C   s   d  S(   N(    (   R	   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR   ;   s    c         C   s   d  S(   N(    (   R	   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR   >   s    c         C   s   t  ƒ  ‚ d  S(   N(   t   NotImplementedError(   R	   R   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR   A   s    (	   t   __name__t
   __module__t
   contextlibt   contextmanagerR   R"   R   R   R   (    (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR      s
   	(		R   c           B   st  e  Z d  Z e ƒ  Z e ƒ  Z e j rŒ e g  e	 e
 ƒ D]$ Z e j d ƒ s7 e e
 e ƒ ^ q7 ƒ j g  d D] Z e e
 e ƒ ^ qk ƒ Z nŸ e g  e	 e
 ƒ D]$ Z e j d ƒ sœ e e
 e ƒ ^ qœ ƒ j g  e j ƒ  D]' Z e e e ƒ s÷ e e ƒ n e ^ qÖ ƒ j g  d D] Z e e
 e ƒ ^ qƒ Z d „  Z d	 „  Z d
 „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ RS(   s  A simple record/playback tool.

    This is *not* a mock testing class.  It only records a session for later
    playback and makes no assertions on call consistency whatsoever.  It's
    unlikely to be suitable for anything other than DB-API recording.

    t   _t   FunctionTypet   BuiltinFunctionTypet
   MethodTypet   BuiltinMethodTypet
   LambdaTypet   UnboundMethodTypec         C   s   t  ƒ  |  _ d  S(   N(   R    t   buffer(   R	   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyt   __init__~   s    c         C   s   |  j  |  j | ƒ S(   N(   t   RecorderR/   (   R	   t   base(    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR      s    c         C   s   |  j  |  j ƒ S(   N(   t   PlayerR/   (   R	   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR   „   s    R1   c           B   s2   e  Z d  „  Z d „  Z e d „  ƒ Z d „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   _buffert   _subject(   R	   R/   t   subject(    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR0   ˆ   s    	c         O   s‡   g  d D] } t  j |  | ƒ ^ q \ } } | | | Ž  } t | ƒ t j k rr | j t j ƒ t |  ƒ | | ƒ S| j | ƒ | Sd  S(   NR5   R4   (   R5   R4   (   t   objectt   __getattribute__t   typeR   t   Nativest   appendt   Callable(   R	   t   argsR   t   xR6   R/   t   result(    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyt   __call__Œ   s    (c         C   s   |  j  S(   N(   R5   (   R	   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyt   _sqla_unwrapš   s    c         C   sã   y t  j |  | ƒ SWn t k
 r' n Xg  d D] } t  j |  | ƒ ^ q/ \ } } y t | ƒ j | | ƒ } Wn$ t k
 r• | j t j ƒ ‚  nJ Xt | ƒ t j k rÎ | j t j ƒ t |  ƒ | | ƒ S| j | ƒ | Sd  S(   NR5   R4   (   R5   R4   (	   R7   R8   t   AttributeErrorR9   R;   R   t   NoAttributeR:   R<   (   R	   t   keyR>   R6   R/   R?   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR8   ž   s     ((   R$   R%   R0   R@   t   propertyRA   R8   (    (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR1   ‡   s   		R3   c           B   s2   e  Z d  „  Z d „  Z e d „  ƒ Z d „  Z RS(   c         C   s   | |  _  d  S(   N(   R4   (   R	   R/   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR0   ¶   s    c         O   s9   t  j |  d ƒ } | j ƒ  } | t j k r1 |  S| Sd  S(   NR4   (   R7   R8   t   popleftR   R<   (   R	   R=   R   R/   R?   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR@   ¹   s
    c         C   s   d  S(   N(   t   None(   R	   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyRA   Á   s    c         C   s   y t  j |  | ƒ SWn t k
 r' n Xt  j |  d ƒ } | j ƒ  } | t j k rY |  S| t j k rw t | ƒ ‚ n | Sd  S(   NR4   (   R7   R8   RB   RF   R   R<   RC   (   R	   RD   R/   R?   (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR8   Å   s    (   R$   R%   R0   R@   RE   RA   R8   (    (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR3   µ   s   		(   R)   R*   R+   R,   R-   R.   (   R)   R*   R+   R,   R-   (   R$   R%   t   __doc__R7   R<   RC   R   t   py2kt   sett   dirt   typest   tt
   startswitht   getattrt
   differenceR:   t   uniont   __builtins__t   valuest
   isinstanceR9   R0   R   R   R1   R3   (    (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyR   E   s<   			:     %':    "			.(   t   collectionsR    R&   RL   t    R   R   R   R   R   R   t   ormR   t   TestBaseR   R7   R   (    (    (    s@   lib/python2.7/site-packages/sqlalchemy/testing/replay_fixture.pyt   <module>   s   7