U ÙAT^c@sXddlZddlZddlZddlmZddlmZdZdd„ZdZ d Z Gd d „d e ƒZ dS) éNé)Úutil©ÚwrapsTcstˆƒ‡fdd„ƒ}|S)Ncs$t|ddƒr| ¡ˆ|f|ž|ŽS)NÚfailfastF)ÚgetattrÚstop)ÚselfZargsZkw©Úmethod©ú'/usr/lib64/python3.8/unittest/result.pyÚinner s zfailfast..innerr)r r r r r r srz Stdout: %sz Stderr: %sc@sÎeZdZdZdZdZd-dd„Zdd„Zdd„Zd d „Z d d „Z d d„Z dd„Z dd„Z edd„ƒZedd„ƒZdd„Zdd„Zdd„Zdd„Zedd „ƒZd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„ZdS).Ú TestResultNFcCsbd|_g|_g|_d|_g|_g|_g|_d|_d|_d|_ d|_ d|_ t j |_t j|_d|_dS)NFr)rÚfailuresÚerrorsÚtestsRunÚskippedÚexpectedFailuresÚunexpectedSuccessesÚ shouldStopÚbufferÚ tb_localsÚ_stdout_bufferÚ_stderr_bufferÚsysÚstdoutÚ_original_stdoutÚstderrÚ_original_stderrÚ _mirrorOutput)rZstreamZ descriptionsZ verbosityr r r Ú__init__&szTestResult.__init__cCódS©Nr ©rr r r Ú printErrors7ózTestResult.printErrorscCs |jd7_d|_| ¡dS)NrF)rrÚ _setupStdout©rÚtestr r r Ú startTest:szTestResult.startTestcCs8|jr4|jdkr$t ¡|_t ¡|_|jt_|jt_dSr")rrÚioZStringIOrrrrr#r r r r&@s    zTestResult._setupStdoutcCr!r"r r#r r r Ú startTestRunHr%zTestResult.startTestRuncCs| ¡d|_dS)NF)Ú_restoreStdoutrr'r r r ÚstopTestNszTestResult.stopTestcCs¬|jr¨|jrltj ¡}tj ¡}|rF| d¡s6|d7}|j t |¡|rl| d¡s\|d7}|j  t |¡|jt_|j t_|j   d¡|j  ¡|j  d¡|j ¡dS)NÚ r)rrrrÚgetvaluerÚendswithrZwriteÚ STDOUT_LINErÚ STDERR_LINErZseekZtruncater)rÚoutputÚerrorr r r r,Ss$       zTestResult._restoreStdoutcCr!r"r r#r r r Ú stopTestRunhr%zTestResult.stopTestRuncCó"|j || ||¡f¡d|_dS©NT)rÚappendÚ_exc_info_to_stringr©rr(Úerrr r r ÚaddErrornszTestResult.addErrorcCr6r7)rr8r9rr:r r r Ú addFailurevszTestResult.addFailurecCsZ|dk rVt|ddƒr| ¡t|d|jƒr4|j}n|j}| || ||¡f¡d|_dS)NrFrT) rrZ issubclassÚfailureExceptionrrr8r9r)rr(Zsubtestr;rr r r Ú addSubTest}s zTestResult.addSubTestcCr!r"r r'r r r Ú addSuccessŽózTestResult.addSuccesscCs|j ||f¡dSr")rr8)rr(Zreasonr r r ÚaddSkip’rAzTestResult.addSkipcCs|j || ||¡f¡dSr")rr8r9r:r r r ÚaddExpectedFailure–sÿzTestResult.addExpectedFailurecCs|j |¡dSr")rr8r'r r r ÚaddUnexpectedSuccess›szTestResult.addUnexpectedSuccesscCs>t|jƒt|jƒkodknoÚ_count_relevant_tb_levelsÚ tracebackZTracebackExceptionrZlistZformatrrrr/rr0r8r1r2Zjoin) rr;r(ZexctypeZvalueÚtbÚlengthZtb_eZmsgLinesr3r4r r r r9­s4   ÿ     zTestResult._exc_info_to_stringcCs d|jjkS)NÚ __unittest)Ztb_frameZ f_globals)rrLr r r rHËr%z TestResult._is_relevant_tb_levelcCs&d}|r"| |¡s"|d7}|j}q|S)Nrr)rHrI)rrLrMr r r rJÎs z$TestResult._count_relevant_tb_levelscCs&dt |j¡|jt|jƒt|jƒfS)Nz!<%s run=%i errors=%i failures=%i>)rZstrclassZ __class__rrErrr#r r r Ú__repr__Õs ÿÿzTestResult.__repr__)NNN)Z__name__Z __module__Z __qualname__Z_previousTestClassZ_testRunEnteredZ_moduleSetUpFailedr r$r)r&r+r-r,r5rr<r=r?r@rBrCrDrFrr9rHrJrOr r r r rs6      r) r*rrKrGrZ functoolsrrNrr1r2Zobjectrr r r r Zs