
    ,hJT                       % S SK Jr  S SKrS SKJr  S SKrS SKqS SKrS SKJ	r	  S SK
r
S SKrS SKJr  S SKJr   Sr[        R"                  " S5      rSqSqSqSqSqSqSqSrSqSqSqSqSq\" 5       r \" 5       r!Sq"S	\#S
'   S r$S r%S r&S r'S r(S r)S r*S r+S r,S r-S r.S r/S r0S r1S r2/ r3/ r4S r5S r6\5S 5       r7\5S 5       r8\6S 5       r9\6S 5       r:\5S  5       r;\6S! 5       r<\6S" 5       r=S# r>\6S$ 5       r?\6S% 5       r@\6S& 5       rAS' rBS( rCS) rDS* rES+ rFS, rGS- rHS. rIS/ rJS0 rKS1 rLS2 rMS9S3 jrNS4 rOS5 rP " S6 S7\R                  5      rRSqSS8 rTg):    )annotationsN)	Namespace)Path)Any)asyncioFzsqlalchemy.testing.plugin_baser   optionsc           	        U " SS[         [        SS9  U " SS[         [        SS9  U " SS[         S	S
S9  U " SS[        SS9  U " SS[         SSS9  U " SS[         SSS9  U " SSSSS9  U " SSSS9  U " SS[        S5      SS9  U " S S[	        S!5      S"S9  U " S#S[	        S$5      S%S9  U " S&S[	        S'5      S(S9  U " S)[         S*S+S,S-9  U " S.[         S/S0S19  U " S2SS3S4S9  U " S5[         S6S7S19  U " S8S[         [
        S9S9  U " S:S[        [         S;S<9  U " S=S[        [         S>S<9  U " S?SS@SASBSC9  U " SDSSESASFSC9  U " SG[         SHSIS19  U " SJ[         S/ SKSLSM9  U " SN[         SOSP9  U " SQSSRS9  g )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.)r   r   destr   z--dbszList available prefab dbs)r   zeroarg_callbackr   z--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)r   r   r   z--disable-asyncioz8disable test / fixtures / provisoning running in asyncio)r   r   z--backend-onlybackendz}Run only tests marked with __backend__ or __sparse_backend__; this is now equivalent to the pytest -m backend mark expressionz
--nomemorymemory_intensivezpDon't run memory profiling tests; this is now equivalent to the pytest -m 'not memory_intensive' mark expressionz--notimingintensivetiming_intensivezpDon't run timing intensive tests; this is now equivalent to the pytest -m 'not timing_intensive' mark expressionz--nomypymypyz_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   defaultr   r   z--profile-dumpprofiledumpz2Filename where a single profile run will be dumped)r   r   r   z--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)r   r
   r   r   z--exclude-tagzEExclude tests with tag <tag>; legacy, use pytest -m 'not tag' insteadz--write-profileswrite_profilesFz$Write/update failing profiling data.)r   r   r   r   z--force-write-profilesforce_write_profilesz,Unconditionally write/update profiling data.z--dump-pyannotatedump_pyannotatez/Run pyannotate and dump json info to given filez--mypy-extra-test-pathmypy_extra_test_pathszlAdditional test directories to add to the mypy tests. This is used only when running mypy tests. Multiple OK)r   r   r   r   r   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    ]/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/testing/plugin/plugin_base.pysetup_optionsr.   ;   su   ; < ' "(	 G  ;	 G
 ))4N )*<=	 )*<=	 )&1M	 9 A	 	 	 "B . 2 3  #; >	  $A !9 I    c                    SSK Jn  Xl        g)zxConfigure required state for a follower.

This invokes in the parent process and typically includes
database creation.

r   	provisionN)sqlalchemy.testingr2   FOLLOWER_IDENT)follower_identr2   s     r-   configure_followerr6      s     --r/   c                    g)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.

N dict_s    r-   !memoize_important_follower_configr;          r/   c                    g)z{Restore important configuration needed by a follower.

This invokes in the follower process.

Hook is currently not used.

Nr8   r9   s    r-   !restore_important_follower_configr>     r<   r/   c                    [         R                  " 5       q[        R                  [	        U S-  5      [	        U S-  5      /5        g )Nz	setup.cfgztest.cfg)configparserConfigParserfile_configreadr$   )	root_paths    r-   read_configrE     s:    ++-K	Y$	%s9z+A'BCr/   c                D    U q [         H  nU" [         [        5        M     g)z7things to set up early, before coverage might be setup.N)r   pre_configurerB   )optfns     r-   	pre_beginrJ     s     G
7K  r/   c                    U [         l        g N)r   has_coverage)values    r-   set_coverage_flagrO      s
     Gr/   c                     [          H  n U " [        [        5        M     SSKJq  SSKJqJqJq  SSKJ	q	J
q
Jq  SSKJqJq  SSKJq  [        R                  5         g)z9things to set up later, once we know coverage is running.r   testing)fixturesengines
exclusions)
assertionswarnings	profiling)configr2   )utilN)post_configurer   rB   
sqlalchemyrR   r3   rS   rT   rU   rV   rW   rX   rY   r2   rZ   setup_filtersrI   s    r-   
post_beginr_   $  s;     
7K   #@@BB4r/   c                t   [         (       d  SS K q [         R                  " 5         U R                  S5      (       a4  [         R                  " U5      R	                  [         R
                  5        g U R                  S5      (       a4  [         R                  " U5      R	                  [         R                  5        g g )Nr   z-infoz-debug)loggingbasicConfigendswith	getLoggersetLevelINFODEBUGopt_strrN   parsers      r-   r%   r%   6  sw    7  % ))',,7			(	#	#% ))'--8 
$r/   c            	     (   [         c  [        [        R                  " 5       5        [	        S5        [        [         R                  S5      5       H*  n[	        U<S S[         R                  SU5      < 35        M,     [        R                  " S5        g )Nz0Available --db options (use --dburi to override)r   z>20	r   )
rB   rE   r   cwdprintsortedr   getsysexit)argsmacros     r-   r&   r&   C  s^     	DHHJ	
<=++D12E;??4#?@A 3HHQKr/   c                    [        U5        g rL   )_setup_requirementsrh   s      r-   r)   r)   N  s
    r/   c                   ^  U 4S jnU$ )Nc                    > [        U TU5        g rL   )r*   ri   rN   rj   tags      r-   _do_include_tag)_set_tag_include.<locals>._do_include_tagS      Wc6*r/   r8   )rz   r{   s   ` r-   r'   r'   R      + r/   c                   ^  U 4S jnU$ )Nc                    > [        U TU5        g rL   )r+   ry   s      r-   _do_exclude_tag)_set_tag_exclude.<locals>._do_exclude_tagZ  r}   r/   r8   )rz   r   s   ` r-   r(   r(   Y  r~   r/   c                N    [         R                  UR                  SS5      5        g N-_)exclude_tagsaddreplacerh   s      r-   r+   r+   `      U]]3,-r/   c                N    [         R                  UR                  SS5      5        g r   )include_tagsr   r   rh   s      r-   r*   r*   d  r   r/   c                0    [         R                  U 5        U $ rL   )rG   r   r^   s    r-   prer   l  s    Ir/   c                0    [         R                  U 5        U $ rL   )r[   r   r^   s    r-   postr   q  s    "Ir/   c                    U q g rL   r   rH   rB   s     r-   _setup_optionsr   v  s	     Gr/   c                \    SSK Jn  UR                  SSS5        UR                  SSS5        g )Nr   )registryzsqlite.pysqlite_numericz#sqlalchemy.dialects.sqlite.pysqlite_SQLiteDialect_pysqlite_numericzsqlite.pysqlite_dollar_SQLiteDialect_pysqlite_dollar)sqlalchemy.dialectsr   register)rH   rB   r   s      r-    _register_sqlite_numeric_dialectr   |  s5    ,!-)
  -(r/   c                    [         R                  R                  SS5      S:X  a  SSKJn   U" SS9  g g ! [
         a  n[        S5      UeS nAff = f)	NREQUIRE_SQLALCHEMY_CEXT01r   )has_compiled_extT)raise_zEREQUIRE_SQLALCHEMY_CEXT is set but can't import the cython extensions)osenvironrp   sqlalchemy.utilr   ImportErrorAssertionError)rH   rB   r   errs       r-   __ensure_cextr     sX    	zz~~/5<4	D)	 =
  	 $ 	s   4 
AA

Ac                .    SSK Jn  [        5       Ul        g Nr   rY   )r3   rY   _fixture_fn_class_fixture_functions)r   rB   rY   s      r-   _init_symbolsr     s    ) 1 3Fr/   c                >    U R                   (       a  S[        l        g g NF)disable_asyncior   ENABLE_ASYNCIOr   s     r-   _set_disable_asyncior     s    
!& r/   c           
     f   SSK Jn  SSKJn  SSKJn  SSKJn  U R                  (       a  [        U R                  5      nO/ nU R                  =(       d    / nU R                  (       at  U R                   Hd  n[        R                  " SU5       HF  n	XR                  S5      ;  a  [        SU	-  5      eUR                  UR!                  SU	5      5        MH     Mf     U(       d!  UR                  UR!                  SS	5      5        S Ul        U R$                  (       a  UR&                  (       au  U V
s/ s H  oR)                  U
5      PM     sn
 HP  n
[+        U R$                  S
5       nUR-                  UR&                   SU
R/                  SS9 S35        S S S 5        MR     [        UR1                  Xg5      5      nU HY  n
[2        R5                  SU
5        UR7                  XXR&                  5      nUR"                  (       a  MH  UR9                  X5        M[     g s  sn
f ! , (       d  f       M  = f)Nr   rQ   r   r1   )urlz[,\s]+r   z:Unknown URI specifier '%s'.  Specify --dbs for known uris.r   a F)hide_password
zAdding database URL: %s)r\   rR   r3   rY   r2   sqlalchemy.enginer   r   listr   r   resplitr   RuntimeErrorr   rp   _currentr   r4   make_urlopenwriterender_as_stringgenerate_db_urlsloginfosetup_configset_as_current)r   rB   rR   rY   r2   sa_urldb_urlsextra_driversdb_tokenr   db_urlfile_expanded_urlscfgs                 r-   _engine_urir     s   "),/}}w}}%$$*Mzz

Hhhy(30066&8:<= 
 NN;??4#<= 4 # {tY78FO	 8 8=DEW6v.WEFg**C0E //0..U.CDBH 10 F 33GKLM*F3$$[*B*B
 s,   F00s   1H'/H!!
H0	c                >    UR                  SS5      n[        U5        g )Nsqla_testingrequirement_cls)rp   rv   )r   rB   r   s      r-   _requirementsr     s    !oon6GHO(r/   c                    SSK Jn  SSKJn  U R	                  S5      u  p4[        U5      nUR	                  S5      SS   H  n[        XV5      nM     [        XT5      nU" 5       =Ul        Ul        [        Ul	        g )Nr   r   rQ   :.   )
r3   rY   r\   rR   r   
__import__getattrrequirementsrequiresbootstrapped_as_sqlalchemy)argumentrY   rR   modnameclsnamemod	componentreq_clss           r-   rv   rv     sm    )"~~c*G W
C]]3'+	c% ,c#G-4Y6F'*(BF%r/   c                    SSK Jn  U R                  (       aC  SSK Jn  UR                  R                  5        H  nUR                  XDR                  5        M      g g )Nr   r   r1   )r3   rY   r   r2   Configall_configsdrop_all_schema_objectsr   )r   rB   rY   r2   r   s        r-   _prep_testing_databaser     s?    )0==,,.C--c66: / r/   c                2    SSK Jn  [        Ul        Xl        g r   )r3   rY   r   rB   )rH   rB   rY   s      r-   _post_setup_optionsr     s    )FN$r/   c                    SSK Jn  UR                  UR                  SS5      U R                  U R
                  S9Ul        g )Nr   )rX   r   profile_file)sortdump)r3   rX   ProfileStatsFilerp   r   r   _profile_stats)r   rB   rX   s      r-   _setup_profilingr     s=    ,(997      :  Ir/   c                r    [        U[        R                  5      (       d  gU R                  S5      (       a  gg)NFr   T)
issubclassrS   TestBase
startswith)nameclss     r-   
want_classr     s-    c8,,--			r/   c                b    UR                   R                  S5      (       d  gUR                  c  gg)Ntest_FT)__name__r   
__module__)r   rI   s     r-   want_methodr     s*    ;;!!'**		r/   c              #  J  #    SU;   d  SU;   a  SU;   n[        XS9 H|  nU R                  n[        R                  " SSUR                  5      n[        R                  " SSU5      nU R                  < SU< 3n[        UU 4XTS.5      n[        XU5        Uv   M~     g U v   g 7f)	Nr   sparse_backend)sparsez
[_\[\]\.]+r   z_+$ )_sa_orig_cls_name__only_on_config__)_possible_configs_for_clsr   r   subr   r   setattr)	r   modulemarkersr  r   	orig_name
alpha_namer   subclss	            r-   generate_sub_testsr  !  s     G/7:!W,,S@CI sCHH=JJ7J!llJ7D&/KF
 F&)L! A$ 	s   B!B#c                0    [        U 5        [        U 5        g rL   )	_do_skips_setup_enginer   s    r-   !start_test_class_outside_fixturesr  9  s    cN#r/   c                j    [         R                  U 5        [        R                  R                  5         g rL   )rS   stop_test_class_inside_fixturesrT   testing_reaperr  s    r-   stop_test_classr  >  s$    ,,S1 ::<r/   c                   [         R                  R                  5         [        R                  [        [        R
                  U 5         [        R                  (       d  [        R                  5         [        5         g ! [        5         f = frL   )rT   r   stop_test_class_outside_fixturesr2   rY   r   r   r   rV   global_cleanup_assertions_restore_enginer  s    r-   r  r  G  sQ    ;;=..vvyy#F&&002s   	)A= =B	c                 v    [         R                  (       a$  [         R                  R                  [        5        g g rL   )rY   r   resetrR   r8   r/   r-   r  r  Q  s     g& r/   c                 |    [         R                  R                  5         [        R	                  5         [        5         g rL   )rT   r  final_cleanuprV   r  r  r8   r/   r-   final_process_cleanupr  V  s&    ((*((*r/   c                    [        U SS 5      (       aR  [        U R                  5      nSUS'   [        R	                  US9n[
        R                  R                  U[        5        g g )N__engine_options__classscoper   )	r   dictr!  rT   testing_enginerY   r   push_enginerR   )r   optsengs      r-   r  r  \  sW    s($//C**+W$$T$2##C1	 0r/   c                v    [        USUR                  5      nU< SU< SU< 3n[        R                  U5        g )Nr  r   )r   r   rX   _start_current_test)testtest_module_name
test_class	test_namer   id_s         r-   before_testr0  d  s3     :2J4G4GHD($	
:C!!#&r/   c                h    [         R                  5         [        R                  R                  5         g rL   )rS   
after_testrT   r  r+  s    r-   r2  r2  o  s     %%'r/   c                B    [         R                  R                  U 5        g rL   )rT   r  after_test_outside_fixturesr3  s    r-   after_test_fixturesr6  t  s    66t<r/   c                z   [        [        R                  R                  5       5      nU R                  (       aO  [
        R                  " U R                  6 n[        U5       H#  nU" U5      (       d  M  UR                  U5        M%     [        U SS 5      (       ab  [
        R                  " [        R                  U R                  5      6 n[        U5       H#  nU" U5      (       a  M  UR                  U5        M%     [        U SS 5      (       a  UR                  U R                  /5        [        U S5      (       a  [        R                   n[        U5       Ha  nU R"                   HN  n[        Xg5      nUR%                  U5      n	U	(       d  M(  UR                  U5        Ub  UR'                  U	5          M_     Mc     [        U S5      (       a  [        5       n
[        R                   n[        U5       HJ  nU R(                   H7  n[        Xg5      nUR+                  U5      (       a  M&  U
R-                  U5        M9     ML     UR/                  U
5      (       a  UR1                  U
5        U(       aN  0 n[3        [5        US S95       H$  nUR6                  R8                  nX;  d  M   XU'   M&     UR;                  5       $ U$ )N__only_on__r  __requires____prefer_requires__c                    U R                   R                  U R                   R                  U R                   R                  R                  4$ rL   )r   r   driverdialectserver_version_info)r   s    r-   <lambda>+_possible_configs_for_cls.<locals>.<lambda>  s.    FFKKFFMMFFNN66!r/   )key)setrY   r   r   __unsupported_on__rU   db_specr   remover   rZ   to_listr8  intersection_updater  hasattrr   r9  matching_config_reasonsextendr:  enabled_for_configr   
differencedifference_updatereversedro   r   r   values)r   reasonsr  r   spec
config_objr   requirementcheckskip_reasonsnon_preferredper_dialectr   r   s                 r-   r  r  x  s?   fmm//12K
!!3#9#9:{+JJ"":. , sM4((!!4<<#@A{+J
##"":. , s($//'')?)?(@AsN##**{+J"//:$<<ZH<&&z2*|4  0 , s)****{+J"66://
;;!%%j1	  7 , !!-00))-8 	
C B$"%B	
 !!##r/   c           
        / n[        X5      n[        U SS5      (       aR  [        U S5       HB  nU" 5       (       d  M  [        R                  SU R                  < SUR                  < 35        MD     U(       d|  SU R
                  < SU R                  < SSR                  S [        R                  R                  5        5       5      < SR                  U5      < 3n[        R                  U5        O[        U S	5      (       a  [        5       n[        R                  " [        R                  U R                  5      6 nU H#  nU" U5      (       a  M  UR!                  U5        M%     UR#                  U5      (       a  UR%                  U5        [        R&                  U;  a  [)        UR+                  5       U 5        g g )
N__skip_if__F'z' skipped by r   z'' unsupported on any DB implementation z, c           
   3     #    U  Ho  nS UR                   R                  < SSR                  S [        R	                  UR                   5       5       5      < SUR                   R
                  < S 3v   Mq     g7f)rZ  (r   c              3  8   #    U  H  n[        U5      v   M     g 7frL   )r$   ).0digs     r-   	<genexpr>&_do_skips.<locals>.<genexpr>.<genexpr>  s      #LC C#Ls   z)+N)r   r   joinrU   _server_versionr<  )r^  rR  s     r-   r`  _do_skips.<locals>.<genexpr>  sa       #>J MM&&HH #-#=#=jmm#L  MM(( #>s   A7A9__prefer_backends__)r  r   rY   	skip_testr   r   rb  r   r   rH  rB  rU   rD  rZ   rF  re  r   rL  rM  r   _setup_configpop)r   rP  r   cmsgrV  rQ  rR  s           r-   r  r    sP   G+C9KsM5))m,Ass  ,/LL!**E - NNLLII  #)--";";"=  IIg
" 		+	,	,!!4<<0G0G#HI%J
##!!*- & !!-00))-8k)koo'- *r/   c                L    [         R                  R                  U [        5        g rL   )rY   r   pushrR   )rR  ctxs     r-   rg  rg    s    
OOW-r/   c                      \ rS rSr\R
                  S 5       r\R
                  S 5       r\R
                  S 5       r\R
                  S 5       r	S r
\R
                  SS j5       r\R                  S 5       rS	rg
)FixtureFunctionsi  c                    [        5       erL   NotImplementedErrorselfargkws      r-   skip_test_exception$FixtureFunctions.skip_test_exception      !##r/   c                    [        5       erL   rq  rt  rs   rv  s      r-   combinationsFixtureFunctions.combinations  ry  r/   c                    [        5       erL   rq  r{  s      r-   param_identFixtureFunctions.param_ident  ry  r/   c                    [        5       erL   rq  rs  s      r-   fixtureFixtureFunctions.fixture  ry  r/   c                    [        5       erL   rq  rt  s    r-   get_current_test_name&FixtureFunctions.get_current_test_name  s    !##r/   c                    [        5       erL   rq  r  s    r-   mark_base_test_class%FixtureFunctions.mark_base_test_class  ry  r/   c                    [        5       erL   rq  r  s    r-   add_to_markerFixtureFunctions.add_to_marker  ry  r/   r8   N)returnr   )r   r   __qualname____firstlineno__abcabstractmethodrw  r|  r  r  r  r  abstractpropertyr  __static_attributes__r8   r/   r-   ro  ro    s    $ $ 	$ $ 	$ $ 	$ $$ 	$ $ 	$ $r/   ro  c                    U q g rL   )r   )fixture_fn_classs    r-   set_fixture_functionsr  	  s    (r/   r   )U
__future__r   r  argparser   r@   ra   r   pathlibr   r   rq   typingr   r3   r   r   rd   r   rS   rT   rU   rW   rX   r2   rV   r   rY   rR   rZ   rB   rB  r   r   r   __annotations__r.   r6   r;   r>   rE   rJ   rO   r_   r%   r&   r)   r'   r(   r+   r*   rG   r[   r   r   r   r   r   r   r   r   r   rv   r   r   r   r   r   r  r  r  r  r  r  r  r0  r2  r6  r  r  rg  ABCro  r   r  r8   r/   r-   <module>r     s=   # 
    	  	 
  & # 89 

		
	

uu rj	.!!$
9.. 

  
   
 
 4 4 ' '
 .- .-b ) )
C$ ; ; % %  0
='
2'(
=?D(.V.$sww $:  )r/   