Ńň
ŐĽWJc        
   @   s   d  Z  d d k Z d d k Z d d k Z d d k Z d d k l Z d d k Z d d k	 l
 Z
 d a d e i i f d     YZ d S(   sł  Test related functionality

Adds a Pylons plugin to `nose
<http://www.somethingaboutorange.com/mrl/projects/nose/>`_ that loads
the Pylons app *before* scanning for doc tests.

This can be configured in the projects :file:`setup.cfg` under a
``[nosetests]`` block:

.. code-block:: ini

    [nosetests]
    with-pylons=development.ini

Alternate ini files may be specified if the app should be loaded using
a different configuration.

i˙˙˙˙N(   t   loadapp(   t   _get_translatort   PylonsPluginc           B   sA   e  Z d  Z e Z d Z d Z e i d  Z	 d   Z
 d   Z RS(   sú   Nose plugin extension

    For use with nose to allow a project to be configured before nose
    proceeds to scan the project for doc tests and unit tests. This
    prevents modules from being loaded without a configured Pylons
    environment.

    t   pylons_configt   pylonsc      
   C   sV   d |  i  i   } | i d d  | i d |  i  d |  i d d d d	 d
 d d S(   s(   Add command-line options for this plugins   NOSE_WITH_%st   -t   _s	   --with-%st   destt   typet   stringt   defaultt    t   helpsK   Setup Pylons environment with the config file specified by ATTR [NOSE_ATTR]N(   t   namet   uppert   replacet
   add_optiont	   enableOpt(   t   selft   parsert   envt   env_opt(    (    sd   /afs/athena.mit.edu/user/x/a/xavid/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/test.pyt   add_options,   s    c         C   s]   d |  _ | |  _ t | |  i  o4 t t | |  i   |  _ t | |  i  |  _ n d S(   s   Configure the pluginN(   t   Nonet   config_filet   conft   hasattrR   t   boolt   getattrt   enabled(   R   t   optionsR   (    (    sd   /afs/athena.mit.edu/user/x/a/xavid/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/test.pyt	   configure7   s
    		c         C   s{   t  i   } t i i d |  t i i |  t d |  i	 d | |  _
 a t t i i d   } t i i |  d S(   su   Called before any tests are collected or run

        Loads the application, and in turn its configuration.

        i    s   config:t   relative_tot   langN(   t   ost   getcwdt   syst   patht   insertt   pkg_resourcest   working_sett	   add_entryR    R   t   appt	   pylonsappR   R   t   configt   gett
   translatort   _push_object(   R   R%   R.   (    (    sd   /afs/athena.mit.edu/user/x/a/xavid/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/test.pyt   begin?   s    (   t   __name__t
   __module__t   __doc__t   FalseR   R   R   R"   t   environR   R   R0   (    (    (    sd   /afs/athena.mit.edu/user/x/a/xavid/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/test.pyR      s   	(   R3   R"   R$   t   nose.pluginst   noseR'   t   paste.deployR    R   t   pylons.i18n.translationR   R   R+   t   pluginst   PluginR   (    (    (    sd   /afs/athena.mit.edu/user/x/a/xavid/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/test.pyt   <module>   s   