
    -h+T                        S r SSKJr  SSKrSSKqSSKrSSKrSr[        R                  " S5      r	\R                  S:  r\(       a  SSKr\R                  rOSSKrSSKr " S 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       q\" 5       q Sq!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 r./ r// r0S r1S r2\1S 5       r3\1S 5       r4\1S 5       r5\1S 5       r6\2S 5       r7\1S 5       r8\2S 5       r9\2S 5       r:S  r;\2S! 5       r<\2S" 5       r=\2S# 5       r>\2S$ 5       r?S% r@S& rAS' rBS( rCS) rDS* rES+ rFS, rGS- rHS. rIS/ rJS0 rKS7S1 jrLS2 rMS3 rN " S4 S5\5      rOSqPS6 rQg)8zTesting 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_importNFzsqlalchemy.testing.plugin_base)   r   c                   ,    \ rS rSr\R
                  rSrg)ABC)    N)__name__
__module____qualname____firstlineno__abcABCMeta__metaclass____static_attributes__r       zC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\sqlalchemy/testing/plugin/plugin_base.pyr   r   )   s    r   r   c           	         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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/[         S0S19  U " S2SS3S4S9  U " S5[         S6S7S.9  U " S8SS9S:S;S<9  U " S=S[         [        S>S9  U " S?SS@S:SAS<9  U " SBS[        [         SCSD9  U " SES[
        [         SFSD9  U " SGSSHS:SIS<9  U " SJSSKS:SLS<9  U " SM[         SNSOS.9  U " SP[         S/ SQSRSS9  g )TNz
--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backend_onlyz<Run only tests marked with __backend__ or __sparse_backend__z
--nomemorynomemoryz Don't run memory profiling testsz--notimingintensivenotimingintensivez Don't run timing intensive testsz--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--postgresql-templatedbz^name of template database to use for PostgreSQL CREATE DATABASE (defaults to current database))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--reversetop
reversetopFzTUse a random-ordering set implementation in the ORM (helps reveal dependency issues))r   r   r%   r   z--requirementsz3requirements class for testing, overrides setup.cfgz--with-cdecimalcdecimalzDMonkeypatch the cdecimal library into Python 'decimal' for all testsz--include-tagzInclude tests with tag <tag>)r   r   r   r   z--exclude-tagzExclude tests with tag <tag>z--write-profileswrite_profilesz$Write/update failing profiling data.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   )str_log	_list_dbs_requirements_opt_include_tag_exclude_tag)make_options    r   setup_optionsr6   A   s^   ; < ' "(	 J  ;	 G
 K	 /	  /	 9 A	 !9 	 	 + "B  + + 3  #; >	  $Ar   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.testingr9   FOLLOWER_IDENT)follower_identr9   s     r   configure_followerr=      s     --r   c                 $    [         [        S.U S'   g)a?  Store 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_tagsmemoized_configNr?   dict_s    r   !memoize_important_follower_configrE      s     %$ E
r   c                 p    [         R                  U S   S   5        [        R                  U S   S   5        g)z^Restore important configuration needed by a follower.

This invokes in the follower process.

rB   r@   rA   N)r@   updaterA   rC   s    r   !restore_important_follower_configrH     s6     /0@A/0@Ar   c                  \    [         R                  " 5       q[        R                  SS/5        g )Nz	setup.cfgztest.cfg)configparserConfigParserfile_configreadr   r   r   read_configrN     s#    ++-Kk:./r   c                 D    U q [         H  nU" [         [        5        M     g)z7things to set up early, before coverage might be setup.N)optionspre_configurerL   )optfns     r   	pre_beginrT     s     G
7K  r   c                     U [         l        g N)rP   has_coverage)values    r   set_coverage_flagrY   %  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)configr9   )utilN)post_configurerP   rL   
sqlalchemyr\   r:   r]   r^   r_   r`   ra   rb   rc   r9   rd   setup_filtersrS   s    r   
post_beginri   )  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_strrX   parsers      r   r0   r0   ;  sw    7  % ))',,7			(	#	#% ))'--8 
$r   c            	          [        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   )printsortedrL   rP   getsysexit)argsmacros     r   r1   r1   H  sH    	
<=++D12E;??4#?@A 3HHQKr   c                     [        U5        g rV   )_setup_requirementsrr   s      r   r2   r2   O  s
    r   c                 N    [         R                  UR                  SS5      5        g N-_)rA   addreplacerr   s      r   r4   r4   S      U]]3,-r   c                 N    [         R                  UR                  SS5      5        g r   )r@   r   r   rr   s      r   r3   r3   W  r   r   c                 0    [         R                  U 5        U $ rV   )rQ   r   rh   s    r   prer   _  s    Ir   c                 0    [         R                  U 5        U $ rV   )re   r   rh   s    r   postr   d  s    "Ir   c                     U q g rV   rP   rR   rL   s     r   _setup_optionsr   i  s	     Gr   c                 R    U R                   (       a  [        R                  S5        g g )Nmemory_intensive)r!   rA   r   r   s     r   _set_nomemoryr   o  s    
||+, r   c                 R    U R                   (       a  [        R                  S5        g g )Ntiming_intensive)r"   rA   r   r   s     r   _set_notimingintensiver   u  s    
+, r   c                 V    U R                   (       a  SS K nU[        R                  S'   g g )Nr   decimal)r*   rz   modules)rP   rL   r*   s      r   _monkeypatch_cdecimalr   {  s!    !)I r   c                 .    SSK Jn  [        5       Ul        g Nr   rc   )r:   rc   _fixture_fn_class_fixture_functions)rP   rL   rc   s      r   _init_symbolsr     s    ) 1 3Fr   c                 X    U R                   (       d  [        (       d  SSKJn  SUl        g g )Nr   )asyncioF)disable_asynciopy3kr:   r   ENABLE_ASYNCIO)rR   rL   r   s      r   _set_disable_asyncior     s    
$$.!& #'r   c                    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!                  XV5      5      n	U	 H  n
["        R%                  S	U
5        U R&                  (       aT  UR(                  (       aC  [+        U R&                  S
5       nUR-                  UR(                  S-   U
-   S-   5        S S S 5        UR/                  XXR(                  5      nUR                  (       a  M  UR1                  X5        M     g ! , (       d  f       NS= f)Nr   r[   r   r8   z[,\s]+r   z:Unknown URI specifier '%s'.  Specify --dbs for known uris.r%   zAdding database URL: %sa 
)rf   r\   r:   rc   r9   r   listr   r   resplitrP   RuntimeErrorr   ry   _currentgenerate_db_urlsloginfor(   r;   openwritesetup_configset_as_current)rP   rL   r\   rc   r9   db_urlsextra_driversdb_tokenr   expanded_urlsdb_urlfile_cfgs                r   _engine_urir     s~    #),}}w}}%$$*Mzz

Hhhy(30066&8:<= 
 NN;??4#<= 4 # {tY78FO33GKLM*F3I$<$<g**C0EI44s:VCdJK 1 $$[*B*B
 s,   10s   2%G$$
G2	c                 >    UR                  SS5      n[        U5        g )Nsqla_testingrequirement_cls)ry   r   )rP   rL   r   s      r   _requirementsr     s     "oon6GHO(r   c                    SSK Jn  SSKJn  UR                  b  g 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   r[   :.   )
r:   rc   rf   r\   requirementsr   
__import__getattrrequiresbootstrapped_as_sqlalchemy)argumentrc   r\   modnameclsnamemod	componentreq_clss           r   r   r     s|    )"&~~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   r8   )r:   rc   r   r9   Configall_configsdrop_all_schema_objectsr   )rP   rL   rc   r9   r   s        r   _prep_testing_databaser     s?    )0==,,.C--c66: / r   c                 B    U R                   (       a  SSKJn  U" 5         g g )Nr   )randomize_unitofwork)r)   sqlalchemy.orm.utilr   )rP   rL   r   s      r   _reverse_topologicalr     s    < r   c                 2    SSK Jn  [        Ul        Xl        g r   )r:   rc   rP   rL   )rR   rL   rc   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   )rb   r   profile_file)sortdump)r:   rb   ProfileStatsFilery   r$   r&   _profile_stats)rP   rL   rb   s      r   _setup_profilingr     s=    ,(997      :  Ir   c                    [        U[        R                  5      (       d  gU R                  S5      (       a  g[        R
                  R                  (       a7  [        USS5      (       d%  [        USS5      (       d  [        USS5      (       d  gg)NFr   __backend____sparse_backend____only_on__T)
issubclassr]   TestBase
startswithrc   rP   r    r   )nameclss     r   
want_classr     sk    c8,,--			##]E221599]E22r   c                    UR                   R                  S5      (       d  gUR                  c  g[        (       a  [	        U S5      =(       a7    [
        R                  U R                  5      R                  [        [        5      =(       d7    [	        US5      =(       a$    UR                  R                  [        [        5      $ [        (       aH  [	        U S5      (       a7  [
        R                  U R                  5      R                  [        [        5      $ [        (       a5  [	        US5      (       a$  UR                  R                  [        [        5      $ g)Ntest_F__tags___sa_exclusion_extendT)r	   r   r
   r@   hasattrr_   tagsr   include_testrA   r   )r   rS   s     r   want_methodr     s    ;;!!'**			C$ -::l

 B./ ''44l
	
 
'#z22s||,99,
 	
 
'"&<==&&33L,OOr   c              #     #    [        U SS5      (       d  [        U SS5      (       a  [        U SS5      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XCS	.5      n[        XU5        Uv   M~     g U v   g 7f)
Nr   Fr   )sparsez
[_\[\]\.]+r   z_+$ )_sa_orig_cls_name__only_on_config__)r   _possible_configs_for_clsr	   r   subr   r   setattr)r   moduler   r   	orig_name
alpha_namer   subclss           r   generate_sub_testsr  -  s     sM5))W!5. . 2E:,S@CI sCHH=JJ7J!llJ7D&/KF
 F&)L! A$ 	s   CCc                 0    [        U 5        [        U 5        g rV   )	_do_skips_setup_enginer   s    r   !start_test_class_outside_fixturesr  G  s    cN#r   c                 j    [         R                  U 5        [        R                  R                  5         g rV   )r]   stop_test_class_inside_fixturesr^   testing_reaperr  s    r   stop_test_classr
  L  s$    ,,S1 ::<r   c                    [         R                  R                  5         [        R                  [        [        R
                  U 5         [        R                  (       d  [        R                  5         [        5         g ! [        5         f = frV   )r^   r	   stop_test_class_outside_fixturesr9   rc   r   rP   r'   r`   global_cleanup_assertions_restore_enginer  s    r   r  r  U  sQ    ;;=..vvyy#F&&002s   	)A= =B	c                  v    [         R                  (       a$  [         R                  R                  [        5        g g rV   )rc   r   resetr\   r   r   r   r  r  _  s     g& r   c                  |    [         R                  R                  5         [        R	                  5         [        5         g rV   )r^   r	  final_cleanupr`   r  r  r   r   r   final_process_cleanupr  d  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  r^   testing_enginerc   r   push_enginer\   )r   optsengs      r   r  r  j  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	   rb   _start_current_test)testtest_module_name
test_class	test_namer   id_s         r   before_testr$  r  s3    
 :2J4G4GHD($	
:C!!#&r   c                 h    [         R                  5         [        R                  R                  5         g rV   )r]   
after_testr^   r	  r  s    r   r&  r&  ~  s     %%'r   c                 B    [         R                  R                  U 5        g rV   )r^   r	  after_test_outside_fixturesr'  s    r   after_test_fixturesr*    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$ )Nr   r   __requires____prefer_requires__c                     U R                   R                  U R                   R                  U R                   R                  R                  4$ rV   )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)setrc   r   r   __unsupported_on__r_   db_specr   remover   rd   to_listr   intersection_updater   r   r   r,  matching_config_reasonsextendr-  enabled_for_configr   
differencedifference_updatereversedrx   r   r   values)r   reasonsr   r   spec
config_objr   requirementcheckskip_reasonsnon_preferredper_dialectr   r   s                 r   r   r     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                 d   / 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(       dn  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 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)rL  (r   c              3   8   #    U  H  n[        U5      v   M     g 7frV   )r/   ).0digs     r   	<genexpr>&_do_skips.<locals>.<genexpr>.<genexpr>  s      #LC C#Ls   z)+N)r   r   joinr_   _server_versionr/  )rP  rD  s     r   rR  _do_skips.<locals>.<genexpr>  sa       #>J MM&&HH #-#=#=jmm#L  MM(( #>s   A7A9__prefer_backends__)r   r   rc   	skip_testr	   rT  r   r   r   r5  r_   r7  rd   r9  rW  r   r>  r?  r   _setup_configpop)r   rB  r   cmsgrH  rC  rD  s           r   r  r    sI   G+C9KsM5))m,Ass  ,/LL!**E - LLII  #)--";";"=  IIg
  		+	,	,!!4<<0G0G#HI%J
##!!*- & !!-00))-8k)koo'- *r   c                 L    [         R                  R                  U [        5        g rV   )rc   r   pushr\   )rD  ctxs     r   rY  rY    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 5       rSrg	)
FixtureFunctionsi  c                     [        5       erV   NotImplementedErrorselfargkws      r   skip_test_exception$FixtureFunctions.skip_test_exception      !##r   c                     [        5       erV   rc  rf  r|   rh  s      r   combinationsFixtureFunctions.combinations  rk  r   c                     [        5       erV   rc  rm  s      r   param_identFixtureFunctions.param_ident   rk  r   c                     [        5       erV   rc  re  s      r   fixtureFixtureFunctions.fixture  rk  r   c                     [        5       erV   rc  rf  s    r   get_current_test_name&FixtureFunctions.get_current_test_name  s    !##r   c                     [        5       erV   rc  rw  s    r   mark_base_test_class%FixtureFunctions.mark_base_test_class  rk  r   r   N)r	   r
   r   r   r   abstractmethodri  rn  rq  rt  rx  r{  r   r   r   r   ra  ra    s    $ $ 	$ $ 	$ $ 	$ $$ 	$ $r   ra  c                     U q g rV   )r   )fixture_fn_classs    r   set_fixture_functionsr    s    (r   )NF)R__doc__
__future__r   r   rk   r   rz   r   rn   r   version_infor   rJ   r   rK   collectionscollections_abcobjectr]   r^   r_   ra   rb   r9   r`   r   rc   r\   rd   rL   r5  r@   rA   rP   r6   r=   rE   rH   rN   rT   rY   ri   r0   r1   r2   r4   r3   rQ   re   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r  r$  r&  r*  r   r  rY  ra  r   r  r   r   r   <module>r     st   ' 
  	 
 # 89 6!
''C')$f $
 

		
	

uu
l^	. B0!!$
9.. 

  
 - -
 - -
 * * 4 4 ' ' *- *-Z ) )C* ; ;   % %   64
='
2	'(
=?D'.T.$s $2  )r   