o
    YeL                     @  s   d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	m
Z
 ddlmZ ddlmZmZ e	r8d dlmZ ed	Ze
d
ZdddZdS )    )annotations)	AwaitableCallable)partialwraps)TYPE_CHECKINGTypeVar   )_core)Clock
Instrument)	ParamSpecArgsTRetTfn Callable[ArgsT, Awaitable[RetT]]returnCallable[ArgsT, RetT]c                   s   t  d
 fdd}|S )aN  Converts an async test function to be synchronous, running via Trio.

    Usage::

        @trio_test
        async def test_whatever():
            await ...

    If a pytest fixture is passed in that subclasses the :class:`~trio.abc.Clock` or
    :class:`~trio.abc.Instrument` ABCs, then those are passed to :meth:`trio.run()`.
    args
ArgsT.argskwargsArgsT.kwargsr   r   c                    sr   d}dd |  D }|sd }nt|dkr|d }ntddd |  D }tjt g| R i |||dS )	NTc                 S     g | ]	}t |tr|qS  )
isinstancer   ).0cr   r   ;usr/lib/python3.10/site-packages/trio/testing/_trio_test.py
<listcomp>#       z.trio_test.<locals>.wrapper.<locals>.<listcomp>   r   z too many clocks spoil the broth!c                 S  r   r   )r   r   )r   ir   r   r   r   *   r   )clockinstruments)valueslen
ValueErrorr
   runr   )r   r   Z__tracebackhide__Zclocksr"   r#   r   r   r   wrapper    s   
ztrio_test.<locals>.wrapperN)r   r   r   r   r   r   )r   )r   r)   r   r(   r   	trio_test   s   r*   N)r   r   r   r   )
__future__r   collections.abcr   r   	functoolsr   r   typingr   r    r
   abcr   r   typing_extensionsr   r   r   r*   r   r   r   r   <module>   s    