zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
U
¸ý°d¾mã@s–ddlmZddlZddlZddlmZddlZddlZddlZddl    Z    ddl
Z
ddl Z ddl Z ddl Z z ddlZWn ek
r”ddlmZYnXdd„Zdd    œd
d „Zd ae jd ddd„ƒZdd„Zdd„Zdd„Zdd„ZGdd„dƒZdd„Zdd„Zdd „Zd9d!d"„Zd#d$„Z da!d%d&„Z"e j#d d'd(d)„ƒZ$d*d+„Z%da&d,d-„Z'e jd.d/d0d1„ƒZ(e jd2d/d3d4„ƒZ)d5d6„Z*Gd7d8„d8ej+ƒZ,dS):é)Ú annotationsN)Úupdate_wrapperé)Ú plugin_basecs$| d¡‰‡fdd„}t |¡dS)NÚ
sqlalchemycsn| dd¡‰ˆr.G‡fdd„dtjƒ}||d<| dd¡‰ˆr\G‡fdd„dtjƒ}||d<ˆj|f|ŽdS)NÚcallbackcseZdZd‡fdd„    ZdS)ú=pytest_addoption.<locals>.make_option.<locals>.CallableActionNcsˆ|||ƒdS©N©©ÚselfÚparserÚ    namespaceÚvaluesZ option_string©Ú    callback_r
ú]d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/testing/plugin/pytestplugin.pyÚ__call__"súFpytest_addoption.<locals>.make_option.<locals>.CallableAction.__call__)N)Ú__name__Ú
__module__Ú __qualname__rr
rr
rÚCallableAction!sÿrÚactionÚzeroarg_callbackcs,eZdZd‡fdd„    Zd‡fdd„    Z‡ZS)    rFNc    stƒj||dd|||ddS)NrT)Úoption_stringsÚdestÚnargsÚconstÚdefaultÚrequiredÚhelp)ÚsuperÚ__init__)r rrrr r!©Ú    __class__r
rr#-sùzFpytest_addoption.<locals>.make_option.<locals>.CallableAction.__init__csˆ|||ƒdSr    r
r ©rr
rr?sr)FFN)N)rrrr#rÚ __classcell__r
r&r$rr,s úÿ)ÚpopÚargparseZActionZ    addoption)ÚnameÚkwr©Úgroup)rrrÚ make_options  z%pytest_addoption.<locals>.make_option)ZgetgrouprZ setup_options)r r.r
r,rÚpytest_addoptions
 +r/z pytest.Config©ÚconfigcCst |j¡tjstjr`d ttjƒdd„tjDƒ¡}|jjrX|jjd|›7_n||j_|j     
d¡rz|j      t ƒ¡t |dƒr¢t |j¡t |jd¡n&|jjrÈtj |jj¡rÈt |jj¡t |j¡t tt|jddƒƒ¡t t¡|jjrd    adS)
Nz and cSsg|]}d|›‘qS)znot r
)Ú.0Útagr
r
rÚ
<listcomp>Psz$pytest_configure.<locals>.<listcomp>ZxdistÚ workerinputÚfollower_identZ
cov_sourceFT)rZ read_configZrootpathÚ exclude_tagsZ include_tagsÚjoinÚlistÚoptionZmarkexprÚ pluginmanagerZ    haspluginÚregisterÚ
XDistHooksÚhasattrZ!restore_important_follower_configr5Zconfigure_followerZ write_identsÚosÚpathÚexistsÚremoveZ    pre_beginZset_coverage_flagÚboolÚgetattrZset_fixture_functionsÚPytestFixtureFunctionsÚdump_pyannotateÚDUMP_PYANNOTATE)r1Znew_exprr
r
rÚpytest_configureKs4  ÿÿ 
 ÿ ÿ
 
rHFT)Zautouseccs.trddlm}| ¡dVtr*| ¡dS)Nr©Ú collect_types)rGÚpyannotate_runtimerJÚstartÚstoprIr
r
rÚcollect_types_fixturets  rNc Csìddl}ddlm}ddlm}ddlm}d}tjjr<dnd}d|›d    |›d
d |j    ›g}|ƒr†dd l
m }|  d |j    ›d¡n|  d|›¡|j j d¡}    |    rÊ|     d|¡|D]}
|     |
¡q¸ntd|dƒ|D] }
t|
ƒqÚdS)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; Zterminalreporterú=z=========================)rrOZsqlalchemy.utilrPZsqlalchemy.util._has_cyrQÚsysÚflagsÚ no_user_siteÚ__file__Zsqlalchemy.cyextensionrSÚappendr1r;Z
get_pluginZ    write_sepZ
write_lineÚprint) ÚsessionrrOrPrQZgreetÚsiteZmsgsrSZpmÚmr
r
rÚ_log_sqlalchemy_infos*   
þ   r_cCs$ddlm}t|ƒ| tj¡dS©Nr©Úasyncio)Úsqlalchemy.testingrbr_Z _assume_asyncrZ
post_begin)r\rbr
r
rÚpytest_sessionstartŸs rdcCsBddlm}| tj¡|jjjr>ddlm    }| 
|jjj¡dS)NrrarI) rcrbÚ_maybe_async_provisioningrZfinal_process_cleanupr1r:rFrKrJZ
dump_stats)r\rbrJr
r
rÚpytest_sessionfinish¦s
 
 rfcs>|jjjr:ddlm}tj d¡‰‡fdd„}|j|ddS)NrrIúlib/sqlalchemycs<tj tj |¡¡}dtj |ˆg¡kr,dSd|kr8dS|S)NrgZtesting)r?r@ÚnormpathÚabspathÚ
commonpath)Úfilename©Zlib_sqlalchemyr
rÚ_filter·sÿz)pytest_collection_finish.<locals>._filter)Zfilter_filename)    r1r:rFrKrJr?r@riZinit_types_collection)r\rJrmr
rlrÚpytest_collection_finish±s
 
   rnc@seZdZdd„Zdd„ZdS)r=cCsXddlm}ddlm}t |j¡dt ¡jdd…|jd<|     |j
|jd¡dS)Nr©Ú    provisionraztest_%sé r6) rcrprbrZ!memoize_important_follower_configr5ÚuuidÚuuid4ÚhexreZcreate_follower_db)r Únoderprbr
r
rÚpytest_configure_nodeÆs   ÿz XDistHooks.pytest_configure_nodecCs0ddlm}ddlm}| |j|jd¡dS)Nrrorar6)rcrprbreZdrop_follower_dbr5)r ruÚerrorrprbr
r
rÚpytest_testnodedownÕs   ÿzXDistHooks.pytest_testnodedownN)rrrrvrxr
r
r
rr=Åsr=cs¼ddlm}t dd„¡‰dd„|Dƒ|dd…<dd„|Dƒ‰‡fd    d
„‰‡‡‡fd d „}| |¡g}|D]2}|j}|ˆkr”| ˆ||j¡ql| |¡qlt    |d d„d|dd…<dS)NrracSs
t t¡Sr    )Ú collectionsÚ defaultdictr9r
r
r
rÚ<lambda>íóz/pytest_collection_modifyitems.<locals>.<lambda>cSs4g|],}| tj¡dk    r| tj¡j d¡s|‘qS)NÚ_)Ú    getparentÚpytestÚClassr*Ú
startswith©r2Úitemr
r
rr4ðsýz1pytest_collection_modifyitems.<locals>.<listcomp>cSsh|]}| tj¡’qSr
)r~rr€r‚r
r
rÚ    <setcomp>÷sz0pytest_collection_modifyitems.<locals>.<setcomp>c3s4| ¡D]&}t|tjƒr(ˆ|ƒEdHq|VqdSr    )ÚcollectÚ
isinstancerZ    Collector)ÚelementZ
inst_or_fn)r…r
rr…ùs  z.pytest_collection_modifyitems.<locals>.collectc
s
ˆD]þ}tƒ}t|jddƒs,t|jddƒr4dh}nt|jddƒrJdh}ntƒ}dd„| ¡Dƒ}||}| |¡}|D]}| |¡qxt |j|j    |¡D]h}||jk    ršˆ|j}| 
t j ¡}t j j|j|d    }|D]}| |¡qԈ|ƒD]}    ||    j |    ¡qìqšqdS)
NZ __backend__FZ __only_on__ÚbackendZ__sparse_backend__Zsparse_backendcSsh|]
}|j’qSr
)r*)r2Úmarkr
r
rr„szLpytest_collection_modifyitems.<locals>.setup_test_classes.<locals>.<setcomp>©r*Úparent)ÚsetrDÚclsÚ    frozensetZ iter_markersÚunionZ
add_markerrZgenerate_sub_testsÚmoduler~rÚModuler€Ú from_parentrr*rZ)
Z
test_classZ add_markersZexisting_markersZ all_markersÚmarkerZsub_clsZ per_cls_dictrZnew_clsÚfn©r…Z rebuilt_itemsZ test_classesr
rÚsetup_test_classessD
ÿÿ
 ÿ
 
 ÿ  z9pytest_collection_modifyitems.<locals>.setup_test_classescSs | tj¡j| tj¡j|jfSr    )r~rr‘r*r€)rƒr
r
rr{9s  ý)Úkey)
rcrbryrzrerÚextendr*rZÚsorted)r\r1Úitemsrbr–ZnewitemsrƒZcls_r
r•rÚpytest_collection_modifyitemsÞs* ÿþ +
 þr›csxt |¡rJt ||¡rJddlm}|jr0t|ƒ}‡fdd„tˆj    |ƒDƒSt 
|¡rpˆj dk    rpt  ˆj |¡rpdSgSdS)Nrr0csg|]}tjj|jˆd‘qS)rŠ)rr€r’r)r2Zparametrize_cls©Ú    collectorr
rr4Hs
ýÿz-pytest_pycollect_makeitem.<locals>.<listcomp>) ÚinspectÚisclassrZ
want_classrcr1Ú    any_asyncÚ_apply_maybe_asyncÚ_parametrize_clsrÚ
isfunctionrZ want_method)rr*Úobjr1r
rœrÚpytest_pycollect_makeitemAs 
 
üÿþ ýr¥cCst|dƒr|j}qt |¡S)NÚ __wrapped__)r>r¦ržÚiscoroutinefunction©r”r
r
rÚ_is_wrapped_coroutine_function[s
r©csÐddlm‰t|ƒ ¡D]†\}}t|ƒs2t|tƒrt|ddƒs| d¡rt    |ƒsd}t|tƒrh|j
}d}t ‡fdd„ƒ}||ƒ}|rŒt|ƒ}d|_ t |||ƒq|rÌ| ¡d    d…D]}|tkr´t|dƒq´|S)
NrraÚ_maybe_async_appliedFZtest_Tcsˆj|f|ž|ŽSr    )Ú _maybe_async©r”ÚargsÚkwargsrar
rÚ
make_asyncqsz&_apply_maybe_async.<locals>.make_asyncr)rcrbÚvarsršÚcallabler†Ú classmethodrDrr©Ú__func__Ú_pytest_fn_decoratorrªÚsetattrÚmroÚobjectr¡)r¤Zrecurser*ÚvalueZis_classmethodr¯Zdo_asyncrr
rarr¡bs8 ÿÿ
þýü
 r¡cCsÚd|jkr|gS|j}g}tjdd„|DƒŽD]¦}i}tdd„|Dƒ|ƒD]>\}}|s^tdƒ‚t d|¡}t||jƒD]\}    }
|
||    <qvqJd     dd    „|Dƒ¡} d
|j
| f} t   t | |f|¡} t || | ƒ| | ¡q.|S) z6implement a class-based version of pytest parametrize.Ú_sa_parametrizecSsg|] \}}|‘qSr
r
)r2ÚargnameÚparamsr
r
rr4‹sz$_parametrize_cls.<locals>.<listcomp>cSsg|] }|d‘qS)rr
)r2Z    _sa_paramr
r
rr4sz*need argnames for class-based combinationsz,\s*r}css.|]&}|j d¡D]}t dd|¡VqqdS)ú-z\WÚN)ÚidÚsplitÚreÚsub)r2ÚparamÚtokenr
r
rÚ    <genexpr>—sþz#_parametrize_cls.<locals>.<genexpr>z%s_%s)Ú__dict__r¹Ú    itertoolsÚproductÚzipÚ    TypeErrorrÀr¿rr8rÚtypeÚ__new__rµrZ)rrr¹ÚclassesZfull_param_setZ cls_variablesrºrÂZ argname_splitÚargÚvalZparametrized_namer*Znewclsr
r
rr¢‚s2
 ÿ ÿ   
þ  r¢cCs@ddlm}t|tjƒr<tdkr<| tj|j    ¡| 
tj ¡adSr`) rcrbr†rZFunctionÚ_current_classrerZ!start_test_class_outside_fixturesrr~r€©rƒrbr
r
rÚpytest_runtest_setup¦s
þrÑ)Z hookwrapperc
csddlm}| tj|¡dVtdk    r|dksD| tj¡tk    rdaz´z| 
tj |j ¡Wnšt k
rø}z|t    jræ|jsŒdt    jf|_nZ|jdrÒt|jdtƒrÒt|jƒ}|ddt    j7<t|ƒ|_n|jdt    jf7_‚W5d}~XYnXW5da    XdS)Nrraz__Original test failure__:
éÿÿÿÿz
__Original test failure__:
z__Original test failure__)rcrbr«rZ
after_testrÏr~rr€Ú_current_reportreZ stop_test_class_outside_fixturesrÚ    ExceptionÚfailedr­Z longreprtextr†Ústrr9Útuple)rƒÚnextitemrbÚer­r
r
rÚpytest_runtest_teardown¹sF 
þýÿÿÿ
ÿÿ þrÚcCs,ddlm}| tj||jj|j|j¡dSr`)    rcrbr«rZ before_testrrrr*rÐr
r
rÚpytest_runtest_callïs ûrÛcCs|jdkr|adS)NÚcall)ÚwhenrÓ)Úreportr
r
rÚpytest_runtest_logreports
rßÚclass)ZscopeccsVddlm}|j}t|dƒr(| |j¡dVt|dƒrD| |j¡| tj|¡dS)NrraÚsetup_test_classÚteardown_test_class)    rcrbrr>r«rárârZstop_test_class)Úrequestrbrr
r
rÚsetup_class_methodss 
 
 räÚfunctionccs‚ddlm}|j}t|dƒr(| |j¡t|dƒr>| |j¡dV| tj|¡t|dƒrh| |j    ¡t|dƒr~| |j
¡dS)NrraÚ
setup_testÚsetUpÚtearDownÚ teardown_test) rcrbÚinstancer>r«rærçrZafter_test_fixturesrèré)rãrbr r
r
rÚsetup_test_methodss 
 
 
 
 
 
rëcs8ddlm‰ddlm‰dd„‰d    ‡‡‡‡fdd„    }|S)
z:Port of langhelpers.decorator with pytest-specific tricks.r)Úformat_argspec_plus)Úinspect_getfullargspeccSst||ƒ||Sr    )Úexec)ÚcodeÚenvÚfn_namer
r
rÚ_exec_code_in_env]s
z/_pytest_fn_decorator.<locals>._exec_code_in_envr
cs¤ˆ|ƒ}|r|j |¡tdd|jd}| ˆ|dd¡d|}ˆ|ˆ|dœ|jƒ}|szt|d|ƒj|_||_t||ƒS|j    |_    |j|_t
|d    ƒrœ|j |_ |SdS)
NÚ __target_fnÚ    __orig_fn)rórôr*F)ZgroupedzVdef %(name)s%(grouped_args)s:
    return %(__target_fn)s(%(__orig_fn)s, %(apply_kw)s)
)rórôr³Ú
pytestmark) r­r˜ÚdictrÚupdaterDÚ __defaults__r¦rrr>rõ)r”Úadd_positional_parametersÚspecÚmetadatarïZ    decorated©ròrìríÚtargetr
rÚdecoratees6 ÿüÿÿ
 
z&_pytest_fn_decorator.<locals>.decorate)r
)Zsqlalchemy.util.langhelpersrìZsqlalchemy.util.compatrí)rýrþr
rürr´Ws
  "r´c@sfeZdZdd„Zedd„ƒZdd„Zdd„eed    d„d
œZ    d d „Z
d d„Z dd„Z dd„Z dd„ZdS)rEcOstjj||ŽSr    )rÚskiprÔ)r rÍr+r
r
rÚskip_test_exception‹sz*PytestFixtureFunctions.skip_test_exceptioncCstjSr    )rr‰©r r
r
rÚ add_to_markerŽsz$PytestFixtureFunctions.add_to_markercCstj dd¡S)Nrärë)rr‰Z usefixturesrr
r
rÚmark_base_test_class’sÿz+PytestFixtureFunctions.mark_base_test_classcCs|Sr    r
©r¤r
r
rr{˜r|zPytestFixtureFunctions.<lambda>cCst|dƒr|jSt|ƒjS)Nr)r>rrÊrr
r
rr{›sÿ)ÚiÚrÚsÚnc
sšddlm‰t|ƒdkr2t|ddƒr2t|dƒ}| dd¡‰‡fdd„}| d    d¡}g}d
‰|r|j‰tjdd d „t    |ƒDƒžŽ}‡fd d „t    |ƒDƒ}|D]\‰t
ˆt ƒs´ˆf‰|ˆƒ\}}    ||ƒdd…}
|    rØd‰|  |
|    d  ‡fdd„|Dƒ¡f¡q nD|D]>‰t
ˆt ƒsˆf‰|ˆƒ\}}    |    r0d‰|  ||    df¡qg‰|D]6\}
}    }ˆrf|
|    f7}
tj|
d|iŽ} ˆ  | ¡qL‡‡‡‡fdd„} | S)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__ÚargnamesNcs<g}g}|D]&}t|ˆjƒr(| |¡q | |¡q ||fSr    )r†ÚcompoundrZ)r­ÚresultZgathered_exclusionsÚar    r
rÚ_filter_exclusions°s   z?PytestFixtureFunctions.combinations.<locals>._filter_exclusionsÚid_FcSsg|]\}}|dkr|‘qS))rrrrr
©r2ÚidxÚcharr
r
rr4Çsþz7PytestFixtureFunctions.combinations.<locals>.<listcomp>cs*g|]"\}}|ˆkrt |¡ˆ|f‘qSr
)ÚoperatorÚ
itemgetterr)Ú_combination_id_fnsr
rr4ÍsþTr¼c3s|]\}}||ˆƒƒVqdSr    r
)r2ÚgetterZcomb_fn)rÍr
rrÄâsz6PytestFixtureFunctions.combinations.<locals>.<genexpr>r¾csÆt |¡r:ˆrtdƒ‚d|jkr&g|_|j ˆˆf¡|St |¡jdd…}ˆdkr\|}n t     dˆ¡}ˆr°t
dd„|Dƒƒ}d|›}||g7}t ‡fdd    „ƒ}|||fd
}t j  |ˆ¡|ƒSdS) Nz5exclusions not supported for class level combinationsr¹rz, *css|]}| d¡rdVqdS)Ú _exclusionsrN)r)r2rr
r
rrÄs
zHPytestFixtureFunctions.combinations.<locals>.decorate.<locals>.<genexpr>Z _exclusions_cs4|d}|r"ˆ ¡j|Ž}||ƒ}||dd…|ŽS)NrÒ)r Úadd)r”r­r+rZexlur    r
rÚcheck_exclusionss
zOPytestFixtureFunctions.combinations.<locals>.decorate.<locals>.check_exclusions)rù)ržrŸÚNotImplementedErrorrÅr¹rZÚgetfullargspecr­rÀr¿Úsumr´rr‰Z parametrize)r”Z _fn_argnamesZ    _argnamesZ existing_exlZcurrent_exclusion_namer)r r
Úhas_exclusionsÚ pytest_paramsr
rrþÿs4
ÿ
 ÿ
 
ÿz5PytestFixtureFunctions.combinations.<locals>.decorate)r)rcr
Úlenr>r9r(rrrÚ    enumerater†r×rZr8rrÂ) r Zarg_setsr+rrZtobuild_pytest_paramsZ _arg_getterÚfnsZ    fn_paramsZparam_exclusionsÚ
parametersrÂrþr
)rrÍr r
rr rÚ combinations sh        ÿþþ
þ
 ÿýÿ   ÿ
&z#PytestFixtureFunctions.combinationscGs |d}tj|dd…d|iŽS)Nrrr¾)rrÂ)r r$Úidentr
r
rÚ param_ident'sz"PytestFixtureFunctions.param_identcszddlm‰ddlm‰t|ƒdkrFt|dƒrF|d}|dd…}nd}tj||މ‡‡‡fdd„}|rr||ƒS|SdS)Nrr0rarcsˆjrˆ |¡}ˆ|ƒ}|Sr    )r Z_maybe_async_wrapperr¨©rbr1Úfixturer
rÚwrapAs
z,PytestFixtureFunctions.fixture.<locals>.wrap)rcr1rbr!r±rr))r rÍr+r”r*r
r(rr)+s   
zPytestFixtureFunctions.fixturecCs tj d¡S)NZPYTEST_CURRENT_TEST)r?ÚenvironÚgetrr
r
rÚget_current_test_namePsz,PytestFixtureFunctions.get_current_test_namecs$ddlm‰t‡fdd„ƒ}||ƒS)Nrracsˆj|f|ž|ŽdSr    )Z_run_coroutine_functionr¬rar
rrþVsz3PytestFixtureFunctions.async_test.<locals>.decorate)rcrbr´)r r”rþr
rarÚ
async_testSs z!PytestFixtureFunctions.async_testN)rrrrÚpropertyrrÚreprrÖrr%r'r)r-r.r
r
r
rrEŠs
ü    %rE)T)-Ú
__future__rr)ryÚ    functoolsrržrÆrr?rÀrVrrrZsqla_plugin_baserÚ ImportErrorr½r/rHrGr)rNr_rdrfrnr=r›r¥r©r¡r¢rÏrÑZhookimplrÚrÛrÓrßrärër´ZFixtureFunctionsrEr
r
r
rÚ<module>sV   1&
 
 
  c
 !
 
5
 
 
 
>3