File: //opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyc
�
�M!Vc           @   sX  d  Z  y d d l Z Wn! e k
 r9 d d l m Z n Xd d l Z e j d k Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z y d d l
 Z
 e Z Wn e k
 r� e Z n Xd �  Z d �  Z d	 �  Z e re j d � Z d
 �  Z d �  Z n  d �  Z d
 �  Z d a d �  Z d �  Z d �  Z d �  Z d �  Z  d �  Z! d S(   s�   NOTE:  copied/adapted from SQLAlchemy master for backwards compatibility;
   this should be removable when Alembic targets SQLAlchemy 1.0.0.
i����Ni   (   t   plugin_basei   i    c            s9   |  j  d � �  �  f d �  } t j | � t j �  d  S(   Nt
   sqlalchemyc            sX   | j  d d  � �  �  rD d t j f �  f d �  �  Y} | | d <n  � j |  | � d  S(   Nt   callbackt   CallableActionc              s   e  Z d �  f d  � Z RS(   c            s   �  | | | � d  S(   N(    (   t   selft   parsert	   namespacet   valuest
   option_string(   t	   callback_(    sT   /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyt   __call__$   s    N(   t   __name__t
   __module__t   NoneR
   (    (   R	   (    sT   /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyR   #   s   t   action(   t   popR
   t   argparset   Actiont	   addoption(   t   namet   kwR   (   t   group(   R	   sT   /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyt   make_option    s
    
(   t   getgroupR    t
   setup_optionst   read_config(   R   R   (    (   R   sT   /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyt   pytest_addoption   s    
c         C   sr   t  |  d � r6 t j |  j � t j |  j d � n  t j |  j � t t |  j d t	 � � } t j
 | � d  S(   Nt
   slaveinputt   follower_identt
   cov_source(   t   hasattrR    t!   restore_important_follower_configR   t   configure_followert	   pre_begint   optiont   boolt   getattrt   Falset   set_coverage_flag(   t   configt   coverage(    (    sT   /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyt   pytest_configure/   s    c         C   s   t  j �  d  S(   N(   R    t
   post_begin(   t   session(    (    sT   /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/pytestplugin.pyt   pytest_sessionstart<