
    rp0j2              
       2   S SK r S SKrS SKrS SKrS SKJrJrJr  S SKJ	r	J
r
Jr  S SKrSSKJrJrJrJrJrJrJrJr  SSKJrJrJr  SSKJr   S SKr " S S	\
5      r " S
 S\
5      r  " S S\
5      r!S r"S r#\RH                  S 5       r%\RH                  S 5       r&\RN                  S 5       r(\RN                  S'S j5       r)S r*S r+S r,\RH                  S\/ \ RZ                  4   S\.S\.S\\ RZ                     4S j5       r/\RH                  S\\ RZ                     4S j5       r0\RH                  S\/ \14   S\/ \14   4S j5       r\RH                  S\/ \14   4S j5       r2\RH                  S \ RZ                  S\\    4S! j5       r3\RH                  S" 5       r4\RH                  S \ RZ                  S\\!   4S# j5       r5\RH                  S$ 5       r6\RH                  S \ RZ                  S\\   4S% j5       r7\RH                  S& 5       r8g! \ a    Sr GNf = f)(    N)	AwaitableCallableIterator)AnyProtocoloverload   )BaseTestServerRawTestServer
TestClient
TestServerloop_contextsetup_test_loopteardown_test_loopunused_port)ApplicationBaseRequestRequest)_RequestHandlerc                       \ rS rSr\SS.S\S\\\4   S-  S\S\	\
\4   4S jj5       r\SS.S\S\\\4   S-  S\S\	\S4   4S	 jj5       rS
rg)AiohttpClient   Nserver_kwargs_AiohttpClient__paramr   kwargsreturnc                   #    g 7fN selfr   r   r   s       O/home/wildlama/miniconda3/lib/python3.13/site-packages/aiohttp/pytest_plugin.py__call__AiohttpClient.__call__   s
      ,/   c                   #    g 7fr   r    r!   s       r#   r$   r%   &   s
      ),r&   r    )__name__
__module____qualname____firstlineno__r   r   dictstrr   r   r   r$   r
   r   __static_attributes__r        r#   r   r      s    
 04	// CH~,	/
 / 
G[(	)/ / 
 04	,, CH~,	,
 , 
K%	&, ,r/   r   c            
       B    \ rS rSrSS.S\S\S-  S\S\\   4S jjr	S	r
g)
AiohttpServer0   Nportappr4   r   r   c                    g r   r    )r"   r5   r4   r   s       r#   r$   AiohttpServer.__call__1   s     #r/   r    )r(   r)   r*   r+   r   intr   r   r   r$   r.   r    r/   r#   r1   r1   0   s8    6:$$),t$FI$	:	$ $r/   r1   c            
       B    \ rS rSrSS.S\S\S-  S\S\\   4S jjr	S	r
g)
AiohttpRawServer6   Nr3   handlerr4   r   r   c                    g r   r    )r"   r<   r4   r   s       r#   r$   AiohttpRawServer.__call__7   s    #&r/   r    )r(   r)   r*   r+   r   r8   r   r   r   r$   r.   r    r/   r#   r:   r:   6   s8    >B'&'14t'NQ'	=	!' 'r/   r:   c                 p    U R                  SSSSS9  U R                  SSSS	S9  U R                  S
SSSS9  g )N--aiohttp-fast
store_trueFz*run tests faster by disabling extra checks)actiondefaulthelpz--aiohttp-loopstorepyloopz3run tests with specific loop: pyloop, uvloop or all--aiohttp-enable-loop-debugzenable event loop debug mode)	addoption)parsers    r#   pytest_addoptionrJ   <   sc    
9	   B	   %+	  r/   c                 
  ^^^ U R                   m[        R                  " T5      (       a  SmO[        R                  " T5      (       a  SmOgSmSU R                  ;  a  U =R                  S-  sl        SmUUU4S jnXl         g)zbSet up pytest fixture.

Allow fixtures to be coroutines. Run coroutine fixtures in an event loop.
TFNrequestrL   c                  8  >^^ US   nT(       a  US	 SUR                   ;  a  [        S5      eUR                  S5      mT(       a?  T" U 0 UD6mUU4S jnUR                  U5        TR	                  TR                  5       5      $ TR	                  T" U 0 UD65      $ )NrL   loopz^Asynchronous fixtures must depend on the 'loop' fixture or be used in tests depending from it.c                  d   >  T R                  TR                  5       5      $ ! [         a     g f = fr   )run_until_complete	__anext__StopAsyncIteration)_loopgens   r#   	finalizer8pytest_fixture_setup.<locals>.wrapper.<locals>.finalizer|   s1     33CMMODD) s   " 
//)fixturenames	ExceptiongetfixturevalueaddfinalizerrQ   rR   )	argsr   rL   rV   rT   rU   funcis_async_genstrip_requests	       @@r#   wrapper%pytest_fixture_setup.<locals>.wrapperg   s    #y!
 ---6 
 ''/ ''C   +++CMMO<<++D$,A&,ABBr/   )r]   inspectisasyncgenfunctioniscoroutinefunctionargnames)
fixturedefr`   r]   r^   r_   s     @@@r#   pytest_fixture_setuprg   Q   sv    
 ??D!!$''		$	$T	*	* 	M
+++|+C@ Or/   c                 8    U R                   R                  S5      $ )z--fast config optionr@   config	getoptionrM   s    r#   fastrl      s     >>##$455r/   c                 8    U R                   R                  S5      $ )z!--enable-loop-debug config optionrG   ri   rM   s    r#   
loop_debugrn      s     >>##$ABBr/   c            
   #     #    [         R                  " SS9 n Sv   U  Vs/ s HA  nUR                  [        :X  d  M  UR                   SUR
                   SUR                   3PMC     nnU(       aE  [        SR                  [        U5      [        U5      S:X  a  SOSS	R                  U5      5      5      e SSS5        gs  snf ! , (       d  f       g= f7f)
zContext manager which checks for RuntimeWarnings.

This exists specifically to
avoid "coroutine 'X' was never awaited" warnings being missed.

If RuntimeWarnings occur in the context a RuntimeError is raised.
T)recordN:z{} Runtime Warning{},
{}r	    s
)warningscatch_warningscategoryRuntimeWarningfilenamelinenomessageRuntimeErrorformatlenjoin)	_warningswrws      r#   _runtime_warning_contextr      s      
	 	 	- 
zz^+ 3qzzl!AHH:Qqyyk2 	 

 +22G3r7a<RS$))B-   
.	-
 
.	-s3   C	CC ,C (AC7	C C
CCc              #   R   #    U (       a  U v   g[        5       n U v   [        XS9  g7f)zPassthrough loop context.

Sets up and tears down a loop unless one is passed in via the loop
argument when it's passed straight through.
rl   N)r   r   )rO   rl   s     r#   _passthrough_loop_contextr      s&      
  
4+s   %'c                     U R                  U5      (       a6  [        R                  " U5      (       a  [        U R	                  X5      5      $ gg)z%Fix pytest collecting for coroutines.N)funcnamefilterrb   rd   list_genfunctions)	collectornameobjs      r#   pytest_pycollect_makeitemr      sB    %%'*E*Ec*J*JI++D677 +K%r/   c           	         U R                   R                  S5      n[        R                  " U R                  5      (       Ga  [
        R                  " S[        5        U R                  R                  S5      =(       d`    U R                  R                  S5      =(       d>    U R                  R                  S5      =(       d    U R                  R                  SS5      n[        5          [        X!S9 nU R                  R                   Vs0 s H  nX@R                  U   _M     nnUR                  U R                  " S
0 UD65        SSS5        SSS5        g	gs  snf ! , (       d  f       N= f! , (       d  f       g	= f)zBRun coroutines in an event loop instead of a normal function call.r@   zKaiohttp.pytest_plugin will be removed in v4. Please install pytest-aiohttp.proactor_loopselector_loopuvloop_looprO   Nr   Tr    )rj   rk   rb   rd   functionru   warnDeprecationWarningfuncargsgetr   r   _fixtureinfore   rQ   r   )
pyfuncitemrl   existing_looprT   argtestargss         r#   pytest_pyfunc_callr      sH   &&'78D"":#6#677Y	

 ##O4 5""&&75""&&}55 ""&&vt4	 	 &'*=D  *66??? ,,S11?   (()C()CD E ( ) 8 ED (' s6   )
E03EE%#EE0E
E-	)E00
E>c           
      J   SU R                   ;  a  g U R                  R                  R                  nS[        R
                  0n[        b  [        R
                  US'   US:X  a  Sn0 nUR                  S5       Hh  nUR                  S5      (       + nUR                  S5      nXB;  a3  U(       a*  [        S	U< S
[        UR                  5       5      < 35      eMb  X$   X4'   Mj     U R                  S[        UR                  5       5      [        UR                  5       5      S9  g )Nloop_factoryrF   uvloopallzpyloop,uvloop?,?z ?zUnknown loop 'z', available loops: )ids)rX   rj   optionaiohttp_loopasyncionew_event_loopr   splitendswithstrip
ValueErrorr   keysparametrizevalues)metafuncloopsavail_factories	factoriesr   requireds         r#   pytest_generate_testsr      s   X222OO""//E!7!78O$*$9$9!~ IC }}S))zz$& T).."235 
 )/	 ! Y--/0d9>>;K6L  r/   r   rl   rn   r   c              #      #    [        XS9 nU(       a  UR                  S5        [        R                  " U5        Uv   SSS5        g! , (       d  f       g= f7f)z%Return an instance of the event loop.r   TN)r   	set_debugr   set_event_loop)r   rl   rn   rT   s       r#   rO   rO      s>      
l	.%OOD!u%	 
/	.	.s   
A3A	A
AAc               #      #    [         R                  n [        U 5       n[         R                  " U5        Uv   S S S 5        g ! , (       d  f       g = f7fr   )r   ProactorEventLoopr   r   )factoryrT   s     r#   r   r     s8     ''G	g	%u% 
		s   AA	A
AAaiohttp_unused_portc                 :    [         R                  " S[        SS9  U $ )Nz3Deprecated, use aiohttp_unused_port fixture instead   
stacklevelru   r   r   )r   s    r#   r   r     s    MM=
 r/   c                      [         $ )z1Return a port that is unused on the current host.)_unused_portr    r/   r#   r   r      s
     r/   rO   c              #      ^ ^#    / mSSS.S[         S[        S[        S-  S[        S[        4
U U4S	 jjjnUv   SU4S
 jjnT R                  U" 5       5        g7f)zVFactory to create a TestServer instance, given an app.

aiohttp_server(app, **kwargs)
z	127.0.0.1Nhostr4   r5   r   r4   r   r   c                   >#    [        XUS9nUR                  " SST0UD6I S h  vN   TR                  U5        U$  N7f)Nr   rO   r    )r   start_serverappend)r5   r   r4   r   serverrO   serverss        r#   goaiohttp_server.<locals>.go.  sF      C6!!6t6v666v 	7s   "?=?c                     >#    T (       a0  T R                  5       R                  5       I S h  vN   T (       a  M/  g g  N7fr   popcloser   s   r#   finalize aiohttp_server.<locals>.finalize<  +     ++-%%''' g'   )><>>r   N)r   r-   r8   r   r   rQ   rO   r   r   r   s   `  @r#   aiohttp_serverr   &  sq      G
  	

 
 Dj	

 
 

 
 H( 	HJ's   AAc                 :    [         R                  " S[        SS9  U $ )Nz.Deprecated, use aiohttp_server fixture insteadr   r   r   )r   s    r#   test_serverr   C      MM8
 r/   c           	   #      ^ ^#    / mSS.S[         S[        S-  S[        S[        4U U4S jjjnUv   S	U4S jjnT R	                  U" 5       5        g7f)
zhFactory to create a RawTestServer instance, given a web handler.

aiohttp_raw_server(handler, **kwargs)
Nr3   r<   r4   r   r   c                   >#    [        XS9nUR                  " SST0UD6I S h  vN   TR                  U5        U$  N7f)Nr3   rO   r    )r   r   r   )r<   r4   r   r   rO   r   s       r#   r   aiohttp_raw_server.<locals>.goU  sD      w2!!6t6v666v 	7s   !><>c                     >#    T (       a0  T R                  5       R                  5       I S h  vN   T (       a  M/  g g  N7fr   r   r   s   r#   r   $aiohttp_raw_server.<locals>.finalize_  r   r   r   )r   r8   r   r   rQ   r   s   `  @r#   aiohttp_raw_serverr   M  s^      G 9= +.:HK	  H( 	HJ's   AAc                 :    [         R                  " S[        SS9  U $ )Nz2Deprecated, use aiohttp_raw_server fixture insteadr   r   r   )r   s    r#   raw_test_serverr   f  s!     MM<
 r/   c              #   
  ^ ^#    / m[         SS.S[        S[        [        [        4   S-  S[        S[
        [        [        4   4S jj5       n[         SS.S[        S[        [        [        4   S-  S[        S[
        [        S4   4S jj5       nSS.S[        [        -  S	[        S[        [        [        4   S-  S[        S[
        [        [        4   4
UU 4S
 jjjnUv   SU4S jjnT R                  U" 5       5        g7f)zFactory to create a TestClient instance.

aiohttp_client(app, **kwargs)
aiohttp_client(server, **kwargs)
aiohttp_client(raw_server, **kwargs)
Nr   __paramr   r   r   c                   #    g 7fr   r    r   r   r   s      r#   r   aiohttp_client.<locals>.go|  s
      ,/r&   c                   #    g 7fr   r    r   s      r#   r   r     s
      ),r&   r\   c                  >#    [        U [        5      (       a*  [        U [        [        45      (       d  U " T/UQ70 UD6n 0 nOU(       a   S5       e[        U [        5      (       a(  U=(       d    0 n[	        U 4ST0UD6n[        U4ST0UD6nO;[        U [        5      (       a  [        U 4ST0UD6nO[        S[        U 5      -  5      eUR                  5       I S h  vN   TR                  U5        U$  N7f)Nzargs should be emptyrO   zUnknown argument type: %r)

isinstancer   r   r
   r   r   r   typer   r   )r   r   r\   r   r   clientclientsrO   s         r#   r   r     s      gx((k>22
 2
 d4T4V4GF3338g{++)/RMDdDmDF<T<V<F00=d=f=F84=HII!!###v 	$s   CC6C4C6c                     >#    T (       a0  T R                  5       R                  5       I S h  vN   T (       a  M/  g g  N7fr   r   )r   s   r#   r    aiohttp_client.<locals>.finalize  r   r   r   )
r   r   r,   r-   r   r   r   r
   r   rQ   )rO   r   r   r   s   `  @r#   aiohttp_clientr   r  s-     G 04// CH~,/ 	/
 
G[(	)/ /  04,, CH~,, 	,
 
K%	&, , 04~- CH~, 	
 
CH	 6 H( 	HJ's   C?Dc                 :    [         R                  " S[        SS9  U $ )Nz.Deprecated, use aiohttp_client fixture insteadr   r   r   )r   s    r#   test_clientr     r   r/   )F)9r   
contextlibrb   ru   collections.abcr   r   r   typingr   r   r   pytest
test_utilsr
   r   r   r   r   r   r   r   r   webr   r   r   web_protocolr   r   ImportErrorr   r1   r:   rJ   rg   fixturerl   rn   contextmanagerr   r   r   r   r   AbstractEventLoopboolrO   r   r8   r   r   r   r   r   r   r   r    r/   r#   <module>r     s       9 9 * * 	 	 	 3 2 )
,H ,&$H $'x '*6r 6 6
 C C
  . , , 84@ 
2w8889


 
 g''(	
 
 x 9 9:   Xb#g%6 8BG;L   Xb#g.  
 (22 (x7N ( (8   (W66 (8DT;U ( (0   :(22 :(x7N :( :(z  q  Fs   H
 
HH