Ñò
5	³Lc           @   s½   d  Z  d d k Z d d k Z d d k Z d d k l Z l Z y d d k l Z Wn e	 j
 o d Z n Xe Z d Z d Z d Z d Z d	 Z d
 e f d     YZ e Z d   Z d S(   s   Unittest main programi˙˙˙˙N(   t   loadert   runner(   t   installHandlers)     -f, --failfast   Stop on first failure
s7     -c, --catch      Catch control-C and display results
s=     -b, --buffer     Buffer stdout and stderr during test runs
s  Usage: %(progName)s [options] [tests]

Options:
  -h, --help       Show this message
  -v, --verbose    Verbose output
  -q, --quiet      Minimal output
%(failfast)s%(catchbreak)s%(buffer)s
Examples:
  %(progName)s test_module                       - run tests from test_module
  %(progName)s test_module.TestClass             - run tests from
                                                   test_module.TestClass
  %(progName)s test_module.TestClass.test_method - run specified test method

[tests] can be a list of any number of test modules, classes and test
methods.

Alternative Usage: %(progName)s discover [options]

Options:
  -v, --verbose    Verbose output
%(failfast)s%(catchbreak)s%(buffer)s  -s directory     Directory to start discovery ('.' default)
  -p pattern       Pattern to match test files ('test*.py' default)
  -t directory     Top level directory of project (default to
                   start directory)

For test discovery all test modules must be importable from the top
level directory of the project.
s1  Usage: %(progName)s [options] [test] [...]

Options:
  -h, --help       Show this message
  -v, --verbose    Verbose output
  -q, --quiet      Minimal output
%(failfast)s%(catchbreak)s%(buffer)s
Examples:
  %(progName)s                               - run default set of tests
  %(progName)s MyTestSuite                   - run suite 'MyTestSuite'
  %(progName)s MyTestCase.testSomething      - run MyTestCase.testSomething
  %(progName)s MyTestCase                    - run all 'test*' test methods
                                               in MyTestCase
t   TestProgramc           B   s   e  Z d  Z e Z d	 Z Z Z Z	 d d	 d	 d	 e
 i e d d	 d	 d	 d 
 Z d	 d  Z d   Z d   Z e
 i d  Z d   Z RS(
   s   A command-line program that runs a set of tests; this is primarily
       for making test modules conveniently executable.
    t   __main__i   c         C   sġ   t  | t  oF t |  |  _ x= | i d  d D] } t |  i |  |  _ q3 Wn
 | |  _ | d  j o t i } n | |  _	 | |  _
 | |  _ |	 |  _ |
 |  _ | |  _ | |  _ | |  _ t i i | d  |  _ |  i |  |  i   d  S(   Nt   .i   i    (   t
   isinstancet
   basestringt
   __import__t   modulet   splitt   getattrt   Nonet   syst   argvt   exitt	   verbosityt   failfastt
   catchbreakt   buffert   defaultTestt
   testRunnert
   testLoadert   ost   patht   basenamet   progNamet	   parseArgst   runTests(   t   selfR	   R   R   R   R   R   R   R   R   R   t   part(    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyt   __init__K   s&     									c         C   sı   | o	 | GHn h |  i  d 6d d 6d d 6d d 6} |  i t j o t | d <n |  i t j o t d  j	 o t | d <n |  i t j o t	 | d <n |  i
 | GHt i d  d  S(   NR   t    R   R   R   i   (   R   R   t   Falset   FAILFASTR   R   R   t
   CATCHBREAKR   t   BUFFEROUTPUTt   USAGER   R   (   R   t   msgt   usage(    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyt	   usageExitd   s    	
c   	      C   s3  t  |  d j o- | d i   d j o |  i | d  d  Sd d  k } d d d d d	 d
 g } y£| i | d d |  \ } } xú | D]ò \ } } | d j o |  i   n | d j o d |  _ n | d j o d |  _ n | d j o! |  i d  j o t |  _ qn | d j o. |  i	 d  j o t
 d  j	 o t |  _	 qQn | d  j o! |  i d  j o t |  _ qq q Wt  |  d j o |  i d  j o d  |  _ nJ t  |  d j o' | |  _ t d j o d  |  _ qün |  i f |  _ |  i   Wn% | i j
 o } |  i |  n Xd  S(!   Ni   t   discoveri   i˙˙˙˙t   helpt   verboset   quietR   t   catchR   t   hHvqfcbs   -hs   -Hs   --helps   -qs   --quieti    s   -vs	   --verboses   -fs
   --failfasts   -cs   --catchs   -bs   --bufferR   (   s   -hs   -Hs   --help(   s   -qs   --quiet(   s   -vs	   --verbose(   s   -fs
   --failfast(   s   -cs   --catch(   s   -bs   --buffer(   t   lent   lowert   _do_discoveryt   getoptR(   R   R   R   t   TrueR   R   R   R   t	   testNamest   __name__R	   t   createTestst   error(	   R   R   R2   t	   long_optst   optionst   argst   optt   valueR&   (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyR   r   sD    * #	c         C   sN   |  i  d  j o |  i i |  i  |  _ n |  i i |  i  |  i  |  _ d  S(   N(   R4   R   R   t   loadTestsFromModuleR	   t   testt   loadTestsFromNames(   R   (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyR6      s    c         C   s­  d |  i  |  _  d d  k } | i   } |  i  | _ | i d d d d d t d d	 d
 d |  i t j o, | i d d d d d t d d d
 d n |  i t j o9 t d  j	 o, | i d d d d d t d d d
 d n |  i
 t j o, | i d d d d d t d d d
 d n | i d d d d d d d d | i d d d d d d  d d! | i d" d# d d$ d d  d d% | i |  \ } } t |  d& j o |  i   n x- t d( |  D] \ } } t | | |  qÉW|  i d  j o | i |  _ n |  i d  j o t d  j	 o | i |  _ n |  i
 d  j o | i
 |  _
 n | i o d' |  _ n | i }	 | i }
 | i } |   } | i |	 |
 |  |  _ d  S()   Ns   %s discoveri˙˙˙˙s   -vs	   --verboset   destR+   t   defaultR*   s   Verbose outputt   actiont
   store_trues   -fs
   --failfastR   s   Stop on first fail or errors   -cs   --catchR   s'   Catch ctrl-C and display results so fars   -bs   --bufferR   s%   Buffer stdout and stderr during testss   -ss   --start-directoryt   startR   s*   Directory to start discovery ('.' default)s   -ps	   --patternt   patterns   test*.pys+   Pattern to match tests ('test*.py' default)s   -ts   --top-level-directoryt   tops<   Top level directory of project (defaults to start directory)i   i   (   s   starts   patterns   top(   R   t   optparset   OptionParsert   progt
   add_optionR!   R   R   R   R   R   t
   parse_argsR/   R(   t   zipt   setattrR+   R   RD   RE   RF   R)   R>   (   R   R   t   LoaderRG   t   parserR9   R:   t   nameR<   t	   start_dirRE   t   top_level_dirR    (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyR1   £   sV     
				c      
   C   sé   |  i  o t   n |  i d  j o t i |  _ n t |  i t t i	 f  oQ y+ |  i d |  i
 d |  i d |  i  } WqĞ t j
 o |  i   } qĞ Xn
 |  i } | i |  i  |  _ |  i o t i |  i i    n d  S(   NR   R   R   (   R   R   R   R   R   t   TextTestRunnerR   t   typet   typest	   ClassTypeR   R   R   t	   TypeErrort   runR>   t   resultR   R   t   wasSuccessful(   R   R   (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyR   Ĝ   s    
		
N(   R5   t
   __module__t   __doc__t   USAGE_FROM_MODULER%   R   R   R   R   R   R    t   defaultTestLoaderR3   R   R(   R   R6   t
   TestLoaderR1   R   (    (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyR   B   s   		*	5c           C   s   t  t _ t d d   d  S(   NR	   (   t   USAGE_AS_MAINR   R%   t   mainR   (    (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyt   main_î   s    	(   R\   R   R   RU   t   django.utils.unittestR    R   t   django.utils.unittest.signalsR   t   ImportErrorR   R3   t
   __unittestR"   R#   R$   R`   R]   t   objectR   Ra   Rb   (    (    (    sD   /usr/local/lib/python2.6/dist-packages/django/utils/unittest/main.pyt   <module>   s"   Ş