
    	h              
          d dl 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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 erd dlmZ deddfdZededddee         ded         fd            Zdej        defdZ ej        dd          deded         fd            Z ej        dd          deded         fd            Z ej        d          deded         fd            Z ej        d          deded         fd            Z ej        d          d d!ded         fd"            ZdS )#    N)contextmanager)	Generator)Optional)TYPE_CHECKING)apply_warning_filters)Config)parse_warning_filter)Session)Item)TerminalReporter)Literalconfigreturnc                 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    ]/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/_pytest/warnings.pypytest_configurer      s-    
	i        whenz'Literal['config', 'collect', 'runtest']item)NNNc           
   #   ^  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                     /	 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_itemr8      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 	" 	 	O)77$3!!	   8    	)                 s   CD""D&)D&r    c                 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'   formatwarningstrr   filenamelinenolinesourcetracemallocget_object_tracebackjoinformatImportError)r    warn_msgmsgrB   tbformatted_tburls          r   warning_record_to_strrL   J   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)hookwrappertryfirstc              #   ~   K   t          | j        | j        d|           5  d V  d d d            d S # 1 swxY w Y   d S )Nruntestr   r2   r   r   )r8   r   r2   )r   s    r   pytest_runtest_protocolrR   h   s      	 {$*94
 
 
   	                 s   266sessionc              #      K   | j         }t          ||j        dd           5  d V  d d d            d S # 1 swxY w Y   d S )NcollectrQ   r   r8   hookrS   r   s     r   pytest_collectionrY   p   s      ^F	 V[yt
 
 
   	                    488)rM   terminalreporterc              #      K   | j         }t          ||j        dd           5  d V  d d d            d S # 1 swxY w Y   d S Nr   rQ   rV   )r[   r   s     r   pytest_terminal_summaryr^   y   s       $F	 V[xd
 
 
   	                 rZ   c              #      K   | j         }t          ||j        dd           5  d V  d d d            d S # 1 swxY w Y   d S r]   rV   rX   s     r   pytest_sessionfinishr`      s      ^F	 V[xd
 
 
   	                 rZ   early_configr   c              #   t   K   t          | | j        dd           5  d V  d d d            d S # 1 swxY w Y   d S r]   )r8   rW   )ra   s    r   pytest_load_initial_conftestsrc      s       
!<#48$
 
 
   	                 s   -11) r)   r'   
contextlibr   typingr   r   r   pytest_pytest.configr   r   r	   _pytest.mainr
   _pytest.nodesr   _pytest.terminalr   typing_extensionsr   r   r8   WarningMessager=   rL   hookimplrR   rY   r^   r`   rc    r   r   <module>ro      s   



  % % % % % %                          0 0 0 0 0 0 ! ! ! ! ! ! / / / / / /                   - - - - - - *))))))V      ** 4* 4.	*
  * * * *Z8+B s    < TD111$ 95E+F    21 TD111w 95E+F    21 T"""&    #" T"""' i8H.I    #" T"""    #"  r   