1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
U
¸ý°d+Vã@sRddlmZddlZddlZddladdlZddlZddlZddlm    Z    ddl
m Z dZ t  d¡ZdadadadadadadadZdadadadadaeƒZeƒZdadd„Zd    d
„Z d d „Z!d d„Z"dd„Z#dd„Z$dd„Z%dd„Z&dd„Z'dd„Z(dd„Z)dd„Z*dd „Z+d!d"„Z,d#d$„Z-gZ.gZ/d%d&„Z0d'd(„Z1e0d)d*„ƒZ2e0d+d,„ƒZ3e1d-d.„ƒZ4e1d/d0„ƒZ5e0d1d2„ƒZ6e1d3d4„ƒZ7e1d5d6„ƒZ8d7d8„Z9e1d9d:„ƒZ:e1d;d<„ƒZ;e1d=d>„ƒZ<d?d@„Z=dAdB„Z>dCdD„Z?dEdF„Z@dGdH„ZAdIdJ„ZBdKdL„ZCdMdN„ZDdOdP„ZEdQdR„ZFdSdT„ZGdUdV„ZHdadWdX„ZIdYdZ„ZJd[d\„ZKGd]d^„d^ejLƒZMdaNd_d`„ZOdS)bé)Ú annotationsN)ÚAny)ÚasyncioFzsqlalchemy.testing.plugin_basecCs¸|ddttdd|ddttdd|ddtd    d
d |d dtd d|ddtddd |ddtddd |ddddd|dddd|ddtdƒdd|d dtd!ƒd"d|d#dtd$ƒd%d|d&dtd'ƒd(d|d)td*d+d,d-|d.td/d0d1|d2dd3d4d|d5td6d7d1|d8dttd9d|d:dttd;d<|d=dttd>d<|d?dd@dAdBdC|dDddEdAdFdC|dGtdHdId1|dJtdgdKdLdM|dNtdOdP|dQddRddS)SNz
--log-infoÚcallbackz,turn on info logging for <LOG> (multiple OK))ÚactionÚtyperÚhelpz --log-debugz-turn on debug logging for <LOG> (multiple OK)z--dbÚappendÚdbzBUse prefab database uri. Multiple OK, first one is run by default.)rrÚdestrz--dbszList available prefab dbs)rZzeroarg_callbackrz--dburiÚdburiz8Database uri.  Multiple OK, first one is run by default.z
--dbdriverÚdbdriverz|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)rr rz--disable-asyncioz8disable test / fixtures / provisoning running in asyncio)rrz--backend-onlyÚbackendz}Run only tests marked with __backend__ or __sparse_backend__; this is now equivalent to the pytest -m backend mark expressionz
--nomemoryZmemory_intensivezpDon't run memory profiling tests; this is now equivalent to the pytest -m 'not memory_intensive' mark expressionz--notimingintensiveZtiming_intensivezpDon't run timing intensive tests; this is now equivalent to the pytest -m 'not timing_intensive' mark expressionz--nomypyZmypyz_Don't run mypy typing tests; this is now equivalent to the pytest -m 'not mypy' mark expressionz--profile-sortZ
cumulativeÚ profilesortz*Type of sort for profiling standard output)rÚdefaultr rz--profile-dumpÚ profiledumpz2Filename where a single profile run will be dumped)rr rz--low-connectionsÚlow_connectionsz>Use a low number of distinct connections - i.e. for Oracle TNSz--write-identsÚ write_identszCwrite out generated follower idents to <file>, when -n<num> is usedz--requirementsz3requirements class for testing, overrides setup.cfgz --include-tagzAInclude tests with tag <tag>; legacy, use pytest -m 'tag' instead)rrrrz --exclude-tagzEExclude tests with tag <tag>; legacy, use pytest -m 'not tag' insteadz--write-profilesZwrite_profilesFz$Write/update failing profiling data.)rr rrz--force-write-profilesZforce_write_profilesz,Unconditionally write/update profiling data.z--dump-pyannotateZdump_pyannotatez/Run pyannotate and dump json info to given filez--mypy-extra-test-pathZmypy_extra_test_pathszlAdditional test directories to add to the mypy tests. This is used only when running mypy tests. Multiple OK)rrrr rz--postgresql-templatedbz^name of template database to use for PostgreSQL CREATE DATABASE (defaults to current database))rrz--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_option©rú\d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/testing/plugin/plugin_base.pyÚ setup_options9s@ûûûüûû    üýû    üüüûüüüûûûûûüú
ýýr!cCsddlm}||_dS)z„Configure required state for a follower.
 
    This invokes in the parent process and typically includes
    database creation.
 
    r©Ú    provisionN)Úsqlalchemy.testingr#ÚFOLLOWER_IDENT)Zfollower_identr#rrr Úconfigure_followerîs r&cCsdS)z¯Store 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.
 
    Nr©Zdict_rrr Ú!memoize_important_follower_configúsr(cCsdS)z‡Restore important configuration needed by a follower.
 
    This invokes in the follower process.
 
    Hook is currently not used.
 
    Nrr'rrr Ú!restore_important_follower_configsr)cCs*t ¡at t|dƒt|dƒg¡dS)Nz    setup.cfgztest.cfg)Ú configparserÚ ConfigParserÚ file_configÚreadr)Ú    root_pathrrr Ú read_configsÿr/cCs|atD]}|ttƒqdS)z7things to set up early, before coverage might be setup.N)ÚoptionsÚ pre_configurer,)ÚoptÚfnrrr Ú    pre_beginsr4cCs
|t_dS©N)r0Z has_coverage)Úvaluerrr Úset_coverage_flagsr7cCsptD]}|ttƒqddlmaddlmamamaddlm    a    m
a
m a ddlm a m a ddlmat
 ¡dS)z9things to set up later, once we know coverage is running.r©Útesting)ÚfixturesÚenginesÚ
exclusions)Ú
assertionsÚwarningsÚ    profiling)Úconfigr#)ÚutilN)Úpost_configurer0r,Ú
sqlalchemyr9r$r:r;r<r=r>r?r@r#rAZ setup_filters©r3rrr Ú
post_begin"s   rEcCsRtsddlat ¡| d¡r2t |¡ tj¡n| d¡rNt |¡ tj¡dS)Nrz-infoz-debug)ÚloggingÚ basicConfigÚendswithÚ    getLoggerÚsetLevelÚINFOÚDEBUG©Úopt_strr6Úparserrrr r4s
 
rcGsBtdƒtt d¡ƒD]}td|t d|¡fƒqt d¡dS)Nz0Available --db options (use --dburi to override)r
z%20s    %sr)ÚprintÚsortedr,r0ÚgetÚsysÚexit)ÚargsÚmacrorrr rAsrcCs t|ƒdSr5)Ú_setup_requirementsrMrrr rHsrcs‡fdd„}|S)Ncst|ˆ|ƒdSr5)rrM©Útagrr Ú_do_include_tagMsz)_set_tag_include.<locals>._do_include_tagr)rYrZrrXr rLs rcs‡fdd„}|S)Ncst|ˆ|ƒdSr5)rrMrXrr Ú_do_exclude_tagTsz)_set_tag_exclude.<locals>._do_exclude_tagr)rYr[rrXr rSs rcCst | dd¡¡dS©Nú-Ú_)Ú exclude_tagsÚaddÚreplacerMrrr rZsrcCst | dd¡¡dSr\)Ú include_tagsr`rarMrrr r^srcCst |¡|Sr5)r1r    rDrrr Úprefs
rccCst |¡|Sr5)rBr    rDrrr Úpostks
rdcCs|adSr5©r0©r2r,rrr Ú_setup_optionspsrgcCs,ddlm}| ddd¡| ddd¡dS)Nr)Úregistryzsqlite.pysqlite_numericz#sqlalchemy.dialects.sqlite.pysqliteZ_SQLiteDialect_pysqlite_numericzsqlite.pysqlite_dollarZ_SQLiteDialect_pysqlite_dollar)Zsqlalchemy.dialectsrhÚregister)r2r,rhrrr Ú _register_sqlite_numeric_dialectvs ýýrjc
Cs^tj dd¡dkrZddlm}z|ddWn,tk
rX}ztdƒ|‚W5d}~XYnXdS)    NZREQUIRE_SQLALCHEMY_CEXTÚ0Ú1r)Úhas_compiled_extT)Zraise_zEREQUIRE_SQLALCHEMY_CEXT is set but can't import the cython extensions)ÚosÚenvironrRZsqlalchemy.utilrmÚ ImportErrorÚAssertionError)r2r,rmÚerrrrr Ú __ensure_cext†s ÿýrscCsddlm}tƒ|_dS©Nr©r@)r$r@Ú_fixture_fn_classZ_fixture_functions)r0r,r@rrr Ú _init_symbols”s rwcCs|jr dt_dS)NF)Zdisable_asynciorZENABLE_ASYNCIOrfrrr Ú_set_disable_asyncio›srxc
CsHddlm}ddlm}ddlm}|jr6t|jƒ}ng}|jpBg}|jr–|jD]D}t     
d|¡D]2}||  d¡kr€t d|ƒ‚q`|  | d|¡¡q`qP|s¬|  | dd¡¡d|_t| ||¡ƒ}    |    D]|}
t d    |
¡|jr|jrt|jd
ƒ&} |  |j›d |
jd d ›d¡W5QRX| |
|||j¡} |jsÆ|  | |¡qÆdS)Nrr8rur"z[,\s]+r
z:Unknown URI specifier '%s'.  Specify --dbs for known uris.rzAdding database URL: %sÚaú F)Z hide_passwordÚ
)rCr9r$r@r#r Úlistr r
ÚreÚsplitr0Ú RuntimeErrorr    rRÚ_currentZgenerate_db_urlsÚlogÚinforr%ÚopenÚwriteZrender_as_stringZ setup_configZset_as_current) r0r,r9r@r#Zdb_urlsZ extra_driversZdb_tokenr
Z expanded_urlsZdb_urlÚfile_Úcfgrrr Ú _engine_uri¢sH    
 
ÿÿ ÿÿr‡cCs| dd¡}t|ƒdS)NÚ sqla_testingÚrequirement_cls)rRrW)r0r,r‰rrr Ú _requirementsÓs rŠcCs€ddlm}ddlm}|jdk    r&dS| d¡\}}t|ƒ}| d¡dd…D]}t||ƒ}qNt||ƒ}|ƒ|_|_t    |_    dS)Nrrur8ú:Ú.é)
r$r@rCr9Ú requirementsr~Ú
__import__ÚgetattrÚrequiresÚbootstrapped_as_sqlalchemy)Zargumentr@r9ÚmodnameZclsnameÚmodÚ    componentZreq_clsrrr rWÚs  
 
rWcCs@ddlm}|jr<ddlm}|j ¡D]}| ||j¡q(dS)Nrrur")r$r@rr#ÚConfigÚ all_configsZdrop_all_schema_objectsr
)r0r,r@r#r†rrr Ú_prep_testing_databaseïs
  r˜cCsddlm}t|_||_dSrt)r$r@r0r,)r2r,r@rrr Ú_post_setup_optionsús r™cCs.ddlm}|j| dd¡|j|jd|_dS)Nr)r?rˆZ profile_file)ÚsortÚdump)r$r?ZProfileStatsFilerRrrZ_profile_stats)r0r,r?rrr Ú_setup_profilings  
ýrœcCs&t|tjƒsdS| d¡rdSdSdS)NFr^T)Ú
issubclassr:ZTestBaseÚ
startswith)ÚnameÚclsrrr Ú
want_class s
 
r¡cCs&|j d¡sdS|jdkrdSdSdS)NZtest_FT)Ú__name__ržÚ
__module__)r r3rrr Ú want_methods
 
r¤c    csŽd|ksd|kr„d|k}t||dD]\}|j}t dd|j¡}t dd|¡}d|j|f}t||f||d    œƒ}t|||ƒ|Vq$n|VdS)
NrZsparse_backend)Úsparsez
[_\[\]\.]+r^z_+$Úz%s_%s)Ú_sa_orig_cls_nameÚ__only_on_config__)Ú_possible_configs_for_clsr¢r}ÚsubrŸrÚsetattr)    r ÚmoduleÚmarkersr¥r†Ú    orig_nameZ
alpha_namerŸÚsubclsrrr Úgenerate_sub_testssý 
r°cCst|ƒt|ƒdSr5)Ú    _do_skipsÚ _setup_engine©r rrr Ú!start_test_class_outside_fixtures7sr´cCst |¡tj ¡dSr5)r:Zstop_test_class_inside_fixturesr;Útesting_reaperr³rrr Ústop_test_class<s
r¶cCs:tj ¡t ttj|¡ztjs*t     
¡W5tƒXdSr5) r;rµÚ stop_test_class_outside_fixturesr#r@r
Ú_restore_enginer0rr=Úglobal_cleanup_assertionsr³rrr r·Es 
 r·cCstjrtj t¡dSr5)r@r€Úresetr9rrrr r¸Osr¸cCstj ¡t ¡tƒdSr5)r;rµZ final_cleanupr=r¹r¸rrrr Úfinal_process_cleanupTs
r»cCs<t|ddƒr8t|jƒ}d|d<tj|d}tj |t¡dS)NÚ__engine_options__ÚclassZscopere)    rÚdictr¼r;Ztesting_enginer@r€Z push_enginer9)r ÚoptsZengrrr r²Zs
 
 r²cCs*t|d|jƒ}d|||f}t |¡dS)Nr§z%s.%s.%s)rr¢r?Z_start_current_test)ÚtestZtest_module_nameZ
test_classZ    test_namerŸZid_rrr Ú before_testbsrÁcCst ¡tj ¡dSr5)r:Ú
after_testr;rµ©rÀrrr rÂnsrÂcCstj |¡dSr5)r;rµZafter_test_outside_fixturesrÃrrr Úafter_test_fixturesssrÄcCs²ttj ¡ƒ}|jr@tj|jŽ}t|ƒD]}||ƒr(| |¡q(t    |ddƒr~tjt
  |j ¡Ž}t|ƒD]}||ƒsf| |¡qft    |ddƒr˜|  |jg¡t|dƒrútj}t|ƒD]H}|jD]<}t    ||ƒ}| |¡}    |    rº| |¡|dk    rò| |    ¡q°qºq°t|dƒrftƒ}
tj}t|ƒD]4}|jD]&}t    ||ƒ}| |¡s$|
 |¡q$q| |
¡rf| |
¡|r®i} tt|dd„dƒD] } | jj} | | kr„| | | <q„|  ¡S|S)NÚ __only_on__r¨Ú __requires__Ú__prefer_requires__cSs|jj|jj|jjjfSr5)r
rŸÚdriverÚdialectZserver_version_info)r†rrr Ú<lambda>ªsýz+_possible_configs_for_cls.<locals>.<lambda>)Úkey)Úsetr@r–r—Z__unsupported_on__r<Údb_specr|ÚremoverrAÚto_listrÅÚintersection_updater¨ÚhasattrrŽrÆZmatching_config_reasonsÚextendrÇZenabled_for_configr`Ú
differenceÚdifference_updateÚreversedrQr
rŸÚvalues)r Úreasonsr¥r—ÚspecÚ
config_objrŽÚ requirementÚcheckZ skip_reasonsÚ non_preferredZ per_dialectr†r
rrr r©ws^       
 
 
 
 
 
 
 
 
þÿ
 
 r©cCsôg}t||ƒ}t|ddƒrFt|dƒD] }|ƒr$t d|j|jf¡q$|s†d|j|jd dd„tj ¡Dƒ¡d |¡f}t |¡nRt    |dƒrØt
ƒ}t j t  |j¡Ž}|D]}||ƒs¬| |¡q¬| |¡rØ| |¡tj|krðt| ¡|ƒdS)    NZ __skip_if__Fz'%s' skipped by %sz1'%s.%s' unsupported on any DB implementation %s%sz, c    ss<|]4}d|jjd dd„t |j¡Dƒ¡|jjfVqdS)z '%s(%s)+%s'rŒcss|]}t|ƒVqdSr5)r)Ú.0Údigrrr Ú    <genexpr>Ìsÿz&_do_skips.<locals>.<genexpr>.<genexpr>N)r
rŸÚjoinr<Z_server_versionrÈ)rÝrÙrrr rßÈs
÷
 
þúÿz_do_skips.<locals>.<genexpr>Ú__prefer_backends__)r©rr@Z    skip_testr¢r£ràr–r—rÑrÌr<rÍrArÏrár`rÓrÔr€Ú _setup_configÚpop)r r×r—ÚcÚmsgrÜrØrÙrrr r±¹s8
 ÿ
 
ö ñ 
 
 
 
r±cCstj |t¡dSr5)r@r€Úpushr9)rÙÚctxrrr râäsrâc@sneZdZejdd„ƒZejdd„ƒZejdd„ƒZejdd„ƒZd    d
„Z    ejd d œd d„ƒZ
ej dd„ƒZ dS)ÚFixtureFunctionscOs
tƒ‚dSr5©ÚNotImplementedError©ÚselfÚargÚkwrrr Úskip_test_exceptionész$FixtureFunctions.skip_test_exceptioncOs
tƒ‚dSr5ré©rìrUrîrrr Ú combinationsíszFixtureFunctions.combinationscOs
tƒ‚dSr5rérðrrr Ú param_identñszFixtureFunctions.param_identcOs
tƒ‚dSr5rérërrr ÚfixtureõszFixtureFunctions.fixturecCs
tƒ‚dSr5ré©rìrrr Úget_current_test_nameùsz&FixtureFunctions.get_current_test_namer)ÚreturncCs
tƒ‚dSr5rérôrrr Úmark_base_test_classüsz%FixtureFunctions.mark_base_test_classcCs
tƒ‚dSr5rérôrrr Ú add_to_markerszFixtureFunctions.add_to_markerN) r¢r£Ú __qualname__ÚabcÚabstractmethodrïrñròrórõr÷Úabstractpropertyrørrrr rèès
 
 
 
rècCs|adSr5)rv)Zfixture_fn_classrrr Úset_fixture_functionssrý)NF)PÚ
__future__rrúr*rFrnr}rSÚtypingrr$rr’rIrr:r;r<r>r?r#r=rŽr@r9rAr,rÌrbr_r0r!r&r(r)r/r4r7rErrrrrrrr1rBrcrdrgrjrsrwrxr‡rŠrWr˜r™rœr¡r¤r°r´r¶r·r¸r»r²rÁrÂrÄr©r±râÚABCrèrvrýrrrr Ú<module>
sª   
6 
 
 
 
 
 
 
 
0
 
 
 
 
 
            
 
B+