Your IP : 18.119.118.237


Current Path : /opt/alt/python34/lib64/python3.4/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/unittest/__pycache__/runner.cpython-34.pyo

�
j f<�@s�dZddlZddlZddlZddlmZddlmZdZGdd�de	�Z
Gd	d
�d
ej�ZGdd�de	�Z
dS)
z
Running tests�N�)�result)�registerResultTc@s=eZdZdZdd�Zdd�Zddd�ZdS)	�_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodcCs
||_dS)N)�stream)�selfr�r�4/opt/alt/python34/lib64/python3.4/unittest/runner.py�__init__sz_WritelnDecorator.__init__cCs+|dkrt|��nt|j|�S)Nr�__getstate__)zstreamz__getstate__)�AttributeError�getattrr)r�attrrrr	�__getattr__sz_WritelnDecorator.__getattr__NcCs'|r|j|�n|jd�dS)N�
)�write)r�argrrr	�writelnsz_WritelnDecorator.writeln)�__name__�
__module__�__qualname__�__doc__r
rrrrrr	r
srcs�eZdZdZddZddZ�fdd�Zdd�Z�fd	d
�Z�fdd�Z	�fd
d�Z
�fdd�Z�fdd�Z�fdd�Z
�fdd�Zdd�Zdd�Z�S)�TextTestResultzhA test result class that can print formatted text results to a stream.

    Used by TextTestRunner.
    �=�F�-csPtt|�j|||�||_|dk|_|dk|_||_dS)Nr)�superrr
r�showAll�dots�descriptions)rrr�	verbosity)�	__class__rr	r
%s
	zTextTestResult.__init__cCsB|j�}|jr4|r4djt|�|f�St|�SdS)Nr)ZshortDescriptionr�join�str)r�testZdoc_first_linerrr	�getDescription,szTextTestResult.getDescriptioncs\tt|�j|�|jrX|jj|j|��|jjd�|jj�ndS)Nz ... )rr�	startTestrrrr%�flush)rr$)r!rr	r&3s
	zTextTestResult.startTestcs_tt|�j|�|jr2|jjd�n)|jr[|jjd�|jj�ndS)N�ok�.)	rr�
addSuccessrrrrrr')rr$)r!rr	r*:s		zTextTestResult.addSuccesscsbtt|�j||�|jr5|jjd�n)|jr^|jjd�|jj�ndS)N�ERROR�E)	rr�addErrorrrrrrr')rr$�err)r!rr	r-Bs		zTextTestResult.addErrorcsbtt|�j||�|jr5|jjd�n)|jr^|jjd�|jj�ndS)N�FAIL�F)	rr�
addFailurerrrrrr')rr$r.)r!rr	r1Js		zTextTestResult.addFailurecsktt|�j||�|jr>|jjdj|��n)|jrg|jjd�|jj	�ndS)Nz
skipped {0!r}�s)
rr�addSkiprrr�formatrrr')rr$�reason)r!rr	r3Rs		zTextTestResult.addSkipcsbtt|�j||�|jr5|jjd�n)|jr^|jjd�|jj�ndS)Nzexpected failure�x)	rr�addExpectedFailurerrrrrr')rr$r.)r!rr	r7Zs		z!TextTestResult.addExpectedFailurecs_tt|�j|�|jr2|jjd�n)|jr[|jjd�|jj�ndS)Nzunexpected success�u)	rr�addUnexpectedSuccessrrrrrr')rr$)r!rr	r9bs		z#TextTestResult.addUnexpectedSuccesscCsL|js|jr"|jj�n|jd|j�|jd|j�dS)Nr+r/)rrrr�printErrorList�errors�failures)rrrr	�printErrorsjszTextTestResult.printErrorscCsxxq|D]i\}}|jj|j�|jjd||j|�f�|jj|j�|jjd|�qWdS)Nz%s: %sz%s)rr�
separator1r%�
separator2)rZflavourr;r$r.rrr	r:ps
#zTextTestResult.printErrorList)rrrrr>r?r
r%r&r*r-r1r3r7r9r=r:rr)r!r	rs

rc	@sUeZdZdZeZddddddddd�Zdd	�Zd
d�ZdS)�TextTestRunnerz�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.
    NTrFcCsp|dkrtj}nt|�|_||_||_||_||_||_|dk	rl||_	ndS)N)
�sys�stderrrrrr �failfast�buffer�warnings�resultclass)rrrr rCrDrFrErrr	r
�s					zTextTestRunner.__init__cCs|j|j|j|j�S)N)rFrrr )rrrr	�_makeResult�szTextTestRunner._makeResultcCs�|j�}t|�|j|_|j|_tj���|jr�tj|j�|jdkr�tjddtdd�q�nt	j	�}t
|dd�}|dk	r�|�nz||�Wdt
|d	d�}|dk	r�|�nXt	j	�}WdQX||}|j�t|d
�r;|j
j|j�n|j}|j
jd||dkred
phd|f�|j
j�d}	}
}y%tt|j|j|jf�}Wntk
r�YnX|\}	}
}g}
|j�sO|j
jd�t|j�t|j�}}|r2|
jd|�n|r_|
jd|�q_n|j
jd�|ry|
jd|�n|	r�|
jd|	�n|
r�|
jd|
�n|
r�|j
jddj|
�f�n|j
jd�|S)z&Run the given test case or test suite.�default�always�module�category�messagezPlease use assert\w+ instead.�startTestRunN�stopTestRunr?zRan %d test%s in %.3fsrr2�rZFAILEDzfailures=%dz	errors=%dZOKz
skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r)zdefaultzalways)rGrrCrDrE�catch_warnings�simplefilter�filterwarnings�DeprecationWarning�timer
r=�hasattrrrr?ZtestsRun�map�lenZexpectedFailures�unexpectedSuccesses�skippedrZ
wasSuccessfulrr<r;�appendr")rr$rZ	startTimerMrNZstopTimeZ	timeTaken�runZ
expectedFailsrXrYZresultsZinfosZfailedZerroredrrr	r[�sp

	



	#

#zTextTestRunner.run)	rrrrrrFr
rGr[rrrr	r@xs	r@)rrArTrErOrZsignalsrZ
__unittest�objectrZ
TestResultrr@rrrr	�<module>s[

?>