a
    ñ»j¸
  ã                   @   sr   d Z ddlmZ ddlmZ ddlZddlZddlZe e	¡Z
G dd„ deƒZG dd„ dƒZG d	d
„ d
ejƒZdS )a  This plugin bypasses the actual execution of tests, and instead just
collects test names. Fixtures are also bypassed.
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.é    )ÚPlugin)ÚTestNc                   @   s0   e Zd ZdZdZdZdd„ Zdd„ Zdd	„ Zd
S )ÚCollectOnlyz8Collect and output test names only, don't run any tests.zcollect-onlyZcollect_onlyc              	   C   s*   |j ddd| j| d¡d|  ¡  d� dS )zRegister commandline options.z--collect-onlyz--coÚ
store_trueZNOSE_COLLECT_ONLYz&Enable collect-only: %s [COLLECT_ONLY])ÚactionÚdestÚdefaultÚhelpN)Ú
add_optionÚ	enableOptÚgetr	   )ÚselfÚparserÚenv© r   ú:E:\soccer\ml_env\Lib\site-packages\nose/plugins/collect.pyÚoptions   s
    
ýzCollectOnly.optionsc                 C   s   t  d¡ t| jƒ|_dS )z/Install collect-only suite class in TestLoader.zPreparing test loaderN)ÚlogÚdebugÚTestSuiteFactoryÚconfZ
suiteClass)r   Úloaderr   r   r   ÚprepareTestLoader   s    
zCollectOnly.prepareTestLoaderc                    s,   t  dˆ¡ tˆtƒsdS ‡ ‡fdd„}|S )z2Replace actual test with dummy that always passes.zPreparing test case %sNc                    sL   ˆ j j ˆ¡ |  ˆ¡ ˆ j j ˆ¡ |  ˆ¡ ˆ j j ˆ¡ |  ˆ¡ d S ©N)r   ÚpluginsZ	startTestZ
addSuccessZstopTest)Úresult©r   Útestr   r   Úrun*   s    

z(CollectOnly.prepareTestCase.<locals>.run)r   r   Ú
isinstancer   )r   r   r   r   r   r   ÚprepareTestCase$   s
    
zCollectOnly.prepareTestCaseN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Únamer   r   r   r    r   r   r   r   r      s   r   c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )	r   z-Factory for producing configured test suites.c                 C   s
   || _ d S r   ©r   )r   r   r   r   r   Ú__init__6   s    zTestSuiteFactory.__init__r   c                 K   s   t || jd�S )Nr&   )Ú	TestSuiter   )r   ÚtestsÚkwr   r   r   Ú__call__9   s    zTestSuiteFactory.__call__N)r   )r!   r"   r#   r$   r'   r+   r   r   r   r   r   4   s   r   c                   @   s"   e Zd ZdZddd„Zdd„ ZdS )	r(   zŠBasic test suite that bypasses most proxy and plugin calls, but does
    wrap tests in a nose.case.Test so prepareTestCase will be called.r   Nc                 C   s8   || _ t|tjjƒr|ƒ }t d|¡ tj 	| |¡ d S )NzTestSuite(%r))
r   r   ÚcollectionsÚabcÚCallabler   r   Úunittestr(   r'   )r   r)   r   r   r   r   r'   @   s
    zTestSuite.__init__c                 C   s@   t  d|¡ t|tjƒr&| j |¡ n| j t|| jd�¡ d S )NzAdd test %s)Úconfig)	r   r   r   r/   r(   Z_testsÚappendr   r   r   r   r   r   ÚaddTestG   s    zTestSuite.addTest)r   N)r!   r"   r#   r$   r'   r2   r   r   r   r   r(   =   s   
r(   )r$   Znose.plugins.baser   Z	nose.caser   Úloggingr/   r,   Ú	getLoggerr!   r   r   r   r(   r   r   r   r   Ú<module>   s   
"	