F,`ddlZddlZddlZddlmZmZmZmZmZm Z m Z m Z ddl Z ddl mZddlmZddlmZmZmZmZmZmZmZmZ ddlZn #e$rdZYnwxYwee eefgeefZeegeefZeegeefZdZ dZ!e j"d Z#e j"d Z$ej%d Z&ej%dd Z'dZ(dZ)dZ*e j"dZ+e j"dZ,e j"dege-fdege-ffdZe j"dege-ffdZ.e j"dej/deefdZ0e j"dZ1e j"dej/deefdZ2e j"dZ3e j"dej/deefdZ4e j"dZ5dS)N)Any AwaitableCallableDictIteratorOptionalTypeUnion)isasyncgenfunction) Application)BaseTestServer RawTestServer TestClient TestServer loop_contextsetup_test_loopteardown_test_loop unused_portc|dddd|dddd |d ddd dS) N--aiohttp-fast store_trueFz*run tests faster by disabling extra checks)actiondefaulthelpz--aiohttp-loopstorepyloopz3run tests with specific loop: pyloop, uvloop or all--aiohttp-enable-loop-debugzenable event loop debug mode) addoption)parsers /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/aiohttp/pytest_plugin.pypytest_addoptionr" s  9    B   % + c|jtrdntjrdndSdd|jvr|xjdz c_dfd}||_dS)zjSet up pytest fixture. Allow fixtures to be coroutines. Run coroutine fixtures in an event loop. TFNrequestr%cJ|d}r|d=d|jvrtd|drJ|i|fd}||S|i|S)Nr%loopz^Asynchronous fixtures must depend on the 'loop' fixture or be used in tests depending from it.cv S#t$rYdSwxYwN)run_until_complete __anext__StopAsyncIteration)_loopgensr! finalizerz8pytest_fixture_setup..wrapper..finalizer`sF 33CMMOODDD)DDs &* 88) fixturenames Exceptiongetfixturevalue addfinalizerr+r,) argskwargsr%r0r.r/func is_async_gen strip_requests @@r!wrapperz%pytest_fixture_setup..wrapperKs#  "y! - - -6  ''//  C$'''C         + + +++CMMOO<< <++DD$,A&,A,ABB Br#)r7r asyncioiscoroutinefunctionargnames) fixturedefr:r7r8r9s @@@r!pytest_fixture_setupr?5s ?D$  $T * *  M +++|+ CCCCCCC@JOOOr#c6|jdS)z--fast config optionrconfig getoptionr&s r!fastrDns > # #$4 5 55r#c6|jdS)z!--enable-loop-debug config optionrrAr&s r! loop_debugrFts > # #$A B BBr#c #>Ktjd5}dVd|D}|rYtdt |t |dkrdndd | ddddS#1swxYwYdS) 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)recordNcZg|](}|jtkd|)S)z#{w.filename}:{w.lineno}:{w.message})w)categoryRuntimeWarningformat).0rJs r! z,_runtime_warning_context..s@   z^++ 2 8 81 8 = =+++r#z{} Runtime Warning{}, {}r s )warningscatch_warnings RuntimeErrorrMlenjoin) _warningsrws r!_runtime_warning_contextrZzs   - - -         +22GG3r77a<z&pytest_pyfunc_call..s3,S1r#Tri) rBrCr;r<functionrjgetrZr] _fixtureinfor=r+rd)rlrD existing_loopr.testargss` r!pytest_pyfunc_callrss   & &'7 8 8D":#677 "+//   3  $ $VT 2 2 & ' ' E E*=tDDD E)6?(()C)C()C)CDDD  E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Et  s68C& 9C C&C C&C C&&C*-C*c Xd|jvrdS|jjj}dtji}t t j|d<|dkrd}i}|dD]s}| d }| d}||vr7|r4td |d t| h||||<t|dt|t|  dS) N loop_factoryruvloopallzpyloop,uvloop?,?z ?zUnknown loop 'z', available loops: )ids)r1rBoption aiohttp_loopr;DefaultEventLoopPolicyrvEventLoopPolicysplitendswithstrip ValueErrorr`keys parametrizevalues)metafuncloopsavail_factories factoriesrcrequireds r!pytest_generate_testsrsHX222 O " /E!?@O $*$:! ~~ I C  0 0}}S)))zz$  & &  jttT).."2"23335 )$/ $ Y--//00d9>>;K;K6L6Lr#c#K|}tj|t|5}|r|dtj||VddddS#1swxYwYdS)z%Return an instance of the event loop.r\TN)r;set_event_loop_policyr set_debugset_event_loop)rurDrFpolicyr.s r!r(r(s\^^F !&))) 4 E  " OOD ! ! !u%%% s0A..A25A2c#Ktj}tj|t|j5}tj||VddddS#1swxYwYdSr*)r;WindowsProactorEventLoopPolicyrrnew_event_loopr)rr.s r!rgrgs  3 5 5F !&))) f+ , ,u%%% sA$$A(+A(aiohttp_unused_portreturnc>tjdtd|S)Nz3Deprecated, use aiohttp_unused_port fixture instead stacklevelrSwarnDeprecationWarning)rs r!rrs, M= r#ctS)z1Return a port that is unused on the current host.) _unused_portrir#r!rrs  r#r(c#rKgddfd }|Vdfd }|dS)z^Factory to create a TestServer instance, given an app. aiohttp_server(app, **kwargs) NportcKt||}|jddi|d{V||SNrr(ri)r start_serverappend)apprr6serverr(serverss r!gozaiohttp_server..go s`Cd+++!f!66t6v666666666v r#rcpKr0d{V.dSdSr*popclosersr!finalizez aiohttp_server..finalizeY (++--%%'' ' ' ' ' ' ' ' ( ( ( ( (r#rNr+r(rrrs` @r!aiohttp_serverrs G" HHH(((((( HHJJ'''''r#c>tjdtd|S)Nz.Deprecated, use aiohttp_server fixture insteadrrr)rs r! test_serverr, M8 r#c#rKgddfd }|Vdfd }|dS)zpFactory to create a RawTestServer instance, given a web handler. aiohttp_raw_server(handler, **kwargs) NrcKt||}|jddi|d{V||Sr)rrr)handlerrr6rr(rs r!rzaiohttp_raw_server..go*s`wT222!f!66t6v666666666v r#rcpKr0d{V.dSdSr*rrsr!rz$aiohttp_raw_server..finalize2rr#rrrs` @r!aiohttp_raw_serverr"s G"& HHH(((((( HHJJ'''''r#c>tjdtd|S)Nz2Deprecated, use aiohttp_raw_server fixture insteadrrr)rs r!raw_test_serverr9s. M< r#c #Kgdddtttfdtdtt t tfdtdtf fd}|Vd fd }|dS) zFactory to create a TestClient instance. aiohttp_client(app, **kwargs) aiohttp_client(server, **kwargs) aiohttp_client(raw_server, **kwargs) N) server_kwargs__paramr5rr6rcKt|tr+t|ttfs|g|Ri|}i}n |r Jdt|tr#|pi}t |fdi|}t |fdi|}nDt|trt |fdi|}nt dt|z|d{V ||S)Nzargs should be emptyr(zUnknown argument type: %r) isinstancerr rrrrtyperr)rrr5r6rclientclientsr(s r!rzaiohttp_client..goQsI gx ( ( 4 k>22 2  4gd4T444V44GFF 3 33 3 38 g{ + + J)/RMDDdDmDDF<.finalizeorr#r) r r rrrrstrrr+)r(rrrs` @r!aiohttp_clientrEsG 37{N23 S#X/   8 HHH(((((( HHJJ'''''r#c>tjdtd|S)Nz.Deprecated, use aiohttp_client fixture insteadrrr)rs r! test_clientrvrr#)F)6r; contextlibrStypingrrrrrrr r pytestaiohttp.helpersr aiohttp.webr test_utilsrrrrrrrrrrv ImportError AiohttpClientAiohttpRawServer AiohttpServerr"r?fixturerDrFcontextmanagerrZr]rersrr(rgintrAbstractEventLooprrrrrrrir#r!rsRRRRRRRRRRRRRRRRRRRR ......######                    MMMM FFF% ^ ;<=y?TTU 9]+CCD+ *(==> *666r666 CCC  .  , , , , 888 $@Xb#g%68BG;LXb#g. (2(x 7N((((,(W6(8DT;U((((,-(  #-( m-(-(-(-(`sA AA