
    pj[                       d dl mZ d dlmZ d dlZd dlm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Zd*dZed+d            Zd,dZ ej        dd          d-d            Z ej        dd          d.d"            Z ej        d#          d/d&            Z ej        d#          d0d'            Z ej        d#          d1d)            ZdS )2    )annotations)contextmanagerN)	Generator)Literal)apply_warning_filters)Config)parse_warning_filter)Session)Item)TerminalReporterconfigr   returnNonec                2    |                      dd           d S )N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 )addinivalue_line)r   s    `/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/_pytest/warnings.pypytest_configurer      s-    
	i        when'Literal['config', 'collect', 'runtest']itemItem | NoneGenerator[None]c              #    K   |                      d          }| j        j        pg }t          j        d          5 }|J t
          j        s6t          j        dt                     t          j        dt                     t          ||           |dn|j        }|@|                    d          D ])}|j        D ]}	t          j        t          |	d	
             *	 dV  |D ].}
|j                            t#          |
||d                     /n6# |D ].}
|j                            t#          |
||d                     /w xY w	 ddd           dS # 1 swxY w Y   dS )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.
    filterwarningsT)recordNalways)category )nameF)escape)warning_messagenodeidr   location)kwargs)getiniknown_args_namespacepythonwarningswarningscatch_warningssyswarnoptionsr   DeprecationWarningPendingDeprecationWarningr   r$   iter_markersargsr	   pytest_warning_recordedcall_historicdict)r   ihookr   r   config_filterscmdline_filterslogr$   markargr#   s              r   catch_warnings_for_itemr;      s)      ]]#344N1@FBO		 	-	-	-   	R#H7IJJJJ#H7PQQQQ
 	no>>> |))/?)@@ V V9 V VC+-A#e-T-T-TUUUV	EEE#&  -;;(7%!!%	   <    3  -;;(7%!!%	   <     1                                   s*   B$E D$2E3E		EE!Er#   warnings.WarningMessagestrc                x   | j         }t          j        t          |          | j        | j        | j        | j                  }| j        r	 ddl	}|
                    | j                  }|0d                    |                                          }|d| z  }n!d}|dz  }|d| dz  }n# t          $ r Y nw xY w|S )	z.Convert a warnings.WarningMessage to a string.Nr   
z
Object allocated at:
zPhttps://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warningszDEnable tracemalloc to get traceback where the object was allocated.
zSee z for more info.)messager*   formatwarningr=   r   filenamelinenolinesourcetracemallocget_object_tracebackjoinformatImportError)r#   warn_msgmsgrF   tbformatted_tburls          r   warning_record_to_strrP   M   s    &H

 H   C )	3 11/2HIIB~#yy55 @,@@@ i^^2c2222  	 	 	D	 Js   	B* *
B76B7T)wrappertryfirstr   Generator[None, object, object]c              #  |   K   t          | j        | j        d|           5  d V cd d d            S # 1 swxY w Y   d S )Nruntestr   r5   r   r   )r;   r   r5   )r   s    r   pytest_runtest_protocolrW   k   s      	 {$*94
 
 
                    s   155sessionr
   c              #     K   | j         }t          ||j        dd           5  d V cd d d            S # 1 swxY w Y   d S )NcollectrV   r   r;   hookrX   r   s     r   pytest_collectionr^   s   s      ^F	 V[yt
 
 
                       377)rQ   terminalreporterr   c              #     K   | j         }t          ||j        dd           5  d V cd d d            S # 1 swxY w Y   d S Nr   rV   r[   )r`   r   s     r   pytest_terminal_summaryrc   |   s       $F	 V[xd
 
 
                    r_   c              #     K   | j         }t          ||j        dd           5  d V cd d d            S # 1 swxY w Y   d S rb   r[   r]   s     r   pytest_sessionfinishre      s      ^F	 V[xd
 
 
                    r_   early_configc              #  r   K   t          | | j        dd           5  d V cd d d            S # 1 swxY w Y   d S rb   )r;   r\   )rf   s    r   pytest_load_initial_conftestsrh      s       
!<#48$
 
 
                    s   ,00)r   r   r   r   )r   r   r   r   r   r   r   r   )r#   r<   r   r=   )r   r   r   rS   )rX   r
   r   rS   )r`   r   r   r   )rX   r
   r   r   )rf   r   r   r   )
__future__r   
contextlibr   r,   typingr   r   r*   _pytest.configr   r   r	   _pytest.mainr
   _pytest.nodesr   _pytest.terminalr   pytestr   r;   rP   hookimplrW   r^   rc   re   rh    r   r   <module>rs      s   " " " " " " % % % % % % 



              0 0 0 0 0 0 ! ! ! ! ! ! / / / / / /                   - - - - - -     . . . .b   < ---   .- ---   .-              r   