XylotrechusZ
�
Ȓ�g� � �r � d dl mZ d dlmZ d dlZddlmZ ddlmZ dZ e� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Zy)� )�annotations)�wrapsN� )�config� )�
_AsyncUtilTc �, � t j � y)zcalled when the test finishesN)�_async_util�close� � �K/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/testing/asyncio.py� _shutdownr # s � ����r
c �4 � t j | g|��i |��S �N)r
�run��fn�args�kwargss r �_run_coroutine_functionr ( s � ��?�?�2�/��/��/�/r
c �P � t s | |i |��S t j | g|��i |��S )a Run a function in an asyncio loop unconditionally.
This function is used for provisioning features like
testing a database connection for server info.
Note that for blocking IO database drivers, this means they block the
event loop.
)�ENABLE_ASYNCIOr
�run_in_greenletr s r �
_assume_asyncr , s2 � � ��4�"�6�"�"��&�&�r�;�D�;�F�;�;r
c � � t s | |i |��S t j rt j | g|��i |��S | |i |��S )a� Run a function in an asyncio loop if any current drivers might need it.
This function is used for provisioning features that take
place outside of a specific database driver being selected, so if the
current driver that happens to be used for the provisioning operation
is an async driver, it will run in asyncio and not fail.
Note that for blocking IO database drivers, this means they block the
event loop.
)r r � any_asyncr
r r s r �_maybe_async_provisioningr = sK � � ��4�"�6�"�"�
����*�*�2�?��?��?�?��4�"�6�"�"r
c � � t s | |i |��S t j j }|rt j
| g|��i |��S | |i |��S )z�Run a function in an asyncio loop if the current selected driver is
async.
This function is used for test setup/teardown and tests themselves
where the current DB driver is known.
)r r �_current�is_asyncr
r )r r r r! s r �_maybe_asyncr"