
v^                 @   sf   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d  d l m Z Gd d   d e  Z	 d S)    N)settings)BaseCommand)get_command_line_option)
get_runnerc                   sL   e  Z d  Z d Z d Z d Z   f d d   Z d d   Z d d	   Z   S)
CommandzIDiscover and run tests in the specified modules or the current directory.FNc                s&   t  | d  |  _ t   j |  d S)z
        Pre-parse the command line to extract the value of the --testrunner
        option. This allows a test runner to define additional command line
        arguments.
        z--testrunnerN)r   test_runnersuperrun_from_argv)selfargv)	__class__ F/tmp/pip-build-8lau8j11/django/django/core/management/commands/test.pyr	      s    zCommand.run_from_argvc          	   C   s   | j  d d d d d d d | j  d d	 d
 d d d d d | j  d d
 d d d | j  d d d t t |  j  } t | d  r | j |  d  S)NargsmetavarZ
test_labelnargs*helpz_Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_methodz	--noinputz
--no-inputactionstore_falsedestinteractivez:Tells Django to NOT prompt the user for input of any kind.z
--failfast
store_truezDTells Django to stop running the test suite after first failed test.z--testrunnerzhTells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.add_arguments)add_argumentr   r   r   hasattrr   )r
   parserZtest_runner_classr   r   r   r      s    zCommand.add_argumentsc             O   sE   t  t | d  } | |   } | j |  } | rA t j d  d  S)NZ
testrunner   )r   r   Z	run_testssysexit)r
   Ztest_labelsoptionsZ
TestRunnerr   Zfailuresr   r   r   handle1   s
    zCommand.handle)	__name__
__module____qualname__r   Zrequires_system_checksr   r	   r   r!   r   r   )r   r   r   	   s   	r   )
r   Zdjango.confr   Zdjango.core.management.baser   Zdjango.core.management.utilsr   Zdjango.test.utilsr   r   r   r   r   r   <module>   s
   