�9�c@s�dZddlZyddlmZWn!ek
rIddlmZnXddlmZddlm Z m
Zejd�Z
d�Zdefd ��YZd
�Z
dS(s�
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.
i�N(t_TextTestResult(tConfig(tisclasstlnsnose.resultcCs*yt|�SWndt|�jSXdS(Ns<unprintable %s object>(tstrttypet__name__(texc((s//sys/lib/python2.7/site-packages/nose/result.pyt_exception_detailstTextTestResultcBsteZdZddd�Zd�Zd�Zd�Zdd�Zd�Z d�Z
d�Zd �Zdd
�Z
RS(s�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.
cCsY|dkri}n||_|dkr6t�}n||_tj||||�dS(N(tNoneterrorClassesRtconfigRt__init__(tselftstreamtdescriptionst verbosityRR((s//sys/lib/python2.7/site-packages/nose/result.pyR
$s cCshddlm}||jkrd|j|\}}}|j||f�|j|||df�ndS(Ni�(tSkipTest(tnose.plugins.skipRRtappendt
printLabelR
(RttesttreasonRtstoragetlabeltisfail((s//sys/lib/python2.7/site-packages/nose/result.pytaddSkip.s
cCs�|\}}}y|j||�}Wn tk
rG|j|�}nXxz|jj�D]i\}\}} }
t|�rXt||�rX|
r�t|_n|j||f�|j | |�dSqXW|j
j||f�t|_|j d�dS(s�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.
NtERROR(t_exc_info_to_stringt TypeErrorRtitemsRt
issubclasstFalsetpassedRRterrors(RRterrtectevttbtexc_infotclsRRR((s//sys/lib/python2.7/site-packages/nose/result.pytaddError6s
% cCs-|jr|j�pt|�St|�SdS(N(RtshortDescriptionR(RR((s//sys/lib/python2.7/site-packages/nose/result.pytgetDescriptionPs cCs�t|dd�}|dk r�|jrx|g}|r_t|d�}|r_|j|�q_n|jdj|��q�|jr�|j|d �q�ndS(NRis: ( tgetattrR
tshowAllRRtwritelntjointdotstwrite(RRR$Rtmessagetdetail((s//sys/lib/python2.7/site-packages/nose/result.pyRVs cCs�tj|�xF|jj�D]5}|j|\}}}|r|j||�qqWt|d�r~|jjj|j �ndS(s<Overrides to print all errorClasses errors as well.
RN(
RtprintErrorsRtkeystprintErrorListthasattrRtpluginstreportR(RR)RRR((s//sys/lib/python2.7/site-packages/nose/result.pyR5ds
c Cs�|jj}|jj}t||�}|j}|dkrCdpFd}||j�|d|||f�|�i}|jj�} xF| D]>}
|j|
\}}}
t|�}|s�q�n|||<q�Wt|j �r�|j �|d<nt|j
�rt|j
�|d<n|j�s5|d�n
|d�|j�}|r�|j
�|d �|d
jg|D]\}}d||f^qu��|d�n|�d
S(sZCalled by the test runner to print the final summary of test
run results.
itstsRan %s test%s in %.3fstfailuresR#tFAILEDtOKs (s, s%s=%st)N(RR2R/tfloatttestsRunt
separator2RR6tlenR=R#t
wasSuccessfulRtsortR0(RtstarttstopR2R/ttakentruntpluraltsummaryteckeysR)RRRtcountR((s//sys/lib/python2.7/site-packages/nose/result.pytprintSummaryps>
*
cCs`|js|jrtSxC|jj�D]2}|j|\}}}|sNq&n|r&tSq&WtS(s�Overrides to check that there are no errors in errorClasses
lists that are marked as errors and should cause a run to
fail.
(R#R=R!RR6tTrue(RR)RRR((s//sys/lib/python2.7/site-packages/nose/result.pyRE�scCs�y|j||�}Wn tk
r8|j|�}nX|jj||f�|jrk|jjd�n|jr�|jjd�ndS(NRtE(RRR#RR.RR2R1(RRR$R(((s//sys/lib/python2.7/site-packages/nose/result.pyt _addError�s
cCsmddlm}t|d|�r1t|d�Sytj|||�SWntk
rhtj||�SXdS(Ni�(Rii(RRR RRRR(RR$RR((s//sys/lib/python2.7/site-packages/nose/result.pyR�s
N(Rt
__module__t__doc__R
R
RR*R,RR5RORERRR(((s//sys/lib/python2.7/site-packages/nose/result.pyR s ) cOs*ddlm}|dt�t||�S(Ni�(twarns�ln() has moved to nose.util from nose.result and will be removed from nose.result in a future release. Please update your imports (twarningsRUtDeprecationWarningt_ln(targtkwRU((s//sys/lib/python2.7/site-packages/nose/result.pyR�s(RTtloggingtunittest.runnerRtImportErrortunittesttnose.configRt nose.utilRRRXt getLoggertlogRR (((s//sys/lib/python2.7/site-packages/nose/result.pyt<module> s
|