
 X
                 @   sb   d  d l  Z  d  d l 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_runnerc                   sX   e  Z d  Z d Z d Z   f d 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.Fc                s    d  |  _  t t |   j   d  S)N)test_runnersuperr   __init__)self)	__class__ R/home/ubuntu/projects/ifolica/build/django/django/core/management/commands/test.pyr      s    	zCommand.__init__c                sg   d } xD | d d  D]2 } | j  |  r | t |  d  |  _ Pq q Wt 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--testrunner=   N)
startswithlenr   r   r   run_from_argv)r	   argvoptionarg)r
   r   r   r      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 d d | j  d d
 d d d d d d d | j  d d
 d d d d d | j  d d
 d d d d d  d d t t |  j  } t | d  r | j |  n  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interactivedefaultTz:Tells Django to NOT prompt the user for input of any kind.z
--failfast
store_trueZfailfastFzDTells Django to stop running the test suite after first failed test.z--testrunnerstore
testrunnerzhTells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.z--liveserver
liveserverzOverrides the default address where the live server (used with LiveServerTestCase) is expected to run from. The default value is localhost:8081-8179.add_arguments)add_argumentr   r   r   hasattrr"   )r	   parserZtest_runner_classr   r   r   r"      s$    zCommand.add_argumentsc             O   s   d d l  m } d d l m } | | | d  } | d d  k	 rW | d t j d <n  | d =| |   } | j |  } | r t j t	 |   n  d  S)Nr   )r   )r   r    r!   ZDJANGO_LIVE_TEST_SERVER_ADDRESS)
django.confr   django.test.utilsr   osenvironZ	run_testssysexitbool)r	   Ztest_labelsoptionsr   r   Z
TestRunnerr   Zfailuresr   r   r   handle=   s    zCommand.handle)	__name__
__module____qualname__r   Zrequires_system_checksr   r   r"   r.   r   r   )r
   r   r   	   s   r   )	r(   r*   r&   r   Zdjango.core.management.baser   r'   r   r   r   r   r   r   <module>   s
   