|oiOdZddlmZddlZddlZddlZejdkZer ddlZej Z nddl Zddl Z Gdde Z dadadadadadadadZdadadadadaeaeadadZdZ d Z!d Z"d Z#d Z$d Z%dZ&dZ'dZ(dZ)dZ*dZ+gZ,gZ-dZ.dZ/e.dZ0e.dZ1e.dZ2e/dZ3e/dZ4e/dZ5dZ6e/dZ7e/dZ8e/dZ9e/d Z:d!Z;d"Zd%Z?d&Z@d'ZAd(ZBd)ZCd*ZDd2d,ZEd-ZFd.ZGGd/d0e ZHdaId1ZJdS)3zTesting extensions. this module is designed to work as a testing-framework-agnostic library, created so that multiple test frameworks can be supported at once (mostly so that we can migrate to new ones). The current target is pytest. )absolute_importN)rceZdZejZdS)ABCN)__name__ __module__ __qualname__abcABCMeta __metaclass__y/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib64/python3.11/site-packages/sqlalchemy/testing/plugin/plugin_base.pyrr"s rrcr|dddtd|dddtd|dd dd d |d dtd|dd ddd |dddd|dddd|dddd|ddd |d!dd"d#|d$dd%d&'|d(dd)d*d+,|d-ddtd.|d/dd0d*d1,|d2dtdd34|d5dtdd64|d7dd8d*d9,|d:dd;d*d<,dS)=Nz --log-infocallbackstringz,turn on info logging for (multiple OK))actiontyperhelpz --log-debugz-turn on debug logging for (multiple OK)z--dbappenddbzBUse prefab database uri. Multiple OK, first one is run by default.)rrdestrz--dbszList available prefab dbs)rzeroarg_callbackrz--dburidburiz8Database uri. Multiple OK, first one is run by default.z --dropfirst store_true dropfirstz,Drop all tables in the target database first)rrrz--backend-only backend_onlyzUse a low number of distinct connections - i.e. for Oracle TNSz--write-idents write_identszCwrite out generated follower idents to , when -n is used)rrrz --reversetop reversetopFzTUse a random-ordering set implementation in the ORM (helps reveal dependency issues))rrdefaultrz--requirementsz3requirements class for testing, overrides setup.cfgz--with-cdecimalcdecimalzDMonkeypatch the cdecimal library into Python 'decimal' for all testsz --include-tagzInclude tests with tag )rrrrz --exclude-tagzExclude tests with tag z--write-profileswrite_profilesz$Write/update failing profiling data.z--force-write-profilesforce_write_profilesz,Unconditionally write/update profiling data.)_log _list_dbs_requirements_opt _include_tag _exclude_tag) make_options r setup_optionsr,;sK  ; K  < K  ' K" (  K   J K  ;  K  K  K  /  K! 9 K  K   K + K " B K  K  + K  + K  3 K  # ; rc ddlm}||_dS)zConfigure required state for a follower. This invokes in the parent process and typically includes database creation. r provisionN)sqlalchemy.testingr/FOLLOWER_IDENT)follower_identr/s rconfigure_followerr3s$-,,,,,-Irc*ttd|d<dS)aSStore important configuration we will need to send to a follower. This invokes in the parent process after normal config is set up. This is necessary as pytest seems to not be using forking, so we start with nothing in memory, *but* it isn't running our argparse callables, so we have to just copy all of that over.  include_tags exclude_tagsmemoized_configNr5dict_s r!memoize_important_follower_configr;s"%$  E rct|ddt|dddS)zfRestore important configuration needed by a follower. This invokes in the follower process. r8r6r7N)r6updater7r9s r!restore_important_follower_configr>sH/0@AAA/0@AAAAArcdtjatddgdS)Nz setup.cfgztest.cfg) configparser ConfigParser file_configreadr rr read_configrDs/+--Kk:./////rcJ|atD]}|ttdS)z7things to set up early, before coverage might be setup.N)options pre_configurerB)optfns r pre_beginrJs7G!! 7K    !!rc|t_dSN)rF has_coverage)values rset_coverage_flagrOs GrctD]}|ttddlmaddlmamamaddlm a m a m a ddlm a m a ddlmatdS)z9things to set up later, once we know coverage is running.rtesting)fixturesengines exclusions) assertionswarnings profiling)configr/)utilN)post_configurerFrB sqlalchemyrRr0rSrTrUrVrWrXrYr/rZ setup_filtersrIs r post_beginr_s!! 7K    #"""""@@@@@@@@@@BBBBBBBBBB44444444 rctsddlat|dr9t|tjdS|dr9t|tjdSdS)Nrz-infoz-debug)logging basicConfigendswith getLoggersetLevelINFODEBUGopt_strrNparsers rr&r&s   9%  ))',77777   ( # #9%  ))'-8888899rc tdttdD]0}t|ddtd|1t jddS)Nz0Available --db options (use --dburi to override)rz>20 r)printsortedrBrFgetsysexit)argsmacros rr'r'sv <=== ++D1122BB EEEE;??4#?#?#?@AAAAHQKKKKKrc$t|dSrL)_setup_requirementsrhs rr(r(srcbt|dddSN-_)r7addreplacerhs rr*r**U]]3,,-----rcbt|dddSrw)r6rzr{rhs rr)r)!r|rc:t||SrL)rGrr^s rprer)s Irc:t||SrL)r[rr^s rpostr.s" Irc |adSrLrFrHrBs r_setup_optionsr3s GGGrcL|jrtddSdS)Nmemory_intensive)rr7rzrs r _set_nomemoryr9s1 |-+,,,,,--rc>|jrddl}|tjd<dSdS)Nrdecimal)r#rpmodules)rFrBr#s r_monkeypatch_cdecimalr?s2*!) I**rc8ddlm}t|_dSNrrY)r0rY_fixture_fn_class_fixture_functions)rFrBrYs r _init_symbolsrGs()))))) 1 3 3Frcddlm}ddlm}ddlm}|jrt |j}ng}|jrt|jD]l}tj d|D]T}|| dvrtd|z| | d|Um|s)| | ddd|_|D]}|jrW|jrPt#|jd 5} | |jd z|zd zdddn #1swxYwY|||||j} |js| | |dS) NrrrQr.z[,\s]+rz:Unknown URI specifier '%s'. Specify --dbs for known uris.r"a  )r0rYr\rRr/rlistrresplitrF RuntimeErrorrro_currentr r1openwrite setup_configset_as_current) rFrBrYrRr/db_urlsdb_tokenrdb_urlfile_cfgs r _engine_urirNs0))))))"""""",,,,,,}w}%%z >  > >Hhy(33 > >[006666&8:<= NN;??4#<#<==== > 9{tY77888FO - -   LI$< Lg*C00 LE I4s:VCdJKKK L L L L L L L L L L L L L L L$$ G[)*B   -   sG , , , - -s$D55D9 <D9 cP|dd}t|dS)N sqla_testingrequirement_cls)roru)rFrBrs r _requirementsrvs,"oon6GHHO(((((rc*ddlm}ddlm}|jdS|d\}}t |}|dddD]}t||}t||}|x|_|_dS)NrrrQ:.) r0rYr\rR requirementsr __import__getattrrequires)argumentrYrRmodnameclsnamemod componentreq_clss rruru}s))))))"""""" &~~c**GW W  C]]3''+&& c9%%c7##G-4WYY6F'***rc Zddlm}m}ddlm}ddlm}m}|jr |j D]}|j }||} | } | D]P} | ||| |Qn#t"$rYnwxYw|jj|r} | d} | D]R} | ||| |dSn#t"$rYnwxYw||| |jj|r||| |j||drgddlm} | d D]K} | | | | d | d  LdSdS) Nr)rYrZ)against)schemainspect test_schema)r postgresql)r*namer)rr)r0rYrZsqlalchemy.testing.exclusionsrr\rrrConfig all_configsrget_view_namesexecute _DropViewTableMetaDataNotImplementedErrorrschemasenabled_for_configdrop_all_tablesrsqlalchemy.dialectsr get_enums DropEnumTypeENUM)rFrBrYrZrrrre inspector view_namesvnamerenums r_prep_testing_databasers////////555555********0=,,../ / CA I &5577 (EII(("LL0A0ABB'    "*==cBB !*!9!9!9!O!OJ",   ",, & $)$*OO$5$5+8!-!"!" +D  I . . ."*==cBB K$$Q #/$JJJwsL)) ::::::%//44DII"//&OO%)&\$x.,U00/ / s$B66 CC&E EEc8|jrddlm}|dSdS)Nr)randomize_unitofwork)r!sqlalchemy.orm.utilr)rFrBrs r_reverse_topologicalrs><<<<<<rc8ddlm}t|_||_dSr)r0rYrFrB)rHrBrYs r_post_setup_optionsrs)))))))FN$Frcnddlm}||dd|_dS)Nr)rXr profile_file)r0rXProfileStatsFilero_profile_stats)rFrBrXs r_setup_profilingrsC,,,,,,(9977  Irct|tjsdS|drdStjjr$t|ddst|ddsdSdS)NFry __backend____sparse_backend__T) issubclassrSTestBase startswithrYrFrr)rclss r want_classrsy c8, - - u    u#]E221599 utrc|jdsdS|jdStrt |doz+_possible_configs_for_cls..sFKFN6!r)key)setrYrr__unsupported_on__rUdb_specrremoverrZto_listrintersection_updaterrrr matching_config_reasonsextendr!rrz differencedifference_updatereversedrnrrvalues)rreasonsrrspec config_objr requirementcheck skip_reasons non_preferred per_dialectrrs rrrXsfm//1122K /!3#9:{++ / /JtJ /"":...sM4((/!4<<#@#@A{++ / /J4 ## /"":...s($//B'')?(@AAAsN## * {++  J"/    k::$<z&_do_skips...s<Crz)+N)rrjoinrU_server_versiondriver)rBr5s rrDz_do_skips..s  JM&&&HH#-#=#=jm#L#LM(((      r__prefer_backends__)rrrY skip_testrrErrrr'rUr)rZr+rHrzr/r0r _setup_configpop)rr3rcmsgr9r4r5s rrrsG+C99KsM5))m,,  Aqss    ,/LLL!**E 99 LLL II  #)-";";"="=       IIg      + , ,9 !4<<0G#H#HI% . .J4 ## .!!*---  ! !- 0 0 9  ) )- 8 8 8 k))koo''-----*)rcPtj|tdSrL)rYrpushrR)r5ctxs rrJrJs  OW-----rceZdZejdZejdZejdZejdZdZ dS)FixtureFunctionsctrLrselfargkws rskip_test_exceptionz$FixtureFunctions.skip_test_exception!###rctrLrTrVrrrXs r combinationszFixtureFunctions.combinationsrZrctrLrTr\s r param_identzFixtureFunctions.param_identrZrctrLrTrUs rfixturezFixtureFunctions.fixturerZrctrLrT)rVs rget_current_test_namez&FixtureFunctions.get_current_test_names!###rN) rrr r abstractmethodrYr]r_rarcr rrrRrRs$$$ $$$ $$$ $$$$$$$$rrRc |adSrL)r)fixture_fn_classs rset_fixture_functionsrgs(r)NF)K__doc__ __future__rr rrp version_infopy3kr@rrA collectionscollections_abcobjectrSrTrUrWrXr/rVrrYrRrZrBrar'r6r7rFr,r3r;r>rDrJrOr_r&r'r(r*r)rGr[rrrrrrrrrurrrrrrrrrrr rrrrrrJrRrrgr rrros4'&&&&&  6! $ 'CC''''))))$$$$$f$$$             suu suu |||~ . . .    BBB000 !!!!!!$ 9 9 9......    --- ***444 $-$-$-N))) 777&555p%%%   64   ### 222 " " "--->>>>B'.'.'.T...$$$$$s$$$*)))))r