Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/nose/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/nose/__pycache__/result.cpython-35.pyc



�^�]U�@s�dZddlZyddlmZWn"ek
rJddlmZYnXddlmZddlm	Z	m
Zejd�Z
dd�ZGd	d
�d
e�Zdd�Z
dS)
z�
Test Result
-----------

Provides a TextTestResult that extends unittest's _TextTestResult to
provide support for error classes (such as the builtin skip and
deprecated classes), and hooks for plugins to take over or extend
reporting.
�N)�_TextTestResult)�Config)�isclass�lnznose.resultc	Cs.yt|�SWndt|�jSYnXdS)Nz<unprintable %s object>)�str�type�__name__)�exc�r
�</opt/alt/python35/lib/python3.5/site-packages/nose/result.py�_exception_detailsrc@s�eZdZdZdddd�Zdd�Zdd�Zd	d
�Zddd�Zd
d�Z	dd�Z
dd�Zdd�Zddd�Z
dS)�TextTestResultz�Text test result that extends unittest's default test result
    support for a configurable set of errorClasses (eg, Skip,
    Deprecated, TODO) that extend the errors/failures/success triad.
    NcCsS|dkri}||_|dkr0t�}||_tj||||�dS)N)�errorClassesr�configr�__init__)�self�stream�descriptions�	verbosityrrr
r
rr$s			zTextTestResult.__init__cCseddlm}||jkra|j|\}}}|j||f�|j|||df�dS)Nr)�SkipTest)�nose.plugins.skiprr�append�
printLabel)r�test�reasonr�storage�label�isfailr
r
r�addSkip.s
zTextTestResult.addSkipcCs�|\}}}y|j||�}Wn!tk
rH|j|�}YnXx}t|jj��D]f\}\}}	}
t|�r_t||�r_|
r�d|_|j||f�|j	|	|�dSq_W|j
j||f�d|_|j	d�dS)z�Overrides normal addError to add support for
        errorClasses. If the exception is a registered class, the
        error will be added to the list for that class, not errors.
        FN�ERROR)�_exc_info_to_string�	TypeError�listr�itemsr�
issubclassZpassedrr�errors)rr�errZecZev�tb�exc_info�clsrrrr
r
r�addError6s
+		zTextTestResult.addErrorcCs-|jr|j�pt|�St|�SdS)N)r�shortDescriptionr)rrr
r
r�getDescriptionPs	zTextTestResult.getDescriptioncCs�t|dd�}|dk	r�|jrr|g}|rYt|d�}|rY|j|�|jdj|��n |jr�|j|dd��dS)Nr�z: )�getattr�showAllrr�writeln�join�dots�write)rrr&r�messageZdetailr
r
rrVs		
	zTextTestResult.printLabelcCs�tj|�xIt|jj��D]2}|j|\}}}|r#|j||�q#Wt|d�r~|jjj	|j
�dS)z<Overrides to print all errorClasses errors as well.
        rN)r�printErrorsr"r�keys�printErrorList�hasattrrZplugins�reportr)rr)rrrr
r
rr5ds
zTextTestResult.printErrorscCs�|jj}|jj}t||�}|j}|dkrCdpFd}||j�|d|||f�|�i}t|jj��}	xC|	D];}
|j|
\}}}
t	|�}|s�q�|||<q�Wt	|j
�r�t	|j
�|d<t	|j�rt	|j�|d<|j�s2|d�n
|d�t|j
��}|r�|j�|d	�|d
jdd�|D���|d
�n|�dS)zZCalled by the test runner to print the final summary of test
        run results.
        r-�s�zRan %s test%s in %.3fs�failuresr%�FAILED�OKz (z, cSs&g|]\}}d||f�qS)z%s=%sr
)�.0r�countr
r
r�
<listcomp>�s	z/TextTestResult.printSummary.<locals>.<listcomp>�)N)rr3r0�float�testsRun�
separator2r"rr6�lenr<r%�
wasSuccessfulr#�sortr1)r�start�stopr3r0Ztaken�run�plural�summaryZeckeysr)rrrr@r#r
r
r�printSummaryps>	






zTextTestResult.printSummarycCsc|js|jrdSxFt|jj��D]/}|j|\}}}|sQq,|r,dSq,WdS)z�Overrides to check that there are no errors in errorClasses
        lists that are marked as errors and should cause a run to
        fail.
        FT)r%r<r"rr6)rr)rrrr
r
rrG�szTextTestResult.wasSuccessfulcCs�y|j||�}Wn!tk
r9|j|�}YnX|jj||f�|jrl|jjd�n|jr�|jjd�dS)Nr�E)r r!r%rr/rr3r2)rrr&r(r
r
r�	_addError�s
		zTextTestResult._addErrorcCs�ddlm}t|d�rAt|d|�rAt|d�Sytj|||�SWn"tk
r|tj||�SYnXdS)Nr)rr-)rrrr$rrr r!)rr&rrr
r
rr �s#
z"TextTestResult._exc_info_to_string)r�
__module__�__qualname__�__doc__rrr*r,rr5rNrGrPr r
r
r
rr
s	)r
cOs*ddlm}|dt�t||�S)Nr)�warnz�ln() has moved to nose.util from nose.result and will be removed from nose.result in a future release. Please update your imports )�warningsrT�DeprecationWarning�_ln)�arg�kwrTr
r
rr�sr)rS�loggingZunittest.runnerr�ImportError�unittestZnose.configrZ	nose.utilrrrW�	getLogger�logrr
r
r
r
r�<module>	s
�