3 \G@sjddlZddlZddlZddlmZddlmZdZGdddeZ Gdd d ej Z Gd d d eZ dS) N)result)registerResultTc@s&eZdZddZddZdddZdS) _WritelnDecoratorcCs ||_dS)N)stream)selfrr'/usr/lib64/python3.6/unittest/runner.py__init__sz_WritelnDecorator.__init__cCs|dkrt|t|j|S)Nr __getstate__)rr )AttributeErrorgetattrr)rattrrrr __getattr__sz_WritelnDecorator.__getattr__NcCs|r|j||jddS)N )write)rargrrr writelns z_WritelnDecorator.writeln)N)__name__ __module__ __qualname__r rrrrrr r srcseZdZddZddZfddZddZfdd Zfd d Zfd d Z fddZ fddZ fddZ fddZ ddZddZZS)TextTestResult=F-cs8tt|j|||||_|dk|_|dk|_||_dS)Nr)superrr rshowAlldots descriptions)rrr verbosity) __class__rr r %s   zTextTestResult.__init__cCs0|j}|jr$|r$djt||fSt|SdS)Nr)ZshortDescriptionrjoinstr)rtestZdoc_first_linerrr getDescription,s zTextTestResult.getDescriptioncsBtt|j||jr>|jj|j||jjd|jjdS)Nz ... )rr startTestrrrr$flush)rr#)r rr r%3s  zTextTestResult.startTestcsDtt|j||jr$|jjdn|jr@|jjd|jjdS)Nok.) rr addSuccessrrrrrr&)rr#)r rr r):s  zTextTestResult.addSuccesscsFtt|j|||jr&|jjdn|jrB|jjd|jjdS)NERRORE) rraddErrorrrrrrr&)rr#err)r rr r,Bs  zTextTestResult.addErrorcsFtt|j|||jr&|jjdn|jrB|jjd|jjdS)NFAILF) rr addFailurerrrrrr&)rr#r-)r rr r0Js  zTextTestResult.addFailurecsLtt|j|||jr,|jjdj|n|jrH|jjd|jj dS)Nz skipped {0!r}s) rraddSkiprrrformatrrr&)rr#reason)r rr r2Rs  zTextTestResult.addSkipcsFtt|j|||jr&|jjdn|jrB|jjd|jjdS)Nzexpected failurex) rraddExpectedFailurerrrrrr&)rr#r-)r rr r6Zs  z!TextTestResult.addExpectedFailurecsDtt|j||jr$|jjdn|jr@|jjd|jjdS)Nzunexpected successu) rraddUnexpectedSuccessrrrrrr&)rr#)r rr r8bs  z#TextTestResult.addUnexpectedSuccesscCs6|js |jr|jj|jd|j|jd|jdS)Nr*r.)rrrrprintErrorListerrorsfailures)rrrr printErrorsjs  zTextTestResult.printErrorscCs\xV|D]N\}}|jj|j|jjd||j|f|jj|j|jjd|qWdS)Nz%s: %sz%s)rr separator1r$ separator2)rZflavourr:r#r-rrr r9ps zTextTestResult.printErrorList)rrrr=r>r r$r%r)r,r0r2r6r8r<r9 __classcell__rr)r r rs        rc@s0eZdZeZd ddddZdd Zd d ZdS) TextTestRunnerNTrF) tb_localsc CsN|dkrtj}t||_||_||_||_||_||_||_ |dk rJ||_ dS)N) sysstderrrrrrfailfastbufferrAwarnings resultclass) rrrrrDrErGrFrArrr r s zTextTestRunner.__init__cCs|j|j|j|jS)N)rGrrr)rrrr _makeResultszTextTestRunner._makeResultcCs4|j}t||j|_|j|_|j|_tj|jr^tj|j|jdkr^tjdt ddt j }t |dd}|dk r|z ||Wdt |dd}|dk r|Xt j }WdQRX||}|j t |dr|jj|j|j}|jjd ||d krd pd |f|jjd } } } ytt|j|j|jf} Wntk rVYn X| \} } } g} |js|jjdt|jt|j}}|r| jd||r| jd|n |jjd| r| jd| | r| jd| | r| jd| | r$|jjddj| fn |jjd|S)NdefaultalwaysmodulezPlease use assert\w+ instead.)categorymessage startTestRun stopTestRunr>zRan %d test%s in %.3fsrr1rZFAILEDz failures=%dz errors=%dZOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r)rIrJ)rHrrDrErArFcatch_warnings simplefilterfilterwarningsDeprecationWarningtimer r<hasattrrrr>ZtestsRunmaplenZexpectedFailuresunexpectedSuccessesskippedr Z wasSuccessfulrr;r:appendr!)rr#rZ startTimerNrOZstopTimeZ timeTakenrunZ expectedFailsrYrZZresultsZinfosZfailedZerroredrrr r\sr              zTextTestRunner.run)NTrFFNN)rrrrrGr rHr\rrrr r@xs r@) rBrUrFrPrZsignalsrZ __unittestobjectrZ TestResultrr@rrrr s  [