
    iJ                       d dl mZ d dlmZ d dlmZ d dlmZ d dlZd dlm	Z	 d dl
Z
d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlZedd	 	 	 	 	 	 	 	 	 dd       ZddZ ej4                  dd      dd       Z ej4                  dd      dd       Z ej4                  d      	 	 	 	 dd       Z ej4                  d      dd       Z ej4                  d      	 	 	 	 d d       Zd!dZ y)"    )annotations)	Generator)contextmanager)	ExitStackN)Literal)apply_warning_filters)Config)parse_warning_filter)Session)Item)TerminalReporter)tracemalloc_messageTrecordc             #  D  K   | j                  d      }| j                  j                  xs g }t        j                  |      5 }t
        j                  s6t        j                  dt               t        j                  dt               t        j                  dt        j                         t        ||       |dn|j                  }|E|j                  d      D ]0  }	|	j                  D ]  }
t        j                  t!        |
d	
        ! 2 	 d |r5|J |D ]+  }|j"                  j%                  t'        |||d             - 	 ddd       y# |r5|J |D ]+  }|j"                  j%                  t'        |||d             - w w xY w# 1 sw Y   yxY ww)zContext manager that catches warnings generated in the contained execution block.

    ``item`` can be None if we are not in the context of an item execution.

    Each warning captured triggers the ``pytest_warning_recorded`` hook.
    filterwarningsr   always)categoryerrorN )nameF)escape)warning_messagenodeidwhenlocation)kwargs)getiniknown_args_namespacepythonwarningswarningscatch_warningssyswarnoptionsr   DeprecationWarningPendingDeprecationWarningpytestPytestRemovedIn9Warningr   r   iter_markersargsr
   pytest_warning_recordedcall_historicdict)configihookr   itemr   config_filterscmdline_filterslogr   markargr   s               U/mnt/e/genesis-system/.venvs/sunaiva/lib/python3.12/site-packages/_pytest/warnings.pycatch_warnings_for_itemr7      s     ]]#34N11@@FBO		 	 	/  3##H7IJ##H7PQ&2P2PQno> |))/?)@ V99 VC++-A#e-TUVV	&'* O11??#,;#)!%%)	  @ 1   ( &'* O11??#,;#)!%%)	  @ 	 )   s7   AF CFE7F	F 9FFFF c                    t        j                  t        | j                        | j                  | j
                  | j                  | j                        t        | j                        z   S )z.Convert a warnings.WarningMessage to a string.)
r!   formatwarningstrmessager   filenamelinenoliner   source)r   s    r6   warning_record_to_strr@   I   s\    !!O##$     	O2234 4    )wrappertryfirstc              #     K   t        | j                  | j                  d|       5  d cd d d        S # 1 sw Y   y xY ww)Nruntestr.   r/   r   r0   )r7   r.   r/   )r0   s    r6   pytest_runtest_protocolrG   T   s8     	 {{$**94
    s   $A 4
A =A c              #     K   | j                   }t        ||j                  dd       5  d cd d d        S # 1 sw Y   y xY ww)NcollectrF   r.   r7   hooksessionr.   s     r6   pytest_collectionrN   \   s=     ^^F	 V[[yt
       &A6
A?A)rB   c              #     K   | j                   }t        ||j                  dd       5  d cd d d        S # 1 sw Y   y xY wwNr.   rF   rJ   )terminalreporterr.   s     r6   pytest_terminal_summaryrS   e   sA      $$F	 V[[xd
    rO   c              #     K   | j                   }t        ||j                  dd       5  d cd d d        S # 1 sw Y   y xY wwrQ   rJ   rL   s     r6   pytest_sessionfinishrU   p   s=     ^^F	 V[[xd
    rO   c              #  p   K   t        | | j                  dd       5  d cd d d        S # 1 sw Y   y xY wwrQ   )r7   rK   )early_configs    r6   pytest_load_initial_conftestsrX   y   s8      
!<#4#48$
    s   6*
636c           
     
   t               5 }|j                  t        | | j                  dd d             | j	                  dd       | j                  |j                         j                         d d d        y # 1 sw Y   y xY w)Nr.   F)r.   r/   r   r0   r   markerszfilterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/how-to/capture-warnings.html#pytest-mark-filterwarnings )r   enter_contextr7   rK   addinivalue_lineadd_cleanuppop_allclose)r.   stacks     r6   pytest_configurera      s~    	 2#kk
 
	
 	m	

 	5==?001'2 2 2s   A%A99B)
r.   r	   r   z'Literal['config', 'collect', 'runtest']r0   zItem | Noner   boolreturnGenerator[None])r   zwarnings.WarningMessagerc   r:   )r0   r   rc   Generator[None, object, object])rM   r   rc   re   )rR   r   rc   rd   )rM   r   rc   rd   )rW   r	   rc   rd   )r.   r	   rc   None)!
__future__r   collections.abcr   
contextlibr   r   r#   typingr   r!   _pytest.configr   r	   r
   _pytest.mainr   _pytest.nodesr   _pytest.terminalr   _pytest.tracemallocr   r'   r7   r@   hookimplrG   rN   rS   rU   rX   ra    rA   r6   <module>rr      sE   " % %   
   0 ! /    - 3   00 20 	0 0 0 0f4 - . - . &     2rA   