AlkantarClanX12

Your IP : 18.189.185.63


Current Path : /proc/self/root/usr/lib64/python3.6/test/support/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.6/test/support/__pycache__/testresult.cpython-36.pyc

3


 \
�@s6dZddlZddlZddlZddlZddlZddlZddljj	Z
ddlmZGdd�dej�Z
Gdd�d�Zdd	d
�Zddd�Zed
k�r2Gdd�dej�Zej�Zejeje��ej�Zeedd�ejD���Zeej�Zeje�Z e!dej"��e!ddd�x(e
j#e j$��D]Z%e!e%j&�dd��qWe!�dS)z=Test runner and result class for the regression test suite.

�N)�datetimecs�eZdZdddZdddZ�fdd�Zedd��Z�fd	d
�Zd$dd
�Z	dd�Z
edd��Z�fdd�Z�fdd�Z
�fdd�Z�fdd�Z�fdd�Z�fdd�Zdd�Zd d!�Zd"d#�Z�ZS)%�RegressionTestResult�=�F�
�-cs\t�j||dd�d|_tjd�|_|jjdtj�j	d��d|_
d|_g|_t
|�|_dS)Nr)�stream�descriptions�	verbosityTZ	testsuite�start� )�super�__init__�buffer�ETZElement�_RegressionTestResult__suite�setrZutcnowZ	isoformat�_RegressionTestResult__e�!_RegressionTestResult__start_timeZ_RegressionTestResult__results�bool�_RegressionTestResult__verbose)�selfrr	r
)�	__class__��//usr/lib64/python3.6/test/support/testresult.pyrszRegressionTestResult.__init__cCsLy
|j}Wntk
r"t|�SXy|�Stk
rBt|�SXt|�S)N)�id�AttributeError�str�	TypeError�repr)�cls�testZtest_idrrrZ__getIds


zRegressionTestResult.__getIdcsVt�j|�tj|jd�|_}tj�|_|j	rR|j
j|j|��d��|j
j
�dS)NZtestcasez ... )r
�	startTestr�
SubElementrr�time�perf_counterrrr�write�getDescription�flush)rr!�e)rrrr"+s
zRegressionTestResult.startTestFcKsP|j}d|_|dkrdS|jd|jd|j|���|jd|jdd��|jd|jdd��|jrz|jdtj�|jd��|r�|jdk	r�|jj�j	�}|t
j|d�_|j
dk	r�|j
j�j	�}|t
j|d	�_x�|j�D]t\}}|s�|r�q�t
j||�}	t|d
��r>xD|j�D],\}
}|
�r,|	j|
t|��n
t|�|	_�qWq�t|�|	_q�WdS)N�nameZstatus�run�resultZ	completedr$z0.6fz
system-outz
system-err�items)rr�pop�_RegressionTestResult__getIdrr$r%Z_stdout_buffer�getvalue�rstriprr#�textZ_stderr_bufferr-�hasattrr)rr!Zcapture�argsr)�stdout�stderr�k�vZe2Zk2Zv2rrr�_add_result3s4

z RegressionTestResult._add_resultcCs|jr|jj|�d��dS)Nr)rrr&)r�cZwordrrrZ__writeSszRegressionTestResult.__writecCslt|t�r0|jdkr|j}q8|j�d|j��}nt|�}tj||d�}tj|||�}|dj|�dj|�d�S)N�builtins�.�)�type�messager=)�
isinstancer>�
__module__�__name__r�	traceback�format_exception�join)r Zerr_typeZ	err_valueZerr_tb�typename�msg�tbrrrZ__makeErrorDictWs

z$RegressionTestResult.__makeErrorDictcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�error�E�ERROR)r9�$_RegressionTestResult__makeErrorDictr
�addError�_RegressionTestResult__write)rr!�err)rrrrMjszRegressionTestResult.addErrorcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�output�xzexpected failure)r9rLr
�addExpectedFailurerN)rr!rO)rrrrRosz'RegressionTestResult.addExpectedFailurecs4|j|d|j|�d�t�j||�|jdd�dS)NT)Zfailure�F�FAIL)r9rLr
�
addFailurerN)rr!rO)rrrrUtszRegressionTestResult.addFailurecs2|j||d�t�j||�|jdd|���dS)N)Zskipped�Szskipped )r9r
�addSkiprN)rr!�reason)rrrrWyszRegressionTestResult.addSkipcs&|j|�t�j|�|jdd�dS)Nr<�ok)r9r
�
addSuccessrN)rr!)rrrrZ~s
zRegressionTestResult.addSuccesscs*|j|dd�t�j|�|jdd�dS)NZUNEXPECTED_SUCCESS)Zoutcome�uzunexpected success)r9r
�addUnexpectedSuccessrN)rr!)rrrr\�sz)RegressionTestResult.addUnexpectedSuccesscCs2|jr|jjd�|jd|j�|jd|j�dS)NrrKrT)rrr&�printErrorList�errors�failures)rrrr�printErrors�sz RegressionTestResult.printErrorscCs`xZ|D]R\}}|jj|j�|jj|�d|j|��d��|jj|j�|jjd|�qWdS)Nz: rz%s
)rr&�
separator1r'�
separator2)rZflavorr^r!rOrrrr]�s
z#RegressionTestResult.printErrorListcCsH|j}|jdt|j��|jdtt|j���|jdtt|j���|S)NZtestsr^r_)rrrZtestsRun�lenr^r_)rr)rrr�get_xml_element�s
z$RegressionTestResult.get_xml_element)F)rBrA�__qualname__rarbr�classmethodr/r"r9rNrLrMrRrUrWrZr\r`r]rd�
__classcell__rr)rrrs"
 rc@seZdZddd�Zdd�ZdS)�QuietRegressionTestRunnerFcCst|dd�|_||j_dS)Nr)rr,r)rrrrrrr�sz"QuietRegressionTestRunner.__init__cCs||j�|jS)N)r,)rr!rrrr+�s
zQuietRegressionTestRunner.runN)F)rBrArerr+rrrrrh�s
rhFcCs&|rtjtjt||d�Stjt|d�S)N)Zresultclassrr
)r)�	functools�partial�unittestZTextTestRunnerrrh)r
rrrr�get_test_runner_class�srlcCst||�|�S)N)rl)rr
Zcapture_outputrrr�get_test_runner�srm�__main__c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	TestTestscCsdS)Nr)rrrr�	test_pass�szTestTests.test_passcCstjd�dS)Ng�?)r$Zsleep)rrrr�test_pass_slow�szTestTests.test_pass_slowcCs*tdtjd�tdtjd�|jd�dS)Nr5)�filer6zfailure message)�print�sysr5r6Zfail)rrrr�	test_fail�szTestTests.test_failcCs(tdtjd�tdtjd�td��dS)Nr5)rrr6z
error message)rsrtr5r6�RuntimeError)rrrr�
test_error�szTestTests.test_errorN)rBrArerprqrurwrrrrro�sroccs|]}|dkVqdS)z-vNr)�.0�arrr�	<genexpr>�srzzOutput:zXML: r=)�end)F)F)'�__doc__ri�iortr$rCrkZxml.etree.ElementTreeZetreeZElementTreerrZTextTestResultrrhrlrmrBZTestCaseroZ	TestSuiteZsuiteZaddTestZ	makeSuite�StringIOr�sum�argvZ
runner_clsr5Zrunnerr+r,rsr0Ztostringlistrd�s�decoderrrr�<module>s4