HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3.9/unittest/__pycache__/async_case.cpython-39.pyc
a

�vi��@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�ZS)!�IsolatedAsyncioTestCase�runTestcst��|�d|_d|_dS�N)�super�__init__�_asyncioTestLoop�_asyncioCallsQueue)�selfZ
methodName��	__class__��)/usr/lib/python3.9/unittest/async_case.pyr"sz IsolatedAsyncioTestCase.__init__c�sdSrr�rrrr�
asyncSetUp'sz"IsolatedAsyncioTestCase.asyncSetUpc�sdSrrrrrr�
asyncTearDown*sz%IsolatedAsyncioTestCase.asyncTearDowncOs|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�
_callTearDownCsz%IsolatedAsyncioTestCase._callTearDowncOs|j|g|�Ri|��dSrr)rZfunctionrrrrr�_callCleanupGsz$IsolatedAsyncioTestCase._callCleanupcOsP|jdusJ�||i|��}t�|�s*J�|j��}|j�||f�|j�|�Sr�r	�inspectZisawaitable�
create_futurer
�
put_nowait�run_until_complete�rrrr�ret�futrrrrJs
z"IsolatedAsyncioTestCase._callAsynccOsT|jdusJ�||i|��}t�|�rL|j��}|j�||f�|j�|�S|SdSrrr$rrrrRs

z'IsolatedAsyncioTestCase._callMaybeAsyncc
�s�t��|_}|�d�|��IdH}|��|dur:dS|\}}z |IdH}|��s`|�|�Wqttfyz�Yqt	tj
fy�}z|��s�|�|�WYd}~qd}~00qdSr)�asyncioZQueuer
Z
set_result�getZ	task_done�	cancelled�
SystemExit�KeyboardInterrupt�
BaseExceptionZCancelledErrorZ
set_exception)rr&ZqueueZqueryZ	awaitabler%Zexrrr�_asyncioLoopRunner\s 

z*IsolatedAsyncioTestCase._asyncioLoopRunnercCsX|jdusJ�t��}t�|�|�d�||_|��}|�|�|��|_|�	|�dS)NT)
r	r'Znew_event_loop�set_event_loopZ	set_debugr!Zcreate_taskr-Z_asyncioCallsTaskr#)r�loopr&rrr�_setupAsyncioLoopos

z)IsolatedAsyncioTestCase._setupAsyncioLoopc	Cs�|jdusJ�|j}d|_|j�d�|�|j���z�t�|�}|s^Wt�d�|��dS|D]}|�	�qb|�tj
||dd���|D]0}|��r�q�|��dur�|�
d|��|d��q�|�|���Wt�d�|��nt�d�|��0dS)NT)r/Zreturn_exceptionsz(unhandled exception during test shutdown)�message�	exception�task)r	r
r"r#�joinr'Z	all_tasksr.�closeZcancelZgatherr)r2Zcall_exception_handlerZshutdown_asyncgens)rr/Z	to_cancelr3rrr�_tearDownAsyncioLoopys>

�
��


�
z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNcs.|��zt��|�W|��S|��0dSr)r0r�runr6)r�resultrrrr7�s�zIsolatedAsyncioTestCase.run)r)N)�__name__�
__module__�__qualname__rrrrrrrrrrr-r0r6r7�
__classcell__rrrrrs

"r)r'r Zcaserrrrrr�<module>s