ó
þSQc           @   s„   d  d l  Z  d  d l Z d  d l Z d  d l m Z m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d e	 f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   make_optiont   OptionParser(   t   settings(   t   BaseCommand(   t
   get_runnert   Commandc           B   sÒ   e  Z e j e d  d d d d d e d d ƒe d d d	 d d
 d e d d ƒe d d d d d d d ƒe d d d d d d d d d ƒf Z d Z d Z	 e Z
 d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s	   --noinputt   actiont   store_falset   destt   interactivet   defaultt   helps:   Tells Django to NOT prompt the user for input of any kind.s
   --failfastt
   store_truet   failfastsD   Tells Django to stop running the test suite after first failed test.s   --testrunnert   storet
   testrunnersh   Tells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.s   --liveservert
   liveservers   Overrides the default address where the live server (used with LiveServerTestCase) is expected to run from. The default value is localhost:8081.s`   Runs the test suite for the specified applications, or the entire site if no apps are specified.s   [appname ...]c         C   s    d  |  _ t t |  ƒ j ƒ  d  S(   N(   t   Nonet   test_runnert   superR   t   __init__(   t   self(    (    s=   ../Django//lib/python/django/core/management/commands/test.pyR   $   s    	c         C   s[   d } x8 | d D], } | j  | ƒ r | t | ƒ |  _ Pq q Wt t |  ƒ j | ƒ d S(   s´   
        Pre-parse the command line to extract the value of the --testrunner
        option. This allows a test runner to define additional command line
        arguments.
        s   --testrunner=i   N(   t
   startswitht   lenR   R   R   t   run_from_argv(   R   t   argvt   optiont   arg(    (    s=   ../Django//lib/python/django/core/management/commands/test.pyR   (   s    c      	   C   sY   t  t |  j ƒ } |  j t | d d ƒ } t d | d |  j | ƒ d |  j ƒ  d | ƒ S(   Nt   option_listt   progt   usaget   version(    (   R   R   R   R   t   getattrR   R   t   get_version(   R   t	   prog_namet
   subcommandt   test_runner_classt   options(    (    s=   ../Django//lib/python/django/core/management/commands/test.pyt   create_parser5   s    	c         O   s„   t  | d ƒ d k rA t j d ƒ } t j ƒ  } | j | ƒ n  t t |  ƒ j | | Ž  t  | d ƒ d k r€ | j | ƒ n  d  S(   Nt	   verbosityi    s   py.warnings(	   t   intt   loggingt	   getLoggert   StreamHandlert
   addHandlerR   R   t   executet   removeHandler(   R   t   argsR%   t   loggert   handler(    (    s=   ../Django//lib/python/django/core/management/commands/test.pyR-   >   s    c         O   s¼   d d l  m } d d l m } | | | j d ƒ ƒ } t | j d ƒ ƒ | d <| j d ƒ d  k	 r | d t j d <| d =n  | |   } | j	 | ƒ } | r¸ t
 j t | ƒ ƒ n  d  S(   Niÿÿÿÿ(   R   (   R   R   R'   R   t   DJANGO_LIVE_TEST_SERVER_ADDRESS(   t   django.confR   t   django.test.utilsR   t   getR(   R   t   ost   environt	   run_testst   syst   exitt   bool(   R   t   test_labelsR%   R   R   t
   TestRunnerR   t   failures(    (    s=   ../Django//lib/python/django/core/management/commands/test.pyt   handleM   s    
N(   t   __name__t
   __module__R   R   R    t   Truet   FalseR   R   R/   t   requires_model_validationR   R   R&   R-   R?   (    (    (    s=   ../Django//lib/python/django/core/management/commands/test.pyR      s*   									(   R)   R9   R6   t   optparseR    R   R3   R   t   django.core.management.baseR   R4   R   R   (    (    (    s=   ../Django//lib/python/django/core/management/commands/test.pyt   <module>   s   