ó
î®fPc           @   s“   d  Z  d d l m Z d d l m Z d d l Z d d l Z e j e ƒ Z	 d e f d „  ƒ  YZ
 d d d „  ƒ  YZ d	 e j f d
 „  ƒ  YZ d S(   s  
This plugin bypasses the actual execution of tests, and instead just collects
test names. Fixtures are also bypassed, so running nosetests with the 
collection plugin enabled should be very quick.

This plugin is useful in combination with the testid plugin (``--with-id``).
Run both together to get an indexed list of all tests, which will enable you to
run individual tests by index number.

This plugin is also useful for counting tests in a test suite, and making
people watching your demo think all of your tests pass.
iÿÿÿÿ(   t   Plugin(   t   TestNt   CollectOnlyc           B   s5   e  Z d  Z d Z d Z d „  Z d „  Z d „  Z RS(   sB   
    Collect and output test names only, don't run any tests.
    s   collect-onlyt   collect_onlyc         C   s?   | j  d d d d |  j d | j d ƒ d d |  j ƒ  ƒd	 S(
   s&   Register commandline options.
        s   --collect-onlyt   actiont
   store_truet   destt   defaultt   NOSE_COLLECT_ONLYt   helps&   Enable collect-only: %s [COLLECT_ONLY]N(   t
   add_optiont	   enableOptt   getR	   (   t   selft   parsert   env(    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   options   s    	c         C   s#   t  j d ƒ t |  j ƒ | _ d S(   s8   Install collect-only suite class in TestLoader.
        s   Preparing test loaderN(   t   logt   debugt   TestSuiteFactoryt   conft
   suiteClass(   R   t   loader(    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   prepareTestLoader&   s    c            s9   t  j d ˆ ƒ t ˆ t ƒ s# d S‡  ‡ f d †  } | S(   s;   Replace actual test with dummy that always passes.
        s   Preparing test case %sNc            sd   ˆ  j  j j ˆ ƒ |  j ˆ ƒ ˆ  j  j j ˆ ƒ |  j ˆ ƒ ˆ  j  j j ˆ ƒ |  j ˆ ƒ d  S(   N(   R   t   pluginst	   startTestt
   addSuccesst   stopTest(   t   result(   R   t   test(    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   run4   s    (   R   R   t
   isinstanceR   (   R   R   R   (    (   R   R   s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   prepareTestCase-   s
    	(   t   __name__t
   __module__t   __doc__t   nameR   R   R   R    (    (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyR      s   	
	R   c           B   s#   e  Z d  Z d „  Z d d „ Z RS(   s7   
    Factory for producing configured test suites.
    c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   __init__D   s    c         K   s   t  | d |  j ƒS(   NR   (   t	   TestSuiteR   (   R   t   testst   kw(    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   __call__G   s    (    (   R!   R"   R#   R%   R)   (    (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyR   @   s   	R&   c           B   s&   e  Z d  Z d d d „ Z d „  Z RS(   s”   
    Basic test suite that bypasses most proxy and plugin calls, but does
    wrap tests in a nose.case.Test so prepareTestCase will be called.
    c         C   sH   | |  _  t | ƒ r! | ƒ  } n  t j d | ƒ t j j |  | ƒ d  S(   Ns   TestSuite(%r)(   R   t   callableR   R   t   unittestR&   R%   (   R   R'   R   (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyR%   P   s
    	c         C   sX   t  j d | ƒ t | t j ƒ r5 |  j j | ƒ n |  j j t | d |  j ƒƒ d  S(   Ns   Add test %st   config(	   R   R   R   R+   R&   t   _testst   appendR   R   (   R   R   (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   addTestX   s    (    N(   R!   R"   R#   t   NoneR%   R/   (    (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyR&   K   s   (    (   R#   t   nose.plugins.baseR    t	   nose.caseR   t   loggingR+   t	   getLoggerR!   R   R   R   R&   (    (    (    s3   lib/python2.7/site-packages/nose/plugins/collect.pyt   <module>   s   +