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/test/test_asyncio/__pycache__/test_runners.cpython-310.pyc
o

�i��@s|ddlZddlZddlmZddlmZdd�ZGdd�dej�ZGdd	�d	ej	�Z
Gd
d�de
�Zedkr<e�
�dSdS)
�N)�mock)�utilscCst�d�dS�N)�asyncio�set_event_loop_policy�rr�;/usr/local/lib/python3.10/test/test_asyncio/test_runners.py�tearDownModulesr	c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
TestPolicycCs||_d|_dSr)�loop_factory�loop)�selfrrrr�__init__s
zTestPolicy.__init__cCst�r)�RuntimeError�r
rrr�get_event_loopszTestPolicy.get_event_loopcCs|��Sr)rrrrr�new_event_loopszTestPolicy.new_event_loopcCs|dur	||_dSdSr�r)r
rrrr�set_event_loops
�zTestPolicy.set_event_loopN)�__name__�
__module__�__qualname__rrrrrrrrr
s
r
cs0eZdZdd�Z�fdd�Z�fdd�Z�ZS)�BaseTestcsBt���t���_t���_d�jj_d�_�fdd�}|�_	�S)NrFc�s�d�_dS�NT)�shutdown_ag_runrrrr�shutdown_asyncgens)s�
z-BaseTest.new_loop.<locals>.shutdown_asyncgens)
rZ
BaseEventLoopr�MockZ_process_events�	_selector�selectZreturn_valuerr)r
rrrr�new_loop"s


zBaseTest.new_loopcs"t���t|j�}t�|�dSr)�super�setUpr
rrr�r
Zpolicy��	__class__rrr!/s

zBaseTest.setUpcsHt��}|jdur|�|j���|�|jj�t�d�t���dSr)	rZget_event_loop_policyr�
assertTrueZ	is_closedrrr �tearDownr"r#rrr&5s

zBaseTest.tearDown)rrrrr!r&�
__classcell__rrr#rr s
rc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�RunTestscCs dd�}|�t�|��d�dS)Nc�s�t�d�IdHdS)Nr�*�r�sleeprrrr�mainBs�z.RunTests.test_asyncio_run_return.<locals>.mainr))�assertEqualr�run�r
r,rrr�test_asyncio_run_returnAsz RunTests.test_asyncio_run_returncCsFdd�}|�td��t�|��Wd�dS1swYdS)Nc�s�t�d�IdHtd��)Nr�spam)rr+�
ValueErrorrrrrr,Is�z.RunTests.test_asyncio_run_raises.<locals>.mainr1)�assertRaisesRegexr2rr.r/rrr�test_asyncio_run_raisesHs"�z RunTests.test_asyncio_run_raisesc
Csxddd�hD]3}|j|d��#|�td��
t�|�Wd�n1s%wYWd�n1s4wYqdS)N�cSsdSrrrrrr�<lambda>Q�z5RunTests.test_asyncio_run_only_coro.<locals>.<lambda>)�objza coroutine was expected)ZsubTestr3r2rr.)r
�orrr�test_asyncio_run_only_coroPs������z#RunTests.test_asyncio_run_only_corocs��fdd�}t�|d��tj|d�dd�t�ddd���t�|d��tj|d�dd�Wd�dS1s:wYdS)	Nc�s�t��}��|��|�dSr)rrZassertIsZ	get_debug)Zexpectedrrrrr,Xs�z-RunTests.test_asyncio_run_debug.<locals>.mainFT)�debugz!asyncio.coroutines._is_debug_modecSsdSrrrrrrr6^r7z1RunTests.test_asyncio_run_debug.<locals>.<lambda>)rr.rZpatchr/rrr�test_asyncio_run_debugWs"�zRunTests.test_asyncio_run_debugcsJ�fdd��|�td��t����Wd�dS1swYdS)Nc�s,���}zt�|�W|��dS|��wr)rr.�close)�coro�r,rrr,cs
�z9RunTests.test_asyncio_run_from_running_loop.<locals>.mainzcannot be called from a running)r3rrr.rrr?r�"test_asyncio_run_from_running_loopbs�"�z+RunTests.test_asyncio_run_from_running_loopcs@d�dd����fdd�}|�t�|��d�|�����dS)Nc�s�t�d�IdHdS)N皙�����?r*rrrr�leftoverqs�zARunTests.test_asyncio_run_cancels_hanging_tasks.<locals>.leftoverc�s�t�����dS�N�{)r�create_taskr�rB�lo_taskrrr,ts�z=RunTests.test_asyncio_run_cancels_hanging_tasks.<locals>.mainrD)r-rr.r%�doner/rrFr�&test_asyncio_run_cancels_hanging_tasksns
z/RunTests.test_asyncio_run_cancels_hanging_taskscshd�t���dd�����fdd�}|�t�|��d�|�������t�	d��t�
t�d��dS)Nc�s8�zt�d�IdHWdStjyddYdSw)NrAr5r)rr+�CancelledErrorrrrrrB�s��zHRunTests.test_asyncio_run_reports_hanging_tasks_errors.<locals>.leftoverc�s �t��}�|_t�����dSrC)r�get_running_loop�call_exception_handlerrEr�Zcall_exc_handler_mockrBrGrrr,�s
�zDRunTests.test_asyncio_run_reports_hanging_tasks_errors.<locals>.mainrDzasyncio.run.*shutdown)�messageZtask�	exception)rrr-rr.r%rHZassert_called_with�
test_utilsZMockPatternZMockInstanceOf�ZeroDivisionErrorr/rrMr�-test_asyncio_run_reports_hanging_tasks_errors|s�z6RunTests.test_asyncio_run_reports_hanging_tasks_errorscs�d�d�Gdd�dt��dd����fdd�����fdd�}|����t�|��Wd�n1s5wY|�����|��j�|��j	�dS)	Nc@seZdZdS)zSRunTests.test_asyncio_run_closes_gens_after_hanging_tasks_errors.<locals>.FancyExitN)rrrrrrr�	FancyExit�srScSs�	dVt�d�IdHq)NTr5r*rrrr�fidget�s
��zPRunTests.test_asyncio_run_closes_gens_after_hanging_tasks_errors.<locals>.fidgetc�sB����z
�2z3dHW}q6WdStjy ddYdSw)Nr5r)rrJ)Zthe_meaning_of_life)rT�spinnerrr�spin�s���zNRunTests.test_asyncio_run_closes_gens_after_hanging_tasks_errors.<locals>.spinc�s$�t��}t��|_t�������r)rrKrrrLrEr)rS�lazyboyrVrrr,�s
�
zNRunTests.test_asyncio_run_closes_gens_after_hanging_tasks_errors.<locals>.main)
�	ExceptionZassertRaisesrr.r%rHZassertIsNone�ag_frameZassertFalse�
ag_runningr/r)rSrTrWrVrUr�7test_asyncio_run_closes_gens_after_hanging_tasks_errors�s	�z@RunTests.test_asyncio_run_closes_gens_after_hanging_tasks_errorsN)rrrr0r4r:r<r@rIrRr[rrrrr(?sr(�__main__)rZunittestrZtest.test_asynciorrPr	ZAbstractEventLoopPolicyr
ZTestCaserr(rr,rrrr�<module>s~�