Xj)5rUddlmZddlZddlZddlZddlmZmZmZddl m Z m Z ddl m Z mZmZddlmZmZddlZddlmZmZddlmZdd lmZdd lmZd d lmZd d lm Z m!Z!m"Z"m#Z#d dl$m%Z%d dl&m'Z'ejPdkrddl)m*Z*da+de,d<da-de,d<da.d.dZ/e d/dZ0d0dZ1d1dZ2ejfdd2dZ4ejfd d3dZ5d4d Z6ejfdd5d!Z7ejpd"e#d6d$Z9ejpd7d%Z:ejpd8d&Z;Gd'd(Z<ejpd)d9d*Z=ejpd)d9d+Z>ejpd:d,Z?ejpd;d-Z@y)<) annotationsN)Callable GeneratorIterator) ExitStackcontextmanager)isasyncgenfunctioniscoroutinefunctionismethod)Anycast)FuncFixtureInfo SubRequest)Exit) CallSpec2)Scope)get_available_backends)current_async_libraryget_async_backendreset_current_async_libraryset_current_async_library)iterate_exceptions) TestRunner) )ExceptionGroupzTestRunner | None_current_runnerzExitStack | None _runner_stackct|tr|ifSt|tr^t|dk(rPt|dtr=t|dtr*t ttttt ff|Std)Nrrz@anyio_backend must be either a string or tuple of (string, dict)) isinstancestrtuplelendictr r TypeError)backends g/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/anyio/pytest_plugin.pyextract_backend_and_optionsr*#sq'3{ GU #G (9 gaj# &:gaj$+Gc4S>12G< < V WWc#Ktnt|}tat %t |}tj t||xsi}tj|j|atdz a ttdza ts!tJtjdxaayy#tdza ts!tJtjdxaawwxYwwNr) rrrrrrcallbackr enter_contextcreate_test_runner_runner_leasesclose) backend_namebackend_optionsasynclibtokens r) get_runnerr7-s $\2! " *.l;E  " "#> F)/R'55  ' ' 8 aN3! , ,,    !.2 2MO ! , ,,    !.2 2MOsA>C/B: 1C/:2C,,C/c,|jdddy)N anyio_modestrictz-AnyIO plugin mode (either "strict" or "auto"))defaulthelp)addini)parsers r)pytest_addoptionr?Ks MM <r+c|jdd|jddk(rW|jjdr;|jddk(r&|j t j ddyyyy) NmarkerszManyio: mark the (coroutine function) test to be run asynchronously via anyio.r9autoasyncio asyncio_modezlAnyIO auto mode has been enabled together with pytest-asyncio auto mode. This may cause unexpected behavior.r)addinivalue_linegetini pluginmanager has_pluginissue_config_time_warningpytestPytestConfigWarning)configs r)pytest_configurerMSs W  l#v-  + +I 6 MM. )V 3((  & &<     4 7 .r+T) hookwrapperc#Kdfd }|jts tr~d|jvrp||_|j}d|jvxs|xjdz c_d|jvxs|xjdz c_ d|_||_SdS#|_||_wxYww)N anyio_backendrequestc;K|jr[trPtjt|jur&jj |j}n}t |\}}r||d< r||d<t||5}|jr tdt|r|j||Ed{n|j||dddy7"#1swYyxYww)NrPrQzCannot schedule a coroutine in the test runner while another is already running; likely caused by request.getfixturevalue() on an async fixture.) instancer type__self____func____get__r*r7 is_running RuntimeErrorr run_asyncgen_fixture run_fixture) rPrQkwargs local_funcr3r4runnerfunchas_backend_arghas_request_args r)wrapperz%pytest_fixture_setup..wrapperhs   T]]#tG,<,<'==..w/?/?@JJ(CM(R% o &3F? #  'F9   o 6 =&  ""V "*-!66z6JJJ((V<z,pytest_pycollect_makeitem..sH&v{{g-HsrP) istestfunctionhasattrrm inner_testr rLrFget_closest_markergetattranyrJmark usefixtures) collectorrrobj inner_funcanyio_auto_modert own_markerss r)pytest_pycollect_makeitemrsT*29#|2LS^^..RU z *'..55lCvMO11':F!#|R8KHKHH ''8=I ++r+sessionc Pttt|jD]\}}t |t j s"t|js8|jdJd|jvsYg} tjtDchc]}|j}}tt#D](\}}d|vr&td|id|idt$j&i|gg}n&tid|id|idt$j&i|gg}|j(} t| j*} d| vr| j-dt/| j0| j2| | j4} t j j7|j8|j:d|d||j<| |j>|j: } |j-| +||j||d zycc}w#t$rt!}YpwxYw) NrnrP _arg2scope)paramsindicesr_idlistmarks)funcargsrr arg2scopeidlistr)rg initialnames names_closurename2fixturedefs[])rrcallspeccallobj fixtureinfokeywords originalnamer) reversedlist enumerateitemsr"rJFunctionr functionryrf dataclassesfieldsrrrr'setrrModule _fixtureinforappendrrgrr from_parentparentrrr) riitem new_itemsf cs_fields param_indexr(rfinew_names_closurenew_fixtureinfonew_items r)pytest_collection_finishrs D7==!9:;614 tV__ -#DMM2''0<t'8'88I "-8-?-? -JKQVVK K)22H2J(K' +$ W9,( /9!0+ >$3U\\#B!(   H )!# /9!0+ >#2ELL"A 'y  H&&$()9)9$:!"*;;%,,_="1[[!#"3%'%8%8 # "??66KK --.ay:% HH /!]]!%!2!27  *O' +R(1GMM!a!e $m61L "E  "s$HH 2H HH%$H%c  d fd }|jjd}|rt|\ t|jdr`|jj j j|jk7r&t r||jj _yt|jrg|j}|jjDcic]}||| }}t 5} |j|j| dddyycc}w#t$r4}t|D] }t|t t"t$fs||d}~wwxYw#1swYyxYw)Nclt5}|j|dddy#1swYyxYwN)r7run_test)r\r^r3r4 original_funcs r)run_with_hypothesisz/pytest_pyfunc_call..run_with_hypothesiss2  o 6 3& OOM6 2 3 3 3s*3rPrmT)r\r reNone)rgetr*rwrrmrx __qualname__r rrgr7rrrr"rKeyboardInterrupt SystemExit) pyfuncitemrr(rargtestargsr^excgrpexcr3r4rs @@@r)pytest_pyfunc_callrsQ3!!%%o6G(CG(L% o :>>< 0&NN55@@M))-@-M-MM&}5;NJNN--8 z~~ .!**H6@6M6M6V6VWsXc]*WHWL/: fOOJNNH=  X&1&92%cD2CZ+PQ"%612  s6' D+E0D00 E-9)E(#E((E--E00E9module)scoperc|jSr)paramrds r)rPrPs ==r+c0t|tr|S|dS)Nrr"r#rcs r)anyio_backend_namers-%Qr+c0t|triS|dSr-rrcs r)anyio_backend_optionsr!s-% Qr+c4eZdZdZddZeddZdd dZy) FreePortFactoryaO Manages port generation based on specified socket kind, ensuring no duplicate ports are generated. This class provides functionality for generating available free ports on the system. It is initialized with a specific socket kind and can generate ports for given address families while avoiding reuse of previously generated ports. Users should not instantiate this class directly, but use the ``free_tcp_port_factory`` and ``free_udp_port_factory`` fixtures instead. For simple uses cases, ``free_tcp_port`` and ``free_udp_port`` can be used instead. c>||_tt|_yr)_kindrint _generated)selfkinds r)__init__zFreePortFactory.__init__7s c(*r+c|jS)z The type of socket connection (e.g., :data:`~socket.SOCK_STREAM` or :data:`~socket.SOCK_DGRAM`) used to bind for checking port availability )r)rs r)rzFreePortFactory.kind;szzr+NcJ||g}n@tjg}tjr|jtj d}t 5}|D]r}|j tj||j}|tjk(rdnd} |j||f|r`|jd}t||jvr&|jj||cdddSddd#t$rYwxYw#1swYxYw)z Return an unbound port for the given address family. :param family: if omitted, both IPv4 and IPv6 addresses will be tried :return: a port number Nrz::1z 127.0.0.1r) socketAF_INEThas_ipv6rAF_INET6rr/rbindOSError getsocknameradd)rfamilyfamiliesportstacksockaddrs r)__call__zFreePortFactory.__call__Ds   xH'H0D $& $F ..v}}VTZZ/PQD$*foo$=5;D 4,/ #//1!4 $4??2++D1# $ $ $#  $ $s7A D!D 4D7?D DDDDD")rsocket.SocketKindrer)rerr)rzsocket.AddressFamily | Nonerer)__name__ __module__r__doc__rpropertyrrrpr+r)rr)s% %$r+r)rc4ttjSr)rr SOCK_STREAMrpr+r)free_tcp_port_factoryrfs 6-- ..r+c4ttjSr)rr SOCK_DGRAMrpr+r)free_udp_port_factoryrks 6,, --r+c|Srrp)rs r) free_tcp_portrp ""r+c|Srrp)rs r) free_udp_portrurr+)r(objectreztuple[str, dict[str, Any]])r3r#r4dict[str, Any]rezIterator[TestRunner])r>z pytest.Parserrer)rLz pytest.Configrer)rhr rQr rezGenerator[Any])r~zpytest.Module | pytest.Classrrr#rrrer)rzpytest.Sessionrer)rr rez bool | None)rQr rer )rPr rer#)rPr rer)rer)rCallable[[], int]rer)rrrer)A __future__rrrsyscollections.abcrrr contextlibrrinspectr r r typingr r rJ_pytest.fixturesrr_pytest.outcomesr_pytest.pythonr _pytest.scoperr_core._eventlooprrrr_core._exceptionsrabcr version_infoexceptiongrouprr__annotations__rr1r*r7r?rMhookimplrjrrrfixturerPrrrrrrrrpr+r)r s" 990EE 8!$$ 2g-%)")"& &X33(6333: &T"9#9x$>+>36>=C> > >"71t$! !Hh'='?@A    :$:$zi /!/i .!.####r+