U AT^@sXddlZddlZddlZddlmZddlmZdZddZdZ d Z Gd d d e Z dS) N)utilwrapsTcstfdd}|S)Ncs$t|ddr||f||S)NfailfastF)getattrstop)selfargskwmethod'/usr/lib64/python3.8/unittest/result.pyinner s zfailfast..innerr)r rrr rr srz Stdout: %sz Stderr: %sc@seZdZdZdZdZd-ddZddZddZd d Z d d Z d dZ ddZ ddZ eddZeddZddZddZddZddZedd 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)rfailureserrorstestsRunskippedexpectedFailuresunexpectedSuccesses shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r streamZ descriptions verbosityrrr__init__&szTestResult.__init__cCsdSNrr rrr printErrors7szTestResult.printErrorscCs |jd7_d|_|dS)NrF)rr" _setupStdoutr testrrr startTest:szTestResult.startTestcCs8|jr4|jdkr$t|_t|_|jt_|jt_dSr&)rrioStringIOrrrr r'rrrr)@s    zTestResult._setupStdoutcCsdSr&rr'rrr startTestRunHszTestResult.startTestRuncCs|d|_dS)NF)_restoreStdoutr"r*rrrstopTestNszTestResult.stopTestcCs|jr|jrltj}tj}|rF|ds6|d7}|jt ||rl|ds\|d7}|j t ||jt_|j t_|j d|j |j d|jdS)N r)rr"rrgetvaluer endswithrwrite STDOUT_LINEr! STDERR_LINErseektruncater)r outputerrorrrrr0Ss$       zTestResult._restoreStdoutcCsdSr&rr'rrr stopTestRunhszTestResult.stopTestRuncCs"|j||||fd|_dSNT)rappend_exc_info_to_stringr"r r+errrrraddErrornszTestResult.addErrorcCs"|j||||fd|_dSr=)rr>r?r"r@rrr addFailurevszTestResult.addFailurecCsZ|dk rVt|ddr|t|d|jr4|j}n|j}|||||fd|_dS)NrFrT) rr issubclassfailureExceptionrrr>r?r")r r+ZsubtestrArrrr addSubTest}s zTestResult.addSubTestcCsdSr&rr*rrr addSuccessszTestResult.addSuccesscCs|j||fdSr&)rr>)r r+reasonrrraddSkipszTestResult.addSkipcCs|j||||fdSr&)rr>r?r@rrraddExpectedFailureszTestResult.addExpectedFailurecCs|j|dSr&)rr>r*rrraddUnexpectedSuccessszTestResult.addUnexpectedSuccesscCs>t|jt|jkodknor6r7join) r rAr+exctypevaluetblengthZtb_eZmsgLinesr:r;rrrr?s4        zTestResult._exc_info_to_stringcCs d|jjkS)N __unittest)tb_frame f_globals)r r\rrrrRsz TestResult._is_relevant_tb_levelcCs&d}|r"||s"|d7}|j}q|S)Nrr)rRrS)r r\r]rrrrTs z$TestResult._count_relevant_tb_levelscCs&dt|j|jt|jt|jfS)Nz!<%s run=%i errors=%i failures=%i>)rZstrclass __class__rrLrrr'rrr__repr__s zTestResult.__repr__)NNN)__name__ __module__ __qualname__Z_previousTestClassZ_testRunEnteredZ_moduleSetUpFailedr%r(r,r)r/r1r0r<rrBrCrFrGrIrJrKrNrr?rRrTrbrrrrrs6      r) r-rrUrQr functoolsrr^rr6r7objectrrrrrs