B YI~dW�@sjddlZddlZddlZddlmZddlmZdZGdd�de�Z Gdd �d ej �Z Gd d �d e�Z dS) �N�)�result)�registerResultTc@s&eZdZdd�Zdd�Zddd�ZdS) �_WritelnDecoratorcCs ||_dS)N)�stream)�selfr�r�4/opt/alt/python37/lib64/python3.7/unittest/runner.py�__init__sz_WritelnDecorator.__init__cCs|dkrt|��t|j|�S)N)r� __getstate__)�AttributeError�getattrr)r�attrrrr � __getattr__sz_WritelnDecorator.__getattr__NcCs|r|�|�|�d�dS)N� )�write)r�argrrr �writelns z_WritelnDecorator.writeln)N)�__name__� __module__� __qualname__r rrrrrr r srcs�eZdZdZdZ�fdd�Zdd�Z�fdd�Z�fd d �Z�fd d �Z �fd d�Z �fdd�Z �fdd�Z �fdd�Z dd�Zdd�Z�ZS)�TextTestResultzF======================================================================zF----------------------------------------------------------------------cs8tt|��|||�||_|dk|_|dk|_||_dS)Nr)�superrr r�showAll�dots� descriptions)rrr� verbosity)� __class__rr r %s   zTextTestResult.__init__cCs0|��}|jr$|r$d�t|�|f�St|�SdS)Nr)ZshortDescriptionr�join�str)r�testZdoc_first_linerrr �getDescription,s zTextTestResult.getDescriptioncsBtt|��|�|jr>|j�|�|��|j�d�|j��dS)Nz ... )rr� startTestrrrr!�flush)rr )rrr r"3s  zTextTestResult.startTestcsDtt|��|�|jr$|j�d�n|jr@|j�d�|j��dS)N�ok�.) rr� addSuccessrrrrrr#)rr )rrr r&:s  zTextTestResult.addSuccesscsFtt|��||�|jr&|j�d�n|jrB|j�d�|j��dS)N�ERROR�E) rr�addErrorrrrrrr#)rr �err)rrr r)Bs  zTextTestResult.addErrorcsFtt|��||�|jr&|j�d�n|jrB|j�d�|j��dS)N�FAIL�F) rr� addFailurerrrrrr#)rr r*)rrr r-Js  zTextTestResult.addFailurecsLtt|��||�|jr,|j�d�|��n|jrH|j�d�|j� �dS)Nz skipped {0!r}�s) rr�addSkiprrr�formatrrr#)rr �reason)rrr r/Rs  zTextTestResult.addSkipcsFtt|��||�|jr&|j�d�n|jrB|j�d�|j��dS)Nzexpected failure�x) rr�addExpectedFailurerrrrrr#)rr r*)rrr r3Zs  z!TextTestResult.addExpectedFailurecsDtt|��|�|jr$|j�d�n|jr@|j�d�|j��dS)Nzunexpected success�u) rr�addUnexpectedSuccessrrrrrr#)rr )rrr r5bs  z#TextTestResult.addUnexpectedSuccesscCs6|js |jr|j��|�d|j�|�d|j�dS)Nr'r+)rrrr�printErrorList�errors�failures)rrrr � printErrorsjs  zTextTestResult.printErrorscCs\xV|D]N\}}|j�|j�|j�d||�|�f�|j�|j�|j�d|�qWdS)Nz%s: %sz%s)rr� separator1r!� separator2)rZflavourr7r r*rrr r6ps zTextTestResult.printErrorList)rrrr:r;r r!r"r&r)r-r/r3r5r9r6� __classcell__rr)rr rs        rc@s0eZdZeZd dd�dd�Zdd �Zd d �ZdS) �TextTestRunnerNTrF)� tb_localsc CsN|dkrtj}t|�|_||_||_||_||_||_||_ |dk rJ||_ dS)N) �sys�stderrrrrr�failfast�bufferr>�warnings� resultclass) rrrrrArBrDrCr>rrr r �s zTextTestRunner.__init__cCs|�|j|j|j�S)N)rDrrr)rrrr � _makeResult�szTextTestRunner._makeResultc Cs2|��}t|�|j|_|j|_|j|_t����|jr^t�|j�|jdkr^tjdt dd�t � �}t |dd�}|dk r�|�z ||�Wdt |dd�}|dk r�|�Xt � �}WdQRX||}|� �t|d�r�|j�|j�|j}|j�d||d ko�d �pd |f�|j��d } } } ytt|j|j|jf�} Wntk �rTYn X| \} } } g} |���s�|j�d �t|j�t|j�}}|�r�| �d|�|�r�| �d|�n |j�d�| �r�| �d| �| �r�| �d| �| �r| �d| �| �r"|j�dd�| �f�n |j�d�|S)N)�default�always�modulezPlease use assert\w+ instead.)�category�message� startTestRun� stopTestRunr;zRan %d test%s in %.3fsrr.�rZFAILEDz failures=%dz errors=%dZOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r)rErrArBr>rC�catch_warnings� simplefilter�filterwarnings�DeprecationWarning�timeZ perf_counterr r9�hasattrrrr;ZtestsRun�map�lenZexpectedFailures�unexpectedSuccesses�skippedr Z wasSuccessfulrr8r7�appendr)rr rZ startTimerKrLZstopTimeZ timeTaken�runZ expectedFailsrVrW�resultsZinfosZfailedZerroredrrr rY�sr              zTextTestRunner.run)NTrFFNN)rrrrrDr rErYrrrr r=xs r=) r?rRrCrMrZsignalsrZ __unittest�objectrZ TestResultrr=rrrr �s  [