B _U@sdZddlZyddlmZWn ek r<ddlmZYnXddlmZddlm Z m Z e dZ ddZGd d d eZd 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)isclasslnz nose.resultcCs"yt|Sdt|jSdS)Nz)strtype__name__)excr //tmp/pip-unpacked-wheel-8n4943v7/nose/result.py_exception_detailsr c@sfeZdZdZdddZddZddZd d Zdd d Zd dZ ddZ ddZ ddZ dddZ dS)TextTestResultzText 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) errorClassesrconfigr__init__)selfstream descriptions verbosityrrr r r r$szTextTestResult.__init__cCsJddlm}||jkrF|j|\}}}|||f||||dfdS)Nr)SkipTest)nose.plugins.skiprrappend printLabel)rtestreasonrstoragelabelisfailr r r addSkip.s   zTextTestResult.addSkipc Cs|\}}}y|||}Wntk r8||}YnXxZt|jD]H\}\}} } t|rJt||rJ| rtd|_|||f| | |dSqJW|j ||fd|_| ddS)zOverrides 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. FNERROR) _exc_info_to_string TypeErrorlistritemsr issubclassZpassedrrerrors) rrerrZecZevtbexc_infoclsrrrr 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||dddS)Nrz: )getattrshowAllr rwritelnjoindotswrite)rrr&rmessageZdetailr r r rVs   zTextTestResult.printLabelcCs`t|x6t|jD]$}|j|\}}}|r|||qWt|dr\|jj |j dS)zsz/TextTestResult.printSummary..)N)rr2r/floatZtestsRunZ separator2r"rr5lenr:r% wasSuccessfulr#sortr0)rstartstopr2r/ZtakenrunpluralsummaryZeckeysr)rrrr=r#r r r printSummaryps>           zTextTestResult.printSummarycCsJ|js |jrdSx4t|jD]"}|j|\}}}|s:q |r dSq WdS)zOverrides 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 rBs zTextTestResult.wasSuccessfulcCsjy|||}Wntk r.||}YnX|j||f|jrT|jdn|jrf|jddS)NrE)r r!r%rr.rr2r1)rrr&r(r r r _addErrorszTextTestResult._addErrorcCsbddlm}t|dr2t|d|r2t|dSyt|||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}|dtt||S)Nr)warnzln() has moved to nose.util from nose.result and will be removed from nose.result in a future release. Please update your imports )warningsrODeprecationWarning_ln)argkwrOr r r rs r)rNloggingZunittest.runnerr ImportErrorZunittestZ nose.configrZ nose.utilrrrR getLoggerlogr r r r r r  s  #