
    9[g[                       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      dd       Z ej.                  d      	 	 	 	 dd       Zy)    )annotations)contextmanagerN)	Generator)Literal)apply_warning_filters)Config)parse_warning_filter)Session)Item)TerminalReporterc                (    | j                  dd       y )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)configs    K/var/www/html/bid-api/venv/lib/python3.12/site-packages/_pytest/warnings.pypytest_configurer      s    
	i    c              #    K   | j                  d      }| j                  j                  xs g }t        j                  d      5 }|J t
        j                  s6t        j                  dt               t        j                  dt               t        ||       |dn|j                  }|E|j                  d      D ]0  }|j                  D ]  }	t        j                  t        |	d	
        ! 2 	 d |D ]+  }
|j                  j!                  t#        |
||d             - 	 ddd       y# |D ]+  }
|j                  j!                  t#        |
||d             - 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.
    filterwarningsT)recordNalways)category )nameF)escape)warning_messagenodeidwhen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   itemconfig_filterscmdline_filterslogr   markargr   s              r   catch_warnings_for_itemr6      s[     ]]#34N11@@FBO		 	 	-##H7IJ##H7PQ
 	no> |))/?)@99C++-A#e-TU % A	#&--;;(7%!!%	 <  $'1 
.	-0 $'--;;(7%!!%	 <  $'1 
.	-s7   AE2B.E&3D170E&(	E212E##E&&E/+E2c                   | j                   }t        j                  t        |      | j                  | j
                  | j                  | j                        }| j                  ]	 ddl	}|j                  | j                        }|)dj                  |j                               }|d| z  }|S d}|dz  }|d| dz  }|S |S # t        $ r Y |S w xY w)	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$   formatwarningstrr   filenamelinenolinesourcetracemallocget_object_tracebackjoinformatImportError)r   warn_msgmsgr@   tbformatted_tburls          r   warning_record_to_strrJ   M   s    &&H

 
 H    C )	3 11/2H2HIB~#yy5 1,@@ J i^^cU/22J3J  	 J	s   $C 	CCT)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   )r6   r   r/   )r0   s    r   pytest_runtest_protocolrP   k   s3     	 {{$**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collectrO   r   r6   hooksessionr   s     r   pytest_collectionrW   s   s8     ^^F	 V[[yt
 
 
 
   &A6
A?A)rK   c              #     K   | j                   }t        ||j                  dd       5  d cd d d        S # 1 sw Y   y xY wwNr   rO   rS   )terminalreporterr   s     r   pytest_terminal_summaryr\   |   s<      $$F	 V[[xd
 
 
 
rX   c              #     K   | j                   }t        ||j                  dd       5  d cd d d        S # 1 sw Y   y xY wwrZ   rS   rU   s     r   pytest_sessionfinishr^      s8     ^^F	 V[[xd
 
 
 
rX   c              #  p   K   t        | | j                  dd       5  d cd d d        S # 1 sw Y   y xY wwrZ   )r6   rT   )early_configs    r   pytest_load_initial_conftestsra      s3      
!<#4#48$
 
 
 
s   6*
636)r   r   returnNone)r   r   r   z'Literal['config', 'collect', 'runtest']r0   zItem | Nonerb   Generator[None])r   zwarnings.WarningMessagerb   r;   )r0   r   rb   Generator[None, object, object])rV   r
   rb   re   )r[   r   rb   rd   )rV   r
   rb   rd   )r`   r   rb   rd   )
__future__r   
contextlibr   r&   typingr   r   r$   _pytest.configr   r   r	   _pytest.mainr
   _pytest.nodesr   _pytest.terminalr   pytestr   r6   rJ   hookimplrP   rW   r\   r^   ra    r   r   <module>rp      s0   " % 
    0 ! /    -  .. 2. 	.
 . .b< - . - . &     r   