HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/unittest/__pycache__/async_case.cpython-310.opt-2.pyc
o

�i��@s0ddlZddlZddlmZGdd�de�ZdS)�N�)�TestCasecs�eZdZd#�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$�fdd�	Z�fdd �Zd!d"�Z�ZS)%�IsolatedAsyncioTestCase�runTestcst��|�d|_d|_dS�N)�super�__init__�_asyncioTestLoop�_asyncioCallsQueue)�selfZ
methodName��	__class__��0/usr/local/lib/python3.10/unittest/async_case.pyr!s
z IsolatedAsyncioTestCase.__init__c���dSrr�rrrr�
asyncSetUp&��z"IsolatedAsyncioTestCase.asyncSetUpc�rrrrrrr�
asyncTearDown)rz%IsolatedAsyncioTestCase.asyncTearDowncO�|j|g|�Ri|��dSr)Z
addCleanup)r�func�args�kwargsrrr�addAsyncCleanup,s
z'IsolatedAsyncioTestCase.addAsyncCleanupcCs|��|�|j�dSr)ZsetUp�
_callAsyncrrrrr�
_callSetUp;sz"IsolatedAsyncioTestCase._callSetUpcCs|�|�dSr��_callMaybeAsync)r�methodrrr�_callTestMethod?sz'IsolatedAsyncioTestCase._callTestMethodcCs|�|j�|��dSr)rrZtearDownrrrr�
_callTearDownBsz%IsolatedAsyncioTestCase._callTearDowncOrrr)r�functionrrrrr�_callCleanupFsz$IsolatedAsyncioTestCase._callCleanupcOs4||i|��}|j��}|j�||f�|j�|�Sr)r	�
create_futurer
�
put_nowait�run_until_complete�rrrr�ret�futrrrrIs
z"IsolatedAsyncioTestCase._callAsynccOsB||i|��}t�|�r|j��}|j�||f�|j�|�S|Sr)�inspectZisawaitabler	r#r
r$r%r&rrrrQs

z'IsolatedAsyncioTestCase._callMaybeAsyncc
�s��t��|_}|�d�	|��IdH}|��|durdS|\}}z|IdH}|��s2|�|�Wn'ttfy=�t	tj
fyZ}z|��sP|�|�WYd}~nd}~wwqr)�asyncio�Queuer
�
set_result�get�	task_done�	cancelled�
SystemExit�KeyboardInterrupt�
BaseException�CancelledError�
set_exception)rr(�queue�queryZ	awaitabler'�exrrr�_asyncioLoopRunner[s,�


�
���z*IsolatedAsyncioTestCase._asyncioLoopRunnercCsJt��}t�|�|�d�||_|��}|�|�|��|_|�	|�dS)NT)
r*Znew_event_loop�set_event_loopZ	set_debugr	r#Zcreate_taskr8Z_asyncioCallsTaskr%)r�loopr(rrr�_setupAsyncioLoopns

z)IsolatedAsyncioTestCase._setupAsyncioLoopc
Cs|j}d|_|j�d�|�|j���zct�|�}|s/W|�|���t�d�|�	�dS|D]}|�
�q1|�tj|ddi��|D]}|��rLqE|�
�dur]|�d|�
�|d��qE|�|���W|�|���t�d�|�	�dS|�|���t�d�|�	�w)NZreturn_exceptionsTz(unhandled exception during test shutdown)�message�	exception�task)r	r
r$r%�joinr*Z	all_tasksZshutdown_default_executorr9�close�cancelZgatherr/r=Zcall_exception_handlerZshutdown_asyncgens)rr:Z	to_cancelr>rrr�_tearDownAsyncioLoopxsB

�
���
�

z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNcs*|��zt��|�W|��S|��wr)r;r�runrB)r�resultrrrrC�szIsolatedAsyncioTestCase.runcs|��t���|��dSr)r;r�debugrBrrrrrE�s
zIsolatedAsyncioTestCase.debugcCs|jdur|��dSdSr)r	rBrrrr�__del__�s
�zIsolatedAsyncioTestCase.__del__)rr)�__name__�
__module__�__qualname__rrrrrrr r"rrr8r;rBrCrErF�
__classcell__rrrrrs"

$r)r*r)�caserrrrrr�<module>s