
    h1                        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JrJ	r	J
r
Jr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&\RN                  S 5       r(\RN                  S 5       r)\RT                  S 5       r+\RT                  S#S j5       r,S r-S r.S r/\RN                  S 5       r0\RN                  S 5       r1\RN                  S\/ \24   S\/ \24   4S j5       r\RN                  S\/ \24   4S j5       r3\RN                  S\ Rh                  S\	\#   4S j5       r5\RN                  S 5       r6\RN                  S\ Rh                  S\	\$   4S j5       r7\RN                  S  5       r8\RN                  S\ Rh                  S\	\"   4S! j5       r9\RN                  S" 5       r:g! \! a    Sr  GNf = f)$    N)
Any	AwaitableCallableDictIteratorOptionalProtocolTypeUnion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\
\\4   4S jj5       r\SS.S\S\\\\	4      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       G/var/www/html/env/lib/python3.13/site-packages/aiohttp/pytest_plugin.py__call__AiohttpClient.__call__(   s
      ,/   c                   #    g 7fr#   r$   r%   s       r'   r(   r)   0   s
      ),r*   r$   )__name__
__module____qualname____firstlineno__r   r   r   r   strr   r   r   r(   r   r   __static_attributes__r$       r'   r   r   '   s    
 37	//  S#X/	/
 / 
G[(	)/ / 
 37	,,  S#X/	,
 , 
K%	&, ,r2   r   c            
       B    \ rS rSrSS.S\S\\   S\S\\	   4S jjr
S	rg)
AiohttpServer:   Nportappr7   r    r!   c                    g r#   r$   )r&   r8   r7   r    s       r'   r(   AiohttpServer.__call__;   s     #r2   r$   )r,   r-   r.   r/   r   r   intr   r   r   r(   r1   r$   r2   r'   r4   r4   :   s8    9=$$)1#$IL$	:	$ $r2   r4   c            
       B    \ rS rSrSS.S\S\\   S\S\\	   4S jjr
S	rg)
AiohttpRawServer@   Nr6   handlerr7   r    r!   c                    g r#   r$   )r&   r?   r7   r    s       r'   r(   AiohttpRawServer.__call__A   s    #&r2   r$   )r,   r-   r.   r/   r   r   r;   r   r   r   r(   r1   r$   r2   r'   r=   r=   @   s8    AE'&'19#'QT'	=	!' 'r2   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_addoptionrM   F   sc    
9	   B	   %+	  r2   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rO   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      $ )NrO   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addfinalizerrT   rU   )	argsr    rO   rY   rW   rX   funcis_async_genstrip_requests	       @@r'   wrapper%pytest_fixture_setup.<locals>.wrapperq   s    #y!
 ---6 
 ''/ ''C   +++CMMO<<++D$,A&,ABBr2   )r`   inspectisasyncgenfunctioniscoroutinefunctionargnames)
fixturedefrc   r`   ra   rb   s     @@@r'   pytest_fixture_setuprj   [   sv    
 ??D!!$''		$	$T	*	* 	M
+++|+C@ Or2   c                 8    U R                   R                  S5      $ )z--fast config optionrC   config	getoptionrP   s    r'   fastro      s     >>##$455r2   c                 8    U R                   R                  S5      $ )z!--enable-loop-debug config optionrJ   rl   rP   s    r'   
loop_debugrq      s     >>##$ABBr2   c            
   #   ~  #    [         R                  " SS9 n Sv   U  Vs/ s H(  nUR                  [        :X  d  M  SR	                  US9PM*     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)recordNz#{w.filename}:{w.lineno}:{w.message})wz{} Runtime Warning{},
{}r    s
)warningscatch_warningscategoryRuntimeWarningformatRuntimeErrorlenjoin)	_warningsrt   rws      r'   _runtime_warning_contextr      s      
	 	 	- 
zz^+ >18818= 	 

 +22G3r7a<RS$))B-   
.	-
 
.	-s3   B=	B,B'B'AB,	B='B,,
B:6B=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.
ro   N)r   r   )rR   ro   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)funcnamefilterre   rg   list_genfunctions)	collectornameobjs      r'   pytest_pycollect_makeitemr      sB    %%'*E*Ec*J*JI++D677 +K%r2   c           	      B   U R                   R                  S5      n[        R                  " U R                  5      (       a  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.rC   proactor_looprR   Nr   Tr$   )rm   rn   re   rg   functionfuncargsgetr   r   _fixtureinforh   rT   r   )
pyfuncitemro   existing_looprW   argtestargss         r'   pytest_pyfunc_callr      s   &&'78D"":#6#677"++//
 3  $$VT2 	 &'*=D  *66??? ,,S11?   (()C()CD E (  8 ED (' s6   	
DC?,C:#C?(D:C??
D		D
D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_factoryrI   uvloopallzpyloop,uvloop?,?z ?zUnknown loop 'z', available loops: )ids)r[   rm   optionaiohttp_loopasyncioDefaultEventLoopPolicyr   EventLoopPolicysplitendswithstrip
ValueErrorr   keysparametrizevalues)metafuncloopsavail_factories	factoriesr   requireds         r'   pytest_generate_testsr      s   X222OO""//E!?!?@O$*$:$:!~ IC }}S))zz$& T).."235 
 )/	 ! Y--/0d9>>;K6L  r2   c              #      #    U " 5       n[         R                  " U5        [        U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_event_loop_policyr   	set_debugset_event_loop)r   ro   rq   policyrW   s        r'   rR   rR     sS      ^F!!&)	4	 EOOD!u%	 
!	 	 s   'A63A%	A6%
A3/A6c               #      #    [         R                  " 5       n [         R                  " U 5        [        U R                  5       n[         R
                  " U5        Uv   S S S 5        g ! , (       d  f       g = f7fr#   )r   WindowsProactorEventLoopPolicyr   r   new_event_loopr   )r   rW   s     r'   r   r     sO     335F!!&)	f++	,u% 
-	,	,s   AA8A'	A8'
A51A8aiohttp_unused_portr!   c                 :    [         R                  " S[        SS9  U $ )Nz3Deprecated, use aiohttp_unused_port fixture instead   
stacklevelrx   warnDeprecationWarning)r   s    r'   r   r     s    MM=
 r2   c                      [         $ )z1Return a port that is unused on the current host.)_unused_portr$   r2   r'   r   r   !  s
     r2   rR   c           	   #      ^ ^#    / m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)
Nr6   r8   r7   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Nr6   rR   r$   )r   start_serverappend)r8   r7   r    serverrR   serverss       r'   goaiohttp_server.<locals>.go/  sD      C+!!6t6v666v 	7   !><>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>.finalize9  +     ++-%%''' g'   )><>>r!   N)r   r   r;   r   r   rT   rR   r   r   r   s   `  @r'   aiohttp_serverr   '  s^      G 48#+C=CF	  H( 	HJ'   AAc                 :    [         R                  " S[        SS9  U $ )Nz.Deprecated, use aiohttp_server fixture insteadr   r   r   )r   s    r'   test_serverr   @      MM8
 r2   c           	   #      ^ ^#    / m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)
Nr6   r?   r7   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r   )r   r   r   )r?   r7   r    r   rR   r   s       r'   r   aiohttp_raw_server.<locals>.goR  sD      w2!!6t6v666v 	7r   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   r   r;   r   r   rT   r   s   `  @r'   aiohttp_raw_serverr   J  s_      G <@ +3C=KN	  H( 	HJ'r   c                 :    [         R                  " S[        SS9  U $ )Nz2Deprecated, use aiohttp_raw_server fixture insteadr   r   r   )r   s    r'   raw_test_serverr   c  s!     MM<
 r2   c              #   .  ^ ^#    / m[         SS.S[        S[        [        [        [
        4      S[
        S[        [        [        4   4S jj5       n[         SS.S[        S[        [        [        [
        4      S[
        S[        [        S4   4S jj5       nSS.S[        [        [        4   S	[
        S[        [        [        [
        4      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>.goy  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 emptyrR   zUnknown argument type: %r)

isinstancer   r   r   r   r   r   typer   r   )r   r   r_   r    r   clientclientsrR   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   r0   r   r   r   r   r   r   rT   )rR   r   r   r   s   `  @r'   aiohttp_clientr   o  s2     G 37//  S#X// 	/
 
G[(	)/ /  37,,  S#X/, 	,
 
K%	&, , 37{N23  S#X/ 	
 
CH	 6 H( 	HJ's   DDc                 :    [         R                  " S[        SS9  U $ )Nz.Deprecated, use aiohttp_client fixture insteadr   r   r   )r   s    r'   test_clientr     r   r2   )F);r   
contextlibre   rx   typingr   r   r   r   r   r   r	   r
   r   r   pytest
test_utilsr   r   r   r   r   r   r   r   r   webr   r   r   web_protocolr   r   ImportErrorr   r4   r=   rM   rj   fixturero   rq   contextmanagerr   r   r   r   r   rR   r   r;   r   AbstractEventLoopr   r   r   r   r   r   r$   r2   r'   <module>r      sp         	 	 	 3 2 )
,H ,&$H $'x '*6r 6 6
 C C
  . , , 8$@     Xb#g%6 8BG;L   Xb#g.  
 (22 (x7N ( (0   (W66 (8DT;U ( (0   :(22 :(x7N :( :(z  W  Fs   G G#"G#