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.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._callCleanupcOs^|jdus	Jd��||i|��}t�|�sJ|�d���|j��}|j�||f�|j�|�S)N�$asyncio test loop is not initializedz returned non-awaitable�r	�inspectZisawaitable�
create_futurer
�
put_nowait�run_until_complete�rrrr�ret�futrrrrIs
z"IsolatedAsyncioTestCase._callAsynccOsT|jdus	Jd��||i|��}t�|�r(|j��}|j�||f�|j�|�S|S)Nr#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._asyncioLoopRunnercCs\|jdus	Jd��t��}t�|�|�d�||_|��}|�|�|��|_|�	|�dS)Nz%asyncio test loop already initializedT)
r	r,Znew_event_loop�set_event_loopZ	set_debugr&Zcreate_taskr:Z_asyncioCallsTaskr()r�loopr+rrr�_setupAsyncioLoopns

z)IsolatedAsyncioTestCase._setupAsyncioLoopc
Cs$|jdus	Jd��|j}d|_|j�d�|�|j���zct�|�}|s8W|�|���t�d�|�	�dS|D]}|�
�q:|�tj|ddi��|D]}|��rUqN|�
�durf|�d|�
�|d��qN|�|���W|�|���t�d�|�	�dS|�|���t�d�|�	�w)Nr#Zreturn_exceptionsTz(unhandled exception during test shutdown)�message�	exception�task)r	r
r'r(�joinr,Z	all_tasksZshutdown_default_executorr;�close�cancelZgatherr1r?Zcall_exception_handlerZshutdown_asyncgens)rr<Z	to_cancelr@rrr�_tearDownAsyncioLoopxsD

�
���
�

z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNcs*|��zt��|�W|��S|��wr)r=r�runrD)r�resultrrrrE�szIsolatedAsyncioTestCase.runcs|��t���|��dSr)r=r�debugrDrrrrrG�s
zIsolatedAsyncioTestCase.debugcCs|jdur|��dSdSr)r	rDrrrr�__del__�s
�zIsolatedAsyncioTestCase.__del__)rr)�__name__�
__module__�__qualname__rrrrrrr r"rrr:r=rDrErGrH�
__classcell__rrrrrs"

$r)r,r%�caserrrrrr�<module>s