ó
è¾bc           @   s   d  Z  d d l Z d d l Z d d l m Z d d l m Z e Z d e	 f d „  ƒ  YZ
 d e j f d	 „  ƒ  YZ d
 e	 f d „  ƒ  YZ d S(   s   Running testsiÿÿÿÿNi   (   t   result(   t   registerResultt   _WritelnDecoratorc           B   s,   e  Z d  Z d „  Z d „  Z d d „ Z RS(   s@   Used to decorate file-like objects with a handy 'writeln' methodc         C   s   | |  _  d  S(   N(   t   stream(   t   selfR   (    (    s%   /usr/lib/python2.7/unittest/runner.pyt   __init__   s    c         C   s+   | d k r t  | ƒ ‚ n  t |  j | ƒ S(   NR   t   __getstate__(   R   R   (   t   AttributeErrort   getattrR   (   R   t   attr(    (    s%   /usr/lib/python2.7/unittest/runner.pyt   __getattr__   s    c         C   s'   | r |  j  | ƒ n  |  j  d ƒ d  S(   Ns   
(   t   write(   R   t   arg(    (    s%   /usr/lib/python2.7/unittest/runner.pyt   writeln   s    N(   t   __name__t
   __module__t   __doc__R   R
   t   NoneR   (    (    (    s%   /usr/lib/python2.7/unittest/runner.pyR      s   		t   TextTestResultc           B   s…   e  Z d  Z d d Z d d Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   sh   A test result class that can print formatted text results to a stream.

    Used by TextTestRunner.
    t   =iF   t   -c         C   sP   t  t |  ƒ j | | | ƒ | |  _ | d k |  _ | d k |  _ | |  _ d  S(   Ni   (   t   superR   R   R   t   showAllt   dotst   descriptions(   R   R   R   t	   verbosity(    (    s%   /usr/lib/python2.7/unittest/runner.pyR   $   s
    	c         C   sB   | j  ƒ  } |  j r4 | r4 d j t | ƒ | f ƒ St | ƒ Sd  S(   Ns   
(   t   shortDescriptionR   t   joint   str(   R   t   testt   doc_first_line(    (    s%   /usr/lib/python2.7/unittest/runner.pyt   getDescription+   s    c         C   s\   t  t |  ƒ j | ƒ |  j rX |  j j |  j | ƒ ƒ |  j j d ƒ |  j j ƒ  n  d  S(   Ns    ... (   R   R   t	   startTestR   R   R   R   t   flush(   R   R   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR    2   s
    	c         C   s_   t  t |  ƒ j | ƒ |  j r2 |  j j d ƒ n) |  j r[ |  j j d ƒ |  j j ƒ  n  d  S(   Nt   okt   .(	   R   R   t
   addSuccessR   R   R   R   R   R!   (   R   R   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR$   9   s    		c         C   sb   t  t |  ƒ j | | ƒ |  j r5 |  j j d ƒ n) |  j r^ |  j j d ƒ |  j j ƒ  n  d  S(   Nt   ERRORt   E(	   R   R   t   addErrorR   R   R   R   R   R!   (   R   R   t   err(    (    s%   /usr/lib/python2.7/unittest/runner.pyR'   A   s    		c         C   sb   t  t |  ƒ j | | ƒ |  j r5 |  j j d ƒ n) |  j r^ |  j j d ƒ |  j j ƒ  n  d  S(   Nt   FAILt   F(	   R   R   t
   addFailureR   R   R   R   R   R!   (   R   R   R(   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR+   I   s    		c         C   sk   t  t |  ƒ j | | ƒ |  j r> |  j j d j | ƒ ƒ n) |  j rg |  j j d ƒ |  j j	 ƒ  n  d  S(   Ns   skipped {0!r}t   s(
   R   R   t   addSkipR   R   R   t   formatR   R   R!   (   R   R   t   reason(    (    s%   /usr/lib/python2.7/unittest/runner.pyR-   Q   s    		c         C   sb   t  t |  ƒ j | | ƒ |  j r5 |  j j d ƒ n) |  j r^ |  j j d ƒ |  j j ƒ  n  d  S(   Ns   expected failuret   x(	   R   R   t   addExpectedFailureR   R   R   R   R   R!   (   R   R   R(   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR1   Y   s    		c         C   s_   t  t |  ƒ j | ƒ |  j r2 |  j j d ƒ n) |  j r[ |  j j d ƒ |  j j ƒ  n  d  S(   Ns   unexpected successt   u(	   R   R   t   addUnexpectedSuccessR   R   R   R   R   R!   (   R   R   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR3   a   s    		c         C   sL   |  j  s |  j r" |  j j ƒ  n  |  j d |  j ƒ |  j d |  j ƒ d  S(   NR%   R)   (   R   R   R   R   t   printErrorListt   errorst   failures(   R   (    (    s%   /usr/lib/python2.7/unittest/runner.pyt   printErrorsi   s    c         C   sx   xq | D]i \ } } |  j  j |  j ƒ |  j  j d | |  j | ƒ f ƒ |  j  j |  j ƒ |  j  j d | ƒ q Wd  S(   Ns   %s: %ss   %s(   R   R   t
   separator1R   t
   separator2(   R   t   flavourR5   R   R(   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR4   o   s
    #(   R   R   R   R8   R9   R   R   R    R$   R'   R+   R-   R1   R3   R7   R4   (    (    (    s%   /usr/lib/python2.7/unittest/runner.pyR      s   

										t   TextTestRunnerc           B   sD   e  Z d  Z e Z e j e d e e d d „ Z
 d „  Z d „  Z RS(   sÉ   A test runner class that displays results in textual form.

    It prints out the names of tests as they are run, errors as they
    occur, and a summary of the results at the end of the test run.
    i   c         C   sO   t  | ƒ |  _ | |  _ | |  _ | |  _ | |  _ | d  k	 rK | |  _ n  d  S(   N(   R   R   R   R   t   failfastt   bufferR   t   resultclass(   R   R   R   R   R<   R=   R>   (    (    s%   /usr/lib/python2.7/unittest/runner.pyR      s    				c         C   s   |  j  |  j |  j |  j ƒ S(   N(   R>   R   R   R   (   R   (    (    s%   /usr/lib/python2.7/unittest/runner.pyt   _makeResult‰   s    c         C   s‘  |  j  ƒ  } t | ƒ |  j | _ |  j | _ t j ƒ  } t | d d ƒ } | d k	 rb | ƒ  n  z | | ƒ Wd t | d d ƒ } | d k	 r› | ƒ  n  Xt j ƒ  } | | } | j ƒ  t | d ƒ rá |  j	 j
 | j ƒ n  | j } |  j	 j
 d | | d k rd pd | f ƒ |  j	 j
 ƒ  d	 }	 }
 } y% t t | j | j | j f ƒ } Wn t k
 rln X| \ }	 }
 } g  } | j ƒ  sö|  j	 j d
 ƒ t t | j | j f ƒ \ } } | rÙ| j d | ƒ n  | r| j d | ƒ qn |  j	 j d ƒ | r | j d | ƒ n  |	 r:| j d |	 ƒ n  |
 rT| j d |
 ƒ n  | r}|  j	 j
 d d j | ƒ f ƒ n |  j	 j d ƒ | S(   s&   Run the given test case or test suite.t   startTestRunNt   stopTestRunR9   s   Ran %d test%s in %.3fsi   R,   t    i    t   FAILEDs   failures=%ds	   errors=%dt   OKs
   skipped=%ds   expected failures=%ds   unexpected successes=%ds    (%s)s   , s   
(   R?   R   R<   R=   t   timeR   R   R7   t   hasattrR   R   R9   t   testsRunt   mapt   lent   expectedFailurest   unexpectedSuccessest   skippedR   t   wasSuccessfulR   R6   R5   t   appendR   (   R   R   R    t	   startTimeR@   RA   t   stopTimet	   timeTakent   runt   expectedFailsRK   RL   t   resultst   infost   failedt   errored(    (    s%   /usr/lib/python2.7/unittest/runner.pyRR   Œ   sb    



	#!#N(   R   R   R   R   R>   t   syst   stderrt   Truet   FalseR   R   R?   RR   (    (    (    s%   /usr/lib/python2.7/unittest/runner.pyR;   w   s   		(   R   RX   RE   RB   R    t   signalsR   RZ   t
   __unittestt   objectR   t
   TestResultR   R;   (    (    (    s%   /usr/lib/python2.7/unittest/runner.pyt   <module>   s   [