B t `Uã@sˆdZddlZyddlmZWn ek r<ddlmZYnXddlmZddlm Z m Z e  d¡Z dd„ZGd d „d eƒZd d „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Úlnz nose.resultcCs"yt|ƒSdt|ƒjSdS)Nz)ÚstrÚtypeÚ__name__)Úexc©r ú//tmp/pip-unpacked-wheel-cjhnoqsi/nose/result.pyÚ_exception_detailsr c@sfeZdZdZddd„Zdd„Zdd„Zd d „Zdd d „Zd d„Z dd„Z dd„Z dd„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. NcCs:|dkr i}||_|dkr tƒ}||_t ||||¡dS)N)Ú errorClassesrÚconfigrÚ__init__)ÚselfÚstreamÚ descriptionsÚ verbosityrrr r r r$szTextTestResult.__init__cCsJddlm}||jkrF|j|\}}}| ||f¡| |||df¡dS)Nr)ÚSkipTest)Únose.plugins.skiprrÚappendÚ printLabel)rÚtestÚreasonrÚstorageÚlabelÚisfailr r r ÚaddSkip.s   zTextTestResult.addSkipc Csº|\}}}y| ||¡}Wntk r8| |¡}YnXxZt|j ¡ƒD]H\}\}} } t|ƒrJt||ƒrJ| rtd|_| ||f¡|  | |¡dSqJW|j  ||f¡d|_|  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| ¡pt|ƒSt|ƒSdS)N)rZshortDescriptionr)rrr r r ÚgetDescriptionPszTextTestResult.getDescriptioncCslt|ddƒ}|dk rh|jrP|g}|r>t|dƒ}|r>| |¡| d |¡¡n|jrh| |dd…¡dS)Nréz: )ÚgetattrÚshowAllr rÚwritelnÚjoinÚdotsÚwrite)rrr&rÚmessageZdetailr r r rVs   zTextTestResult.printLabelcCs`t |¡x6t|j ¡ƒD]$}|j|\}}}|r| ||¡qWt|dƒr\|jj  |j ¡dS)z“sz/TextTestResult.printSummary..ú)N)rr2r/ÚfloatZtestsRunZ separator2r"rr5Úlenr:r%Ú wasSuccessfulr#Úsortr0)rÚstartÚstopr2r/ZtakenÚrunÚpluralÚsummaryZeckeysr)rrrr=r#r r r Ú printSummaryps>           zTextTestResult.printSummarycCsJ|js |jrdSx4t|j ¡ƒD]"}|j|\}}}|s:q |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"rr5)rr)rrrr r r rB™s zTextTestResult.wasSuccessfulcCsjy| ||¡}Wntk r.| |¡}YnX|j ||f¡|jrT|j d¡n|jrf|j d¡dS)NrÚE)r r!r%rr.rr2r1)rrr&r(r r r Ú _addError¨szTextTestResult._addErrorcCsbddlm}t|dƒr2t|d|ƒr2t|dƒSyt |||¡Stk r\t ||¡SXdS)Nr)rr,)rrrr$rrr r!)rr&rrr r r r ´s  z"TextTestResult._exc_info_to_string)NN)N)N)rÚ __module__Ú __qualname__Ú__doc__rrr*r+rr4rIrBrKr r r r r r 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 )ÚwarningsrOÚDeprecationWarningÚ_ln)ÚargÚkwrOr r r rÁs r)rNÚloggingZunittest.runnerrÚ ImportErrorZunittestZ nose.configrZ nose.utilrrrRÚ getLoggerÚlogr r r r r r Ú s  #