L ilddlmZddlZddlZddlmZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlZddlZ e sddlZdZd&dZd aej.d d Zd ZdZdZdZdZGddZdZdZ dZ!d'dZ"dZ#da$dZ%ejLd dZ'dZ(da)dZ*ej.dd Z+ej.d!d"Z,d#Z-Gd$d%ej\Z/y#e$r ddlmZYwxYw)() annotationsN)update_wrapper) TYPE_CHECKING) plugin_basec\|jdfd}tj|y)N sqlalchemyc|jddr Gfddtj}||d<|jddr Gfddtj}||d<j|fi|y)NcallbackceZdZ dfd Zy)=pytest_addoption..make_option..CallableActionNc|||yN)selfparser namespacevalues option_string callback_s l/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/testing/plugin/pytestplugin.py__call__zFpytest_addoption..make_option..CallableAction.__call__*smVV<r)__name__ __module__ __qualname__r)rsrCallableActionr )s CG=rractionzeroarg_callbackc6eZdZ dfd Z dfd ZxZS)r c 2t|||dd|||y)NrT)option_stringsdestnargsconstdefaultrequiredhelp)super__init__)rr"r#r&r'r( __class__s rr*zFpytest_addoption..make_option..CallableAction.__init__5s,G$'5!" '!)!%rc|||yrr)rrrrrrs rrzFpytest_addoption..make_option..CallableAction.__call__Gs%]FFCr)FFNr)rrrr*r __classcell__)r+rs@rrz=pytest_addoption..make_option..CallableAction4s& "" &DHDDr)popargparseAction addoption)namekwrrrgroups @@r make_optionz%pytest_addoption..make_option%svFF:t,  = = *BxL66"4d;  D D0*BxL##r)getgroupr setup_options)rr5r4s @rpytest_addoptionr8"s' OOL )E)$Vk*rc tj|jtjstjrdj t tjtjDcgc]}d| c}z}|jjr#|jxjd|z c_n||j_|jjdr#|jjtt|drBtj|jtj |jdnr|jj"r\t$j&j)|jj"r)t%j*|jj"tj,|jtj.t1t3|jddtj4t6|jj8rdayycc}w) Nz and znot xdist workerinputfollower_ident cov_sourceFT)r read_configrootpath exclude_tags include_tagsjoinlistoptionmarkexpr pluginmanager haspluginregister XDistHookshasattr!restore_important_follower_configr;configure_follower write_identsospathexistsremove pre_beginset_coverage_flagboolgetattrset_fixture_functionsPytestFixtureFunctionsdump_pyannotateDUMP_PYANNOTATE)configtagnew_exprs rpytest_configurer]SsFOO,;#;#;<< )) *'2'?'?@cU|@ A  == ! ! MM " "hZ&8 8 "%-FMM " %%g.%%jl3v}%55f6H6HI&&v'9'9:J'KL == % %"''.. MM & &+  IIfmm00 1&--(!! WV]]L% 89%%&<= }}$$%9As5 I FT)autousec#zKtrddlm}|jdtrj yyw)Nr collect_types)rYpyannotate_runtimerastartstopr`s rcollect_types_fixturere|s/4 s9;cddl}ddlm}ddlm}ddlm}d}t jjrdnd}d|d |d d |jg}|r&dd l m }|jd |jdn|jd||jjjd} | r+| j!d||D]} | j#| yt%d|d|D] } t%| y)Nr) __version__)has_compiled_ext)_CYEXTENSION_MSGzsqlalchemy installationz no user sitezuser site loadedz SQLAlchemy z ()zPath: )utilz!compiled extension enabled, e.g.  z compiled extension not enabled; terminalreporter=z=========================)r rgsqlalchemy.utilrhsqlalchemy.util._has_cyrisysflags no_user_site__file__sqlalchemy.cyextensionrkappendrZrF get_plugin write_sep write_lineprint) sessionr rgrhrigreetsitemsgsrkpmms r_log_sqlalchemy_infors&08 %E YY33>9KD k]"TF!, $$%& D / 7 aHI 67G6HIJ  % % 0 01C DB  S%  A MM!   hx( A !H rcdddlm}t||jtj yNrasyncio)sqlalchemy.testingrr _assume_asyncr post_begin)r{rs rpytest_sessionstartrs!*! +001rcddlm}|jtj|j j jr6ddlm }|j|j j jyy)Nrrr`) rr_maybe_async_provisioningrfinal_process_cleanuprZrDrXrbra dump_stats)r{rras rpytest_sessionfinishrsR* %%k&G&GH~~,,4  !6!6!F!FG-rc0ddlm}|jyr)rr _shutdown)rZrs rpytest_unconfigurers* rc|jjjr=ddlm}t j jdfd}|j|yy)Nrr`lib/sqlalchemyctjjtjj|}dtjj |gvryd|vry|S)Nrtesting)rNrOnormpathabspath commonpath)filenamelib_sqlalchemys r_filterz)pytest_collection_finish.._filtersZww''(ABHrww'9'9>*(H$Or)filter_filename) rZrDrXrbrarNrOrinit_types_collection)r{rarrs @rpytest_collection_finishrsI~~,,4)9:  ++G+D!-rceZdZdZdZy)rIcddlm}ddlm}tj|j dt jjddz|j d<|j|j|j dy)Nr provisionrztest_%s r<) rrrr!memoize_important_follower_configr;uuiduuid4hexrcreate_follower_db)rnoderrs rpytest_configure_nodez XDistHooks.pytest_configure_nodesl0. 55d6F6FG-69I9I!B9O-O)*))  ( ($*:*:;K*L rcnddlm}ddlm}|j|j|j dy)Nrrrr<)rrrrdrop_follower_dbr;)rrerrorrrs rpytest_testnodedownzXDistHooks.pytest_testnodedowns-0.))  & &(8(89I(J rN)rrrrrrrrrIrIs    rrIcx ddlm}tjd |Dcgc][}|j t j :|j t j jjds|]c}|dd|Dchc]!}|j t j #c} fd fd}|j|g}|D]E}|j}| vr"|j ||j5|j|Gt|d|ddycc}wcc}w) Nrrc4tjtSr) collections defaultdictrCrrrz/pytest_collection_modifyitems..s ''-r_c3K|jD]1}t|tjr|Ed{.|3y7 wr)collect isinstancepytest Collector)element inst_or_fnrs rrz.pytest_collection_modifyitems..collectsD!//+ !J*f&6&67":...   !.s9A A  A chD]}t|jddst|jddrdh}n%t|jddrdh}n t}|jDchc]}|j}}||z }|j |}|D]}|j |ttj|j|j|}|s |j|D]}||jus |j}|jtj} tjj|j | } |D]}| j | | D] } || jj#| "ycc}w)N __backend__F __only_on__backend__sparse_backend__sparse_backendr2parent)rUcls frozenset iter_markersr2union add_markerrCrgenerate_sub_testsmodule getparentrModuleClass from_parentrrv) test_class add_markersmarkexisting_markers all_markersmarker sub_testssub_cls per_cls_dictrnew_clsfnr rebuilt_items test_classess rsetup_test_classesz9pytest_collection_modifyitems..setup_test_classes s&* 9Jz~~}e< uA )k )=uE/0 'k '1&=&=&? "    &(88K*00=K% .%%f- ...NNJ$5$5{I jnn-$ 9*..0#0#@L'11&--@F$ll66$--f7G#.3**623&g.9$RWW-44R89 9;* 9 s1F/c|jtjj|jtjj|jfSr)rrrr2r)items rrz/pytest_collection_modifyitems..Js< NN6== ) . . NN6<< ( - - II r)key)rrrrrrrr2 startswithrrextendrvsorted) r{rZitemsrrrnewitemscls_rrrs @@@rpytest_collection_modifyitemsrs+++-M   >>&,, ' 3v||,11<CCTDNN6<<0CL!+9^ %%&89H"xx = OOM$/ : ; OOD ! " E!HWDs A D2&D7ctj|rtj||rjddlm}|j r t|}t|j|Dcgc]-}tjj|j|/c}Stj|r-|j!tj |j|rygScc}w)NrrZr)inspectisclassr want_classrrZ any_async_apply_maybe_async_parametrize_clsrrrrr isfunctionr want_method) collectorr2objrZparametrize_clss rpytest_pycollect_makeitemrRss 6 6tS A-   $S)C $4I4D4Dc#J    LL $ $$--i %    3 MM %  # #IMM3 7 ! s!2Ccvt|dr|j}t|drtj|S)N __wrapped__)rJrriscoroutinefunction)rs r_is_wrapped_coroutine_functionrls4 "m $ ^^ "m $  & &r **rcddlmt|jD]\}}t |st |t s"t|ddr0|jdsBt|rNd}t |t r|j}d}tfd}||}|r t |}d|_ t||||r.|jddD]}|tk7s t!|d|S) Nrr_maybe_async_appliedFtest_Tc0j|g|i|Sr) _maybe_asyncrargskwargsrs r make_asyncz&_apply_maybe_async..make_asyncs +w++B@@@@rr)rrvarsrcallabler classmethodrUrr__func___pytest_fn_decoratorrsetattrmroobjectr) rrecurser2valueis_classmethodrdo_asyncrrs @rrrss*Cy() e e_ 5+ >E#95A)259"N%-!% ! A" A"%(H&x0,0H ) Cx (+),779QR= /Cf}"3. / JrcPd|jvr|gS|j}g}tj|Dcgc]\}}| c}}D]}i}t |Dcgc]}|d c}|D]K\}} |s t dt jd|} t | | jD] \} } | || < Mdjd|D} |jd| }tjt||f|}t||||j||Scc}}wcc}w)z6implement a class-based version of pytest parametrize._sa_parametrizerz*need argnames for class-based combinationsz,\s*rc3K|];}|jjdD]}tjdd|=yw)-z\WN)idsplitresub).0paramtokens r z#_parametrize_cls..sG% ,%  FF5"e $% $% sAA)__dict__r itertoolsproductzip TypeErrorrrrrBrtype__new__rrv)rrrclassesargnameparamsfull_param_set cls_variables _sa_paramr argname_splitargvalparametrized_namer2newclss rrrs= ,u ))OG#++(7 8_Wf& 8 !+: ;iYq\ ;^  )NGU LMMHHWg6M u||< )S%( c" )  ) HH% '%   ,,(9:dD3&-@f%v+, N+ 9 A #  - -<ddlmddlmddfd }|S)z:Port of langhelpers.decorator with pytest-specific tricks.r)format_argspec_plus)inspect_getfullargspecc$t||||Sr)exec)codeenvfn_names r_exec_code_in_envz/_pytest_fn_decorator.._exec_code_in_envns T37|rc|}|r|jj|tdd|j}|j |dd|z}| |d|j}|s/t |d|j |_||_t||S|j|_ |j|_t|d r|j|_ |S) N __target_fn __orig_fn)rdrer2F)groupedzVdef %(name)s%(grouped_args)s: return %(__target_fn)s(%(__orig_fn)s, %(apply_kw)s) )rdrer pytestmark) rrdictrupdaterU __defaults__rrrrJrg) radd_positional_parametersspecmetadatar_ decoratedrbr[r\targets rdecoratez&_pytest_fn_decorator..decoratevs%b) $ II  6 7%2;;  +D%@A    & &r:BKK )%,RR%@%M%MI "$&I !!)R0 0 $&==I !#I r<(')}} $ r)r)sqlalchemy.util.langhelpersr[sqlalchemy.util.compatr\)rorprbr[r\s` @@@rrrhs#@=B OrcXeZdZdZedZdZdeeddZ dZ dZ d Z d Z d Zy ) rWc@tjj|i|Sr)rskipr8)rr)r3s rskip_test_exceptionz*PytestFixtureFunctions.skip_test_exceptions{{$$c0R00rc"tjSr)rrrs r add_to_markerz$PytestFixtureFunctions.add_to_markers {{rcBtjjddS)NrPrY)rr usefixturesrxs rmark_base_test_classz+PytestFixtureFunctions.mark_base_test_classs{{&& !#7  rc|Srrrs rrzPytestFixtureFunctions.src\t|dr |jSt|jS)Nr)rJrr r~s rrzPytestFixtureFunctions.s)#C4CLL:>s):L:Lr)irsnc ddlmt|dk(rt|ddrt |d}|j ddfd}|j dd}g}d |r|j }tjdgt|Dcgc] \}}|d vr| c}}} t|Dcgc]#\}}||vrtj|||f%} }}|D][ttsf|\} } | | dd} | rd |j| | d jfd | Df]n=|D]8ttsf|\} } | rd |j| | df:g|D]4\} } }r| | fz } tj| d|i}j|6fd}|Scc}}wcc}}w)aFacade for pytest.mark.parametrize. Automatically derives argument names from the callable which in our case is always a method on a class with positional arguments. ids for parameter sets are derived using an optional template. r) exclusionsr__next__argnamesNcg}g}|D];}t|jr|j|+|j|=||fSr)rcompoundrv)rresultgathered_exclusionsars r_filter_exclusionsz?PytestFixtureFunctions.combinations.._filter_exclusionssUF"$  %a!4!45'..q1MM!$  % .. .rid_F)rrrrTrc3@K|]\}}||ywrr)rgettercomb_fnr)s rrz6PytestFixtureFunctions.combinations..s#!5DVWGF3K0!srctj|rAr tdd|jvrg|_|jj  f|Stj |jdd}|}ntjd}r6td|D}d|}||gz }tfd}|||f}tjj| |S) Nz5exclusions not supported for class level combinationsrrz, *c3DK|]}|jdsdyw) _exclusionsrN)r)rrs rrzHPytestFixtureFunctions.combinations..decorate.. s '1<< 3N's   _exclusions_cr|d}|r%jj|}||}||ddi|S)Nr5)radd)rrr3rexlurs rcheck_exclusionszOPytestFixtureFunctions.combinations..decorate..check_exclusions&sI&*2h &#<:#6#6#8#<#.decorates r"!-O%BKK7)+B&""))8]*CD &55b9>>qrB # ,I " :I!#&'#/'$L0-J*"8!99I)4*4*7M6OB{{..y-HLLr)rrlenrJrCr._combination_id_fnsoperator itemgetter enumeraterr=rvrBrr)rarg_setsr3rrtobuild_pytest_paramsridxchar _arg_getterfns fn_paramsparam_exclusions parametersrrpr)rrrrs @@@@@r combinationsz#PytestFixtureFunctions.combinationss2 2 x=A '(1+z"BHQK(H66*d+ /ffUD! " "&":":  #--&/s^!T33K"+3C..$$S)+>t+DEC   !#u-&C.@.E+ +(3AB7 #%)N%,,"(!HK! , !#u-&C.@.E+ +#%)N%,, 0$7  1F ( -J(#/11 LL*55E   '  ($ ML{ s G 6(G c<|d}tj|ddd|iS)Nrrr)rr)rridents r param_identz"PytestFixtureFunctions.param_ident6s%1 ||Z^666rcddlmddlmt|dkDrt |dr |d}|dd}nd}t j |i|fd}|r||S|S)NrrrrcRjrj|}|}|Sr)r_maybe_async_wrapper)rrrZfixtures rwrapz,PytestFixtureFunctions.fixture..wrapPs,11"5BIr)rrZrrrrr)rr)r3rrrrZrs @@@rrzPytestFixtureFunctions.fixture:si-. s8a.decoratees +G + +B @ @ @r)rrr)rrrprs @r async_testz!PytestFixtureFunctions.async_testbs&.  A  A|rN)rrrrvpropertyryr|reprr<rrrrrrrrrrWrWsT1    DL7#J5rrW)rZz pytest.Config)T)0 __future__rr/r functoolsrrrrrNrrqtypingrrrsqla_plugin_baser ImportErrorrr8r]rYrrerrrrrrIrrrrrr/r2hookimplr@rCr9rHrPrYrFixtureFunctionsrWrrrrsY#$  . .+b#L@2H E(  2cL4+@B6&T"2##2#j ! g ; ; j!51"51|/dO[99O{sC>> D  D