HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //proc/93580/root/usr/lib/python3.10/unittest/__pycache__/async_case.cpython-310.pyc
o

p̦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)�self�
methodName��	__class__��*/usr/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)�
addCleanup)r�func�args�kwargsrrr�addAsyncCleanup,s
z'IsolatedAsyncioTestCase.addAsyncCleanupcCs|��|�|j�dSr)�setUp�
_callAsyncrrrrr�
_callSetUp;sz"IsolatedAsyncioTestCase._callSetUpcCs|�|�dSr��_callMaybeAsync)r�methodrrr�_callTestMethod?sz'IsolatedAsyncioTestCase._callTestMethodcCs|�|j�|��dSr)rr�tearDownrrrr�
_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	�inspect�isawaitable�
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.rrrr Qs

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)rr0�queue�query�	awaitabler/�exrrr�_asyncioLoopRunner[s,�


�
���z*IsolatedAsyncioTestCase._asyncioLoopRunnercCs\|jdus	Jd��t��}t�|�|�d�||_|��}|�|�|��|_|�	|�dS)Nz%asyncio test loop already initializedT)
r	r1�new_event_loop�set_event_loop�	set_debugr+�create_taskr@�_asyncioCallsTaskr-)r�loopr0rrr�_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'�return_exceptionsTz(unhandled exception during test shutdown)�message�	exception�task)r	r
r,r-�joinr1�	all_tasks�shutdown_default_executorrB�close�cancel�gatherr6rJ�call_exception_handler�shutdown_asyncgens)rrF�	to_cancelrKrrr�_tearDownAsyncioLoopxsD

�
���
�

z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNcs*|��zt��|�W|��S|��wr)rGr�runrU)r�resultr
rrrV�szIsolatedAsyncioTestCase.runcs|��t���|��dSr)rGr�debugrUrr
rrrX�s
zIsolatedAsyncioTestCase.debugcCs|jdur|��dSdSr)r	rUrrrr�__del__�s
�zIsolatedAsyncioTestCase.__del__)rr)�__name__�
__module__�__qualname__rrrrrr"r$r&rr r@rGrUrVrXrY�
__classcell__rrr
rrs"

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