ó
H`¾Tc           @   sÇ   d  Z  d d l Z d d l Z d d l m Z d a e j j e j j	 e
 ƒ d ƒ Z e j d
 k r d d l m Z e j d e ƒ j ƒ  Z n d d l Z e j d e ƒ Z d e f d	 „  ƒ  YZ d S(   s¹   Enhance nose with extra options and behaviors for running SQLAlchemy tests.

Must be run via ./sqla_nose.py so that it is imported in the expected
way (e.g. as a package-less import).

iÿÿÿÿN(   t   Plugins   plugin_base.pyi   (   t	   machineryt   plugin_baset   NoseSQLAlchemyc           B   sz   e  Z e Z d  Z d Z e j d „ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z RS(   t   sqla_testingid   c            sF   t  j |  | | ƒ | j ‰  ‡  f d †  } t j | ƒ t j ƒ  d  S(   Nc            sE   | j  d d  ƒ ‰  ˆ  r4 ‡  f d †  } | | d <n  ˆ |  |  d  S(   Nt   callbackc            s   ˆ  | | | ƒ d  S(   N(    (   t   optiont   opt_strt   valuet   parser(   t	   callback_(    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   wrap_.   s    (   t   popt   None(   t   namet   kwR   (   t   opt(   R
   sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   make_option+   s
    (   R    t   optionst
   add_optionR   t   setup_optionst   read_config(   t   selfR	   t   envR   (    (   R   sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyR   '   s
    	c         C   sJ   t  t |  ƒ j | | ƒ t j | ƒ t j | j ƒ d d l m a d  S(   Niÿÿÿÿ(   t   fixtures(	   t   superR   t	   configureR   t	   pre_begint   set_coverage_flagt   enable_plugin_coveraget   sqlalchemy.testingR   (   R   R   t   conf(    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyR   6   s    c         C   s   t  j ƒ  d  S(   N(   R   t
   post_begin(   R   (    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   begin?   s    c         C   s   d S(   Nt    (    (   R   t   test(    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   describeTestB   s    c         C   s-   | j  d  k r t S| j  j d ƒ r) t Sd  S(   Ns   sqlalchemy.testing(   t
   __module__R   t   Falset
   startswith(   R   t   fn(    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   wantFunctionE   s    c         C   s   t  j | ƒ S(   N(   R   t
   want_class(   R   t   cls(    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt	   wantClassK   s    c         C   sH   t  | j d ƒ s d  St j | | j j j | j j | j j j ƒ d  S(   NR+   (   t   hasattrR#   R   t   before_testR+   R%   t   methodt   __name__(   R   R#   (    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt
   beforeTestN   s    c         C   s   t  j | ƒ d  S(   N(   R   t
   after_test(   R   R#   (    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt	   afterTestV   s    c         C   s8   t  | t ƒ s# t | t j ƒ r' d  St j | ƒ d  S(   N(   t
   isinstancet   typet
   issubclassR   t   TestBaseR   t   start_test_class(   R   t   ctx(    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   startContextY   s    c         C   s8   t  | t ƒ s# t | t j ƒ r' d  St j | ƒ d  S(   N(   R4   R5   R6   R   R7   R   t   stop_test_class(   R   R9   (    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   stopContext_   s    (   R0   R%   t   Truet   enabledR   t   scoret   ost   environR   R   R!   R$   R)   R,   R1   R3   R:   R<   (    (    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyR   !   s   									(   i   i   (   t   __doc__R@   t   syst   nose.pluginsR    R   R   t   patht   joint   dirnamet   __file__t   version_infot	   importlibR   t   SourceFileLoadert   load_moduleR   t   impt   load_sourceR   (    (    (    sj   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/testing/plugin/noseplugin.pyt   <module>   s   !