
    Xi_                       S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SS	KrSS	KrSS	KrSS	KrSS
KJr  SSKJr  SSKJr  SS	KrSSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK J!r!  SSK J"r"  SSK#J$r$  SSK#J%r%  SSK#J&r&  SSK#J'r'  SSK(J)r)  SSK(J*r*  SSK(J+r+  SSK,J-r-  SSK,J.r.  SSK/J0r0  SSK/J1r1  \Rd                  S	S  S!:  a  SS"K3J4r4  \(       a  SS#KJ5r5  SS	KrSS	K6r7\8\9\:   \:\Rj                  4   \8S$   -  r;        S6S% jr< " S& S'\)5      r= " S( S)\*5      r>\" S*S+9S7S, j5       r?S8S- jr@S9S. jrA " S/ S0\
5      rBS:S1 jrCS2rD\" S*S39S;S4 j5       rE    S<S5 jrFg	)=z4Discover and run std-library "unittest" style tests.    )annotations)Callable)	Generator)Iterable)Iterator)auto)EnumN)Any)TYPE_CHECKING)TestCase)ExceptionInfo)assert_never)is_async_function)hookimpl)FixtureRequest)MonkeyPatch)	Collector)Item)exit)fail)skip)xfail)Class)Function)Module)CallInfo)check_interactive_exception)SubtestContext)SubtestReport         )ExceptionGroup)TracebackType)NNNc                     [         R                  S   n[        X#R                  5      (       d  g  [
        R                  " U5      (       a  g [        R                  XUS9$ ! [         a     g f = f)Nunittest)nameobj)	sysmodules
issubclassr   	Exceptioninspect
isabstractUnitTestCasefrom_parent)	collectorr(   r)   uts       C/var/www/html/venv/lib/python3.13/site-packages/_pytest/unittest.pypytest_pycollect_makeitemr5   :   sn    [[$ #{{++ , ###Ic#BB  s   -A! !
A.-A.c                  <    \ rS rSrSrS rS	S jrS
S jrS
S jrSr	g)r0   N   Tc                $    U R                  S5      $ )NrunTestr)   selfs    r4   newinstanceUnitTestCase.newinstanceS   s     xx	""    c              #    #    SSK Jn  U R                  n[        USS5      (       d  g [	        U5      nU(       d2  U R                  U5        U R                  U5        U R                  5         U R                  R                  R                  U R                  5       U R                  5        U" 5       nSnUR                  U R                  5       HD  n[        U R                  U5      n[        USS5      (       d  M-  [        R                  XS9v   SnMF     U(       do  [        U R                  SS 5      nUbT  [         R"                  R%                  SS 5      n	U	b  XR&                  R(                  :w  a  [        R                  U SS9v   g g g g 7f)	Nr   )
TestLoader__test__TF)r(   r9   twisted.trial.unittest)r'   rA   r)   getattr_is_skipped'_register_unittest_setup_method_fixture&_register_unittest_setup_class_fixture_register_setup_class_fixturesession_fixturemanagerparsefactoriesr=   nodeidgetTestCaseNamesTestCaseFunctionr1   r*   r+   getr   r9   )
r<   rA   clsskippedloaderfoundsomethingr(   xruntestr3   s
             r4   collectUnitTestCase.collect[   sK    'hhsJ--c"88=77<..0$$33D4D4D4FT++DHH5D$'A1j$//"..t.??!N 6 dhh	48G"[[__%=tD:KK,?,?!?*66t)6LL "@ # s   FFc                  ^^^^^ [        TSS5      m[        TSS5      mTc  Tc  g[        TSS 5      mSU4S jjm    SUUUU4S jjnU R                  R                  R                  STR                   3UU R
                  S	S
S9  g)zKRegister an auto-use fixture to invoke setUpClass and
tearDownClass (#517).
setUpClassNtearDownClassdoClassCleanupsc                     g N r^   r?   r4   <lambda>EUnitTestCase._register_unittest_setup_class_fixture.<locals>.<lambda>   s    $r?   c                    > [        TSS 5      n U (       d  g U  VVs/ s H  u  poPM	     nnn[        U5      S:X  a  US   e[        SU5      es  snnf )NtearDown_exceptions   r   zUnittest class cleanup errors)rD   lenr$   )	exc_infos_exc
exceptionsrP   s       r4   process_teardown_exceptionsXUnitTestCase._register_unittest_setup_class_fixture.<locals>.process_teardown_exceptions   s]      %:DAI1:;+11#J; :!# m#$%DjQQ <s   Ac              3  8  >#    U R                   n[        U5      (       a!  UR                  n[        R                  " USS9eTb   T" 5         S v    Tb  T" 5         T" 5         T" 5         g ! [         a    T" 5         T" 5         e f = f! T" 5         T" 5         f = f7fNT)_use_item_location)rP   rE   __unittest_skip_why__r   r-   )requestrP   reasoncleanupri   setupteardowns      r4   unittest_setup_class_fixtureYUnitTestCase._register_unittest_setup_class_fixture.<locals>.unittest_setup_class_fixture   s      ++C322nnVEE G .'J	+- ! I/1 	+-s6   ABA* B
B B*BBBB_unittest_setUpClass_fixture_classTr(   funcrL   scopeautousereturnNonero   r   r}   zGenerator[None]rD   rI   rJ   _register_fixture__qualname__rL   )r<   rP   rt   rq   ri   rr   rs   s    ` @@@@r4   rG   3UnitTestCase._register_unittest_setup_class_fixturez   s     \4036=X-#0,?	R	.#	.	. 	.0 	$$6601A1A0BC-;; 	7 	
r?   c                   ^^ [        USS5      m[        USS5      mTc  Tc  g    S	UU4S jjnU R                  R                  R                  SUR                   3UU R
                  SSS9  g)
zORegister an auto-use fixture to invoke setup_method and
teardown_method (#517).setup_methodNteardown_methodc              3     >#    U R                   n[        U5      (       a!  UR                  n[        R                  " USS9eTb  T" XR
                  5        S v   Tb  T" XR
                  5        g g 7frl   )instancerE   rn   r   r-   function)ro   r<   rp   rr   rs   s      r4   unittest_setup_method_fixture[UnitTestCase._register_unittest_setup_method_fixture.<locals>.unittest_setup_method_fixture   sj      ##D4  33nnVEE d,,-#//0 $s   A.A1_unittest_setup_method_fixture_r   Trx   r   r   )r<   rP   r   rr   rs   s      @@r4   rF   4UnitTestCase._register_unittest_setup_method_fixture   s     ^T23 148=X-	1#	1	1 	1 	$$66233C3C2DE.;; 	7 	
r?   r^   N)r}   zIterable[Item | Collector])rP   typer}   r~   )
__name__
__module__r   __firstlineno__
nofuncargsr=   rV   rG   rF   __static_attributes__r^   r?   r4   r0   r0   N   s     J#M>6
p
r?   r0   c                  f  ^  \ rS rSr% SrSrSrS\S'   S r\	S 5       r
SU 4S	 jjrSU 4S
 jjrSS jrSS jr      SS jr      SS jrSS.       SS jjr S        S!S jjr S"     S#S jjrSS jrSS jrS$S jrSS jr    S%U 4S jjr        S&S jrS'S jrSrU =r$ )(rN      TFNz7list[_pytest._code.ExceptionInfo[BaseException]] | None_excinfoc                    [        U R                  [        5      (       d   eU R                  R                  U R                  5      $ r]   )
isinstanceparentr0   r)   r(   r;   s    r4   _getinstanceTestCaseFunction._getinstance   s0    $++|4444{{tyy))r?   c                    U R                   $ r]   )r   r;   s    r4   	_testcaseTestCaseFunction._testcase   s    }}r?   c                h   > S U l         [        TU ]	  5         [        R                  S:  a  S U l        g g )Nr!   )_explicit_tearDownsuperrr   r*   version_info_cached_errors_and_skipsr<   	__class__s    r4   rr   TestCaseFunction.setup   s3    =Ag% QUD) &r?   c                |   > U R                   b  U R                  5         S U l         S U l        U ?[        TU ]  5         g r]   )r   _obj	_instancer   rs   r   s    r4   rs   TestCaseFunction.teardown   s:    "".##%&*D#	Nr?   c                    g r]   r^   r<   testcases     r4   	startTestTestCaseFunction.startTest       r?   c                   [        U5      n [        R                  R                  [           R                  U5      nUR                  nUR                  nU R                   R#                  S/ 5      R%                  W5        g ! [         a      [        R                  " U6 nUR                  SS5        [        SR                  U5      SS9   Nx! [        R                  [        4 a    e [         a    [        SU< 3SS9    Nf = f! [         a    e [        R                   a,    [        R                  R                  R                  5       n  Nf = ff = f)Nr   zCNOTE: Incompatible Exception Representation, displaying natively:

 Fpytracez6ERROR: Unknown Incompatible Exception representation:
r   )_handle_twisted_exc_info_pytest_coder   BaseExceptionfrom_exc_infovalue	traceback	TypeErrorformat_exceptioninsertr   joinr-   KeyboardInterruptfrom_current__dict__
setdefaultappend)r<   
rawexcinfoexcinforf   valuess        r4   _addexcinfoTestCaseFunction._addexcinfo   s8   -j9
	Emm11-@NNG
 A!!A. 	  R077@-  	EE&77DFMM3
 %8(9: $ ,,6>; % % >> E!--55BBDE)	EsC   AB 
E>C2D?DDDAEEEEc                     [        US   [        R                  5      (       a  [        US   R                  5        U R                  U5        g ! [         a     Nf = f)Nrc   )r   r   r-   msgr   r   r<   r   r   s      r4   addErrorTestCaseFunction.addError  sR    	*Q-88Z]&&' 	$  		s   :A 
AAc                &    U R                  U5        g r]   )r   r   s      r4   
addFailureTestCaseFunction.addFailure   s     	$r?   handle_subtestsc                 ^ ^ SSK Jn  SUU 4S jjnU(       d  U" 5         g [        X5      (       aA  U" 5         T R                  b,  T R                  S   nT R	                  UR
                  X5        g g [        R                  S:  aA  T R                  R                  b*  T R                  5       u  px[        U5      S:X  a  U" 5         g g U" 5         g )Nr   _SubTestc                    >  [         R                  " T SS9e! [         R                   a'    TR                  [        R                  " 5       5         g f = frl   )r   r-   r   r*   exc_info)rp   r<   s   r4   add_skip*TestCaseFunction.addSkip.<locals>.add_skip*  s@    1nnVEE>> 1  01s    8AAr!   r|   )unittest.caser   r   r   
addSubTest	test_caser*   r   r   _outcome_obtain_errors_and_skipsrd   )	r<   r   rp   r   r   r   r   subtest_errorsrf   s	   ` `      r4   addSkipTestCaseFunction.addSkip%  s     	+	1 	1 Jh))J}}(==, 2 2HG ) ')dmm.D.D.P$($A$A$C!~&!+J , 
r?   c                     [        [        U5      5        g ! [         R                   a'    U R                  [        R
                  " 5       5         g f = fr]   )r   strr-   r   r*   r   )r<   r   r   rp   s       r4   addExpectedFailure#TestCaseFunction.addExpectedFailureF  s:    	-#f+ 	-S\\^,	-s    8AAc                    SnU(       a  USUR                    3-  n [        USS9  g ! [        R                   a'    U R                  [        R
                  " 5       5         g f = f)NzUnexpected successz: Fr   )rp   r   r-   r   r*   r   )r<   r   rp   r   s       r4   addUnexpectedSuccess%TestCaseFunction.addUnexpectedSuccessQ  sW    
 #R''C	-e$~~ 	-S\\^,	-s   
( 8A#"A#c                    g r]   r^   r   s     r4   
addSuccessTestCaseFunction.addSuccess_  r   r?   c                    g r]   r^   r   s     r4   stopTestTestCaseFunction.stopTestb  r   r?   c                    g r]   r^   )r<   r   elapseds      r4   addDurationTestCaseFunction.addDuratione  r   r?   c                t   SSK Jn  U R                  nUc   eU" U 5        [        U R                  5      (       a  U" U S9  g [        U R                  [        5      (       d   e[        U R                  5      =(       d    [        U R                  R                  5      nU R                  R                  S5      (       a&  U(       d  UR                  U l        [        USS 5        [        X R                  U R                  5         U" U S9  [        X R                  5        g ! [        X R                  5        f = f)Nr   )&maybe_wrap_pytest_function_for_tracing)resultusepdbtearDownc                     g r]   r^   )argss    r4   r_   *TestCaseFunction.runtest.<locals>.<lambda>  s    Dr?   )_pytest.debuggingr   r   r   r)   r   r   r0   rE   config	getoptionr   r   setattrr(   delattr)r<   r   r   rQ   s       r4   rU   TestCaseFunction.runtesth  s    L==###.t4 TXX&&D! dkk<8888!$((+K{4;;??/KG{{$$X..w*2*;*;'*.@A Hii2-%)),)),s   D   D7c                ^   > [         TU ]  U5      nUR                  " S 5      nU(       d  UnU$ )Nc                V    U R                   R                  R                  S5      (       + $ )N
__unittest)frame	f_globalsrO   )rT   s    r4   r_   4TestCaseFunction._traceback_filter.<locals>.<lambda>  s    !''++//==r?   )r   _traceback_filterfilter)r<   r   r   
ntracebackr   s       r4   r	  "TestCaseFunction._traceback_filter  s7     G-g6	%%=

 "Jr?   c           
         SSK Jn  U=[        S` =b  u     [        USS9nO(  ==[        S` =b  u   O  =c  O  O    UnOn[	        U5        [
        S    " S WSSSSSS9nUR                  UL a  S O[        UR                  5      nU R                  R                  XS9n	[        R                  " U	[        U[        UR                  5      S	9S S S
9n
U R                  R                  U
S9  [!        Xz5      (       a  U R                  R#                  XU
S9  [$        R&                  S:  a[  U R)                  5       u  p[+        U5      S:  a9  [+        U5      S:  a)  US   nX=S   L a  U H  u  pU R-                  XSS9  M     g g g g g )Nr   )_subtest_msg_sentinelr^   T)	_ispytestcall)startstopdurationwhenr  )itemr  )r   kwargs)captured_outputcaptured_logs)report)noder  r  r!   r   Fr   )r   r  tupler   r   r   _messager   ihookpytest_runtest_makereportr   _newr   dictparamspytest_runtest_logreportr   pytest_exception_interactr*   r   r   rd   r   )r<   r   testr   r  exception_infounreachable	call_infor   r  
sub_reportr   non_subtest_skiplast_subset_errorr   rp   s                   r4   r   TestCaseFunction.addSubTest  s    	8 !.x4!H '4'!)[)TN
	 mm'<<d#dmmBT5545P"''s4+<= 	

 	

++:+>&y==JJ00* 1 
 g%/3/L/L/N,N #$q(S-@1-D$22$6!44,<(XuM -= 5 .E( &r?   c                   SSK Jn  [        R                  S:  d   S5       eU R                  b  U R                  $ U R
                  R                  R                   VVs/ s H  u  p#[        X!5      (       d  M  Uc  M  X#4PM!     nnnU R
                  R                  R                   VVs/ s H  u  p#[        X!5      (       a  M  X#4PM     nnnXE4U l        XE4$ s  snnf s  snnf )zMCompute or obtain the cached values for subtest errors and non-subtest skips.r   r   r!   z2This workaround only should be used in Python 3.10)
r   r   r*   r   r   r   r   errorsr   rQ   )r<   r   rT   yr   non_subtest_skipss         r4   r   )TestCaseFunction._obtain_errors_and_skips  s    *') 	
@	
) ((4000 ..55
5!& +, QF5 	 
 ..66
6a* QF6 	 

 *8(K%00

s   C8C=C*CC)r   r   r   r|   )r   unittest.TestCaser}   r~   )r   _SysExcInfoTyper}   r~   )r   r1  r   r2  r}   r~   )r   r1  rp   r   r   boolr}   r~   )r   )r   r1  r   r2  rp   r   r}   r~   r]   )r   r1  rp   z"twisted.trial.unittest.Todo | Noner}   r~   )r   r1  r   floatr}   r~   )r   z*_pytest._code.ExceptionInfo[BaseException]r}   z_pytest._code.Traceback)r   r
   r$  r   r   z^ExceptionInfo[BaseException] | tuple[type[BaseException], BaseException, TracebackType] | Noner}   r~   )r}   ztuple[list[Any], list[Any]])r   r   r   r   r   failfastr   __annotations__r   propertyr   rr   rs   r   r   r   r   r   r   r   r   r   r   rU   r	  r   r   r   __classcell__)r   s   @r4   rN   rN      sj   JHHLHEL*  U AD%)%7F%	%%)%7F%	% TX)36LP	J 		-#	- $	- 		-
 
	- 6:-#- 3- 
	--B	A		 	8N8N 8N	8N 
8Nt1 1r?   rN   T)tryfirstc                  ^ [        U [        5      (       a4  U R                  (       a#  U R                  R                  S5      Ul         U?[        R                  R                  S5      nU(       a  UR                  (       au  [        UR                  R                  UR                  5      (       aE  UR                  m[        S    R                  U4S jUR                  5      nUR                  Ul        g g g g ! [         a     Nf = f)Nr   r'   c                 @   > [        [        T R                  5      5      $ r]   )r   r   r   )r   s   r4   r_   +pytest_runtest_makereport.<locals>.<lambda>  s    c'--6H1Ir?   )r   rN   r   popr   r   AttributeErrorr*   r+   rO   r   SkipTestr   	from_callr  )r  r  r'   call2r   s       @r4   r  r    s    $())====,,Q/DLK {{z*HDLLZ0B0BHDUDU%V%V,,(()I499U}} &WLx " s   	C9 9
DDc                .    [        [        U SS5      5      $ )zDReturn True if the given object has been marked with @unittest.skip.__unittest_skip__F)r3  rD   r:   s    r4   rE   rE     s    0%899r?   c                 n    [        5       [        R                  La  SSKJn   SSKJn  U" [        U 5        gg)zRRegister the TestCaseFunction class as an IReporter if twisted.trial is available.r   )	IReporter)classImplementsN)_get_twisted_versionTwistedVersionNotInstalledtwisted.trial.itrialrE  zope.interfacerF  rN   )rE  rF  s     r4   pytest_configurerL    s*    ^%@%@@22()4	 Ar?   c                  B    \ rS rSrSr\" 5       r\" 5       r\" 5       rSr	g)rH  i  z~
The Twisted version installed in the environment.

We have different workarounds in place for different versions of Twisted.
r^   N)
r   r   r   r   __doc__r   	Version24	Version25rI  r   r^   r?   r4   rH  rH    s     II6Lr?   rH  c                 &   S[         R                  ;  a  [        R                  $ SS Kn SS KnU R                  R                  S5      nUR                  R                  U5      nUR                  S::  a  [        R                  $ [        R                  $ )NrC   r   twisted   )r*   r+   rH  rI  importlib.metadatapackaging.versionmetadataversionparsemajorrO  rP  )	importlib	packagingversion_strrW  s       r4   rG  rG    sr      s{{2***$$,,Y7K%%k2G}}''''''r?   _twisted_raw_excinfo)wrapperc              #  <  ^#    [        5       [        R                  L ah  SS KJs  Jn  UR                  R                  m SU4S jjn[        R                  " 5        nUR                  UR                  SU5        S v sS S S 5        $ S v $ ! , (       d  f       g = f7f)Nr   c                
  > Uc  [         R                  " 5       nO-Uc  [        U5      nUc  [         R                  " 5       S   nX!U4n[        U [        [        U5      5         T" XX#US9  g ! [         a    T" XX#5         g f = f)Nr    )captureVars)r*   r   r   r   TWISTED_RAW_EXCINFO_ATTRr  r   )r<   	exc_valueexc_typeexc_tbra  raw_exc_infooriginal__init__s         r4   store_raw_exception_info9pytest_runtest_protocol.<locals>.store_raw_exception_info8  s      "||~##IH> \\^A.F (V<D2E,4GHD X;  D (CDs   #A, ,BB__init__)NNNN)rG  rH  rO  twisted.python.failurepythonfailureFailurerj  r   contextr   )r  r3   rh  patcherrg  s       @r4   pytest_runtest_protocolrq  0  s{     !9!99++ ::.. KO	D&   "gOOBJJ
4LM #" 	 #"s   AB!B=B
BBc                6   [        5       nU[        R                  L a  U $ U[        R                  L a9  [	        U [
        5      (       a"  [        U [
        5      n[        U [
        5        U$ U $ U[        R                  L a  [        U [        5      (       a{  SSKn[        XR                  R                  R                  5      (       aI  U R                  nUc  [         R"                  " 5       S   n[%        U R&                  5      U R&                  U4$ U $  SU 35       e)z
Twisted passes a custom Failure instance to `addError()` instead of using `sys.exc_info()`.
Therefore, if `rawexcinfo` is a `Failure` instance, convert it into the equivalent `sys.exc_info()` tuple
as expected by pytest.
r   Nr    zUnexpected Twisted version: )rG  rH  rI  rO  hasattrrb  rD   r  rP  r   r   rk  rl  rm  rn  __traceback__r*   r   r   r   )r   twisted_versionsaved_exc_inforR  tbs        r4   r   r   R  s     +,O.555 	N44	4 :788$Z1IJNJ 89!!	N44	4j-00)*nn&<&<&D&DEE--:*BJ,,-z/?/?CC 	G4_4EFFur?   )r2   zModule | Classr(   r   r)   objectr}   zUnitTestCase | None)r  r   r  zCallInfo[None]r}   r~   )r}   r3  r|   )r}   rH  )r  r   r}   zIterator[None])r   z_SysExcInfoType | BaseExceptionr}   r2  )GrN  
__future__r   collections.abcr   r   r   r   enumr   r	   r.   r*   r   typestypingr
   r   r'   r   _pytest._coder   r   _pytest.compatr   r   _pytest.configr   _pytest.fixturesr   _pytest.monkeypatchr   _pytest.nodesr   r   _pytest.outcomesr   r   r   r   _pytest.pythonr   r   r   _pytest.runnerr   r   _pytest.subtestsr   r   r   exceptiongroupr$   r%   twisted.trial.unittestrR  r  r   r   r2  r5   r0   rN   r  rE   rL  rH  rG  rb  rq  r   r^   r?   r4   <module>r     sy   : " $ % $ $    
        ' ' , # + + #  ! ! ! "   # ! # 6 + * BQ'!-#! 
$}
}e.A.A
AB CC%(C/5CC(@
5 @
FS1x S1l 
4% %$:
5T (, 2  
$ B&G/&G&Gr?   