L iJTUddlmZddlZddlmZddlZddladdlZddlm Z ddl Z ddl Z ddl m Z ddlmZ dZt j"dZdadadadadadadadZdadadadadaeZ eZ!da"d e#d <d Z$d Z%d Z&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2gZ3gZ4dZ5dZ6e5dZ7e5dZ8e6dZ9e6dZ:e5d Z;e6d!Ze6d$Z?e6d%Z@e6d&ZAd'ZBd(ZCd)ZDd*ZEd+ZFd,ZGd-ZHd.ZId/ZJd0ZKd1ZLd2ZMd9d3ZNd4ZOd5ZPGd6d7ejZRdaSd8ZTy):) annotationsN) Namespace)Path)Any)asyncioFzsqlalchemy.testing.plugin_baseroptionscX|ddttd|ddttd|ddtd d |d dtd |ddtdd |ddtdd |dddd|ddd|ddtdd|d dt d!d"|d#dt d$d%|d&dt d'd(|d)td*d+d,-|d.td/d01|d2dd3d4|d5td6d71|d8dtt d9|d:dt td;<|d=dttd><|d?dd@dAdBC|dDddEdAdFC|dGtdHdI1|dJtdgdKdLM|dNtdOP|dQddRy)SNz --log-infocallbackz,turn on info logging for (multiple OK))actiontyper helpz --log-debugz-turn on debug logging for (multiple OK)z--dbappenddbzBUse prefab database uri. Multiple OK, first one is run by default.)r r destr z--dbszList available prefab dbs)r zeroarg_callbackr z--dburidburiz8Database uri. Multiple OK, first one is run by default.z --dbdriverdbdriverz|Additional database drivers to include in tests. These are linked to the existing database URLs by the provisioning system.z --dropfirst store_true dropfirstz,Drop all tables in the target database first)r rr z--disable-asyncioz8disable test / fixtures / provisoning running in asyncio)r r z--backend-onlybackendz}Run only tests marked with __backend__ or __sparse_backend__; this is now equivalent to the pytest -m backend mark expressionz --nomemorymemory_intensivezpDon't run memory profiling tests; this is now equivalent to the pytest -m 'not memory_intensive' mark expressionz--notimingintensivetiming_intensivezpDon't run timing intensive tests; this is now equivalent to the pytest -m 'not timing_intensive' mark expressionz--nomypymypyz_Don't run mypy typing tests; this is now equivalent to the pytest -m 'not mypy' mark expressionz--profile-sort cumulative profilesortz*Type of sort for profiling standard output)r defaultrr z--profile-dump profiledumpz2Filename where a single profile run will be dumped)r rr z--low-connectionslow_connectionsz>Use a low number of distinct connections - i.e. for Oracle TNSz--write-idents write_identszCwrite out generated follower idents to , when -n is usedz--requirementsz3requirements class for testing, overrides setup.cfgz --include-tagzAInclude tests with tag ; legacy, use pytest -m 'tag' instead)r r r r z --exclude-tagzEExclude tests with tag ; legacy, use pytest -m 'not tag' insteadz--write-profileswrite_profilesFz$Write/update failing profiling data.)r rrr z--force-write-profilesforce_write_profilesz,Unconditionally write/update profiling data.z--dump-pyannotatedump_pyannotatez/Run pyannotate and dump json info to given filez--mypy-extra-test-pathmypy_extra_test_pathszlAdditional test directories to add to the mypy tests. This is used only when running mypy tests. Multiple OK)r r rrr z--postgresql-templatedbz^name of template database to use for PostgreSQL CREATE DATABASE (defaults to current database))r r z--oracledb-thick-modez:enables the 'thick mode' when testing with oracle+oracledb)str_log _list_dbs_set_tag_include_set_tag_exclude_requirements_opt _include_tag _exclude_tag) make_options k/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/testing/plugin/plugin_base.py setup_optionsr.;su  ;   <   ' " (     G      ;   G ))4 N )*<= )*<= )&1M    9    A        " B  .  2   3   # ;    >    $A ! 9  Icddlm}||_y)zConfigure required state for a follower. This invokes in the parent process and typically includes database creation. r provisionN)sqlalchemy.testingr2FOLLOWER_IDENT)follower_identr2s r-configure_followerr6s--Ir/cy)zStore important configuration we will need to send to a follower. This invokes in the parent process after normal config is set up. Hook is currently not used. Ndict_s r-!memoize_important_follower_configr;r/cy)zRestore important configuration needed by a follower. This invokes in the follower process. Hook is currently not used. Nr8r9s r-!restore_important_follower_configr>r<r/ctjatjt |dz t |dz gy)Nz setup.cfgztest.cfg) configparser ConfigParser file_configreadr$) root_paths r- read_configrEs:++-K Y $ %s9z+A'BCr/c@|atD]}|tty)z7things to set up early, before coverage might be setup.N)r pre_configurerB)optfns r- pre_beginrJs"G! 7K !r/c|t_yN)r has_coverage)values r-set_coverage_flagrO s  Gr/ctD]}|ttddlmaddlmamamaddlm a m a m a ddlm a m a ddlmatjy)z9things to set up later, once we know coverage is running.rtesting)fixturesengines exclusions) assertionswarnings profiling)configr2)utilN)post_configurerrB sqlalchemyrRr3rSrTrUrVrWrXrYr2rZ setup_filtersrIs r- post_beginr_$s@! 7K ! #@@BB4 r/cPtsddlatj|jdr3tj|j tj y|jdr3tj|j tj yy)Nrz-infoz-debug)logging basicConfigendswith getLoggersetLevelINFODEBUGopt_strrNparsers r-r%r%6so  % ))',,7   ( #% ))'--8 $r/c tttjt dt tj dD]'}t |ddtjd|)tjdy)Nz0Available --db options (use --dburi to override)rz>20 r) rBrErcwdprintsortedrgetsysexit)argsmacros r-r&r&Cse DHHJ <= ++D12B E;??4#?@ABHHQKr/ct|yrL)_setup_requirementsrhs r-r)r)Ns r/cfd}|S)Nc t||yrL)r*rirNrjtags r-_do_include_tagz)_set_tag_include.._do_include_tagSWc6*r/r8)rzr{s` r-r'r'R+ r/cfd}|S)Nc t||yrL)r+rys r-_do_exclude_tagz)_set_tag_exclude.._do_exclude_tagZr|r/r8)rzrs` r-r(r(Yr}r/cNtj|jddyN-_) exclude_tagsaddreplacerhs r-r+r+`U]]3,-r/cNtj|jddyr) include_tagsrrrhs r-r*r*drr/c0tj||SrL)rGrr^s r-prerls Ir/c0tj||SrL)r[rr^s r-postrqs" Ir/c|ayrLrrHrBs r-_setup_optionsrvs Gr/c\ddlm}|jddd|jdddy)Nr)registryzsqlite.pysqlite_numericz#sqlalchemy.dialects.sqlite.pysqlite_SQLiteDialect_pysqlite_numericzsqlite.pysqlite_dollar_SQLiteDialect_pysqlite_dollar)sqlalchemy.dialectsrregister)rHrBrs r- _register_sqlite_numeric_dialectr|s5, !-)   -(r/ctjjdddk(rddlm} |dyy#t $r}t d|d}~wwxYw) NREQUIRE_SQLALCHEMY_CEXT01r)has_compiled_extT)raise_zEREQUIRE_SQLALCHEMY_CEXT is set but can't import the cython extensions)osenvironrpsqlalchemy.utilr ImportErrorAssertionError)rHrBrerrs r- __ensure_cextrsX zz~~/5<4  D ) =   $  s 6 A A  Ac.ddlm}t|_yNrrY)r3rY_fixture_fn_class_fixture_functions)rrBrYs r- _init_symbolsrs) 1 3Fr/c4|jr dt_yyNF)disable_asynciorENABLE_ASYNCIOrs r-_set_disable_asynciors !&r/c ddlm}ddlm}ddlm}ddlm}|jrt|j}ng}|jxsg}|jrn|jD]_}tjd|D]D} | |jdvrtd| z|j|j!d| Fa|s!|j|j!dd d|_|j$r|j&rt|D cgc]} |j)| c} D]R} t+|j$d 5} | j-|j&d | j/d ddddTt|j1||} | D]U} t2j5d| |j7| |||j&} |j"rD| j9| |Wycc} w#1swYxYw)NrrQrr1)urlz[,\s]+rz:Unknown URI specifier '%s'. Specify --dbs for known uris.ra F) hide_password zAdding database URL: %s)r\rRr3rYr2sqlalchemy.enginerrlistrrresplitr RuntimeErrorrrp_currentrr4make_urlopenwriterender_as_stringgenerate_db_urlsloginfo setup_configset_as_current)rrBrRrYr2sa_urldb_urls extra_driversdb_tokenrdb_urlfile_ expanded_urlscfgs r- _engine_urirs"),/}}w}}%$$*Mzz  >Hhhy(3 >[0066&8:<= NN;??4#<= > > {tY78FO 8 8=DE6vv.E Fg**C0 E  //0..U.CDBH   33G]KLM- *F3$$ G[)*B*B    sG ,-F  s G32G88H c>|jdd}t|y)N sqla_testingrequirement_cls)rprv)rrBrs r- _requirementsrs!oon6GHO(r/cddlm}ddlm}|j d\}}t |}|j dddD]}t ||}t ||}|x|_|_t|_ y)NrrrQ:.) r3rYr\rRr __import__getattr requirementsrequiresbootstrapped_as_sqlalchemy)argumentrYrRmodnameclsnamemod componentreq_clss r-rvrvsx)"~~c*GW W C]]3'+& c9%&c7#G-4Y6F'*(BF%r/cddlm}|jrBddlm}|jj D]}|j ||j yy)Nrrr1)r3rYrr2Config all_configsdrop_all_schema_objectsr)rrBrYr2rs r-_prep_testing_databasersF)0==,,. ;C  - -c366 : ;r/c4ddlm}t|_||_yr)r3rYrrB)rHrBrYs r-_post_setup_optionsrs)FN$Fr/cddlm}|j|jdd|j|j |_y)Nr)rXr profile_file)sortdump)r3rXProfileStatsFilerprr_profile_stats)rrBrXs r-_setup_profilingrs=,(997    : Ir/c^t|tjsy|jdryy)NFrT) issubclassrSTestBase startswith)nameclss r- want_classrs' c8,, -  r/cV|jjdsy|jyy)Ntest_FT)__name__r __module__)rrIs r- want_methodrs' ;; ! !' *  r/c#@Kd|vsd|vrd|v}t||D]y}|j}tjdd|j}tjdd|}|jd|}t ||f||d}t ||||{y|yw) Nrsparse_backend)sparsez [_\[\]\.]+rz_+$)_sa_orig_cls_name__only_on_config__)_possible_configs_for_clsrrsubrr setattr) rmodulemarkersrr orig_name alpha_namersubclss r-generate_sub_testsr !sG/7:!W,,S@ C I  sCHH=JJ7J!llJ7D&/sKF FD& )L! $ sBBc0t|t|yrL) _do_skips _setup_enginers r-!start_test_class_outside_fixturesr9s cN#r/cjtj|tjjyrL)rSstop_test_class_inside_fixturesrTtesting_reaperrs r-stop_test_classr>s$ ,,S1 ::z+_possible_configs_for_cls..s0FFKKFFMMFFNN66!r/)key)setrYrr__unsupported_on__rUdb_specrremoverrZto_listr6intersection_updaterhasattrrr7matching_config_reasonsextendr8enabled_for_configr differencedifference_updatereversedrorrvalues)rreasonsrrspec config_objr requirementcheck skip_reasons non_preferred per_dialectrrs r-rrxsPfmm//12K !!3#9#9:{+ /JJ"":. /sM4(!!4<<#@A{+ /J #"":. /s($/'')?)?(@AsN#** {+ J"//   k:$<z&_do_skips...sCsz)+N)rrjoinrU_server_versionr:)r[rOs r-r]z_do_skips..s` MM&&HH#-#=#=jmm#LMM(( sA1A3__prefer_backends__)rrrY skip_testrrr^rrrEr?rUrArZrCr`rrIrJr _setup_configpop)rrMrcmsgrSrNrOs r-r r sNG+C9KsM5)m, As  ,/LL!**E   NN LL II #)--";";"=   IIg  "  + , !!4<<0G0G#HI% .J #!!*- .  ! !- 0  ) )- 8 k)koo'-*r/cLtjj|tyrL)rYrpushrR)rOctxs r-rbrbs OOW-r/ceZdZejdZejdZejdZejdZdZ ejd dZ ejdZ y) FixtureFunctionsctrLNotImplementedErrorselfargkws r-skip_test_exceptionz$FixtureFunctions.skip_test_exception !##r/ctrLrlrorsrqs r- combinationszFixtureFunctions.combinationsrsr/ctrLrlrus r- param_identzFixtureFunctions.param_identrsr/ctrLrlrns r-fixturezFixtureFunctions.fixturersr/ctrLrlros r-get_current_test_namez&FixtureFunctions.get_current_test_names !##r/ctrLrlr|s r-mark_base_test_classz%FixtureFunctions.mark_base_test_classrsr/ctrLrlr|s r- add_to_markerzFixtureFunctions.add_to_markerrsr/N)returnr) rr __qualname__abcabstractmethodrrrvrxrzr}rabstractpropertyrr8r/r-rjrjs$$ $$ $$ $$$ $$ $$r/rjc|ayrL)r)fixture_fn_classs r-set_fixture_functionsr s(r/r)U __future__rrargparserr@rarpathlibrrrqtypingrr3rrrdrrSrTrUrWrXr2rVrrYrRrZrBr?rrr__annotations__r.r6r;r>rErJrOr_r%r&r)r'r(r+r*rGr[rrrrrrrrrrvrrrrrr rrrrrrr.r0r4rr rbABCrjrrr8r/r-rs=#   &# 89            u u rj .!!$ 9..        44 '' .-.-b)) C$;;%%0 ='  2'( =?D(.V.$sww$:)r/