U eU@sdZddlZzddlmZWn 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*z t|WSdt|jYSXdS)Nz)strtype__name__)excr 9/opt/hc_python/lib/python3.8/site-packages/nose/result.py_exception_details r 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||||dSN) errorClassesrconfigr__init__)selfstream descriptions verbosityrrr r r r$szTextTestResult.__init__cCsJddlm}||jkrF|j|\}}}|||f||||dfdS)NrSkipTest)nose.plugins.skiprrappend printLabel)rtestreasonrstoragelabelisfailr r r addSkip.s   zTextTestResult.addSkipc Cs|\}}}z|||}Wntk r8||}YnXt|jD]J\}\}} } t|rHt||rH| rrd|_|||f| | |dSqH|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) rrerrecZevtbexc_infoclsrrrr r r addError6s  zTextTestResult.addErrorcCs"|jr|pt|St|SdSr)rZshortDescriptionr)rrr r r getDescriptionPszTextTestResult.getDescriptioncCslt|dd}|dk rh|jrP|g}|r>t|d}|r>|||d|n|jrh||dddS)Nrz: )getattrshowAllr rwritelnjoindotswrite)rrr(rmessagedetailr r r rVs   zTextTestResult.printLabelcCs\t|t|jD]$}|j|\}}}|r|||qt|drX|jj |j dS)zsz/TextTestResult.printSummary..)N)rr5r2floatZtestsRunZ separator2r$rr9lenr@r' wasSuccessfulr%sortr3)rstartstopr5r2ZtakenrunpluralsummaryZeckeysr,rrrrCr%r r r printSummaryps@          zTextTestResult.printSummarycCsH|js |jrdSt|jD]$}|j|\}}}|s8q|rdSqdS)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$rr9r=r r r rHs zTextTestResult.wasSuccessfulcCsjz|||}Wntk r.||}YnX|j||f|jrT|jdn|jrf|jddS)Nr!E)r"r#r'rr1rr5r4)rrr(r+r r r _addErrorszTextTestResult._addErrorcCshddlm}t|dr2t|d|r2t|dSzt|||WStk rbt||YSXdS)Nrrr/)rrrr&rrr"r#)rr(rrr r r r"s  z"TextTestResult._exc_info_to_string)NN)N)N)r __module__ __qualname____doc__rr r-r.rr8rOrHrQr"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 )warningsrUDeprecationWarning_ln)argkwrUr r r rs  r)rTloggingZunittest.runnerr ImportErrorZunittestZ nose.configrZ nose.utilrrrX getLoggerlogr r r r r r s   #