چTf
d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlZd dl m
Z
d dl mZ d dl mZ d d l
mZ d d
lmZ d dlmZ erd dlmZ d
eddfdZed
edddee ded fd Zdej defdZ ej dd deded fd Z ej dd deded fd Z ej d deded fd Z ej d deded fd Z ej d d d!ded fd" ZdS )# N)contextmanager) Generator)Optional)
TYPE_CHECKING)apply_warning_filters)Config)parse_warning_filter)Session)Item)TerminalReporter)Literalconfigreturnc 2 | dd d S )Nmarkerszfilterwarnings(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 b/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/_pytest/warnings.pypytest_configurer s-
i whenz'Literal['config', 'collect', 'runtest']item)NNNc
# ^ K | d }| j j pg }t j d 5 }|J t
j s6t j dt t j dt t || |dn|j }|@| d D ])}|j
D ]} t j t | d
*dV |D ].}
|j t# |
||d / ddd dS # 1 swxY w Y dS )
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)recordNalways)category )nameF)escape)warning_messagenodeidr location)kwargs)getiniknown_args_namespacepythonwarningswarningscatch_warningssyswarnoptionsr DeprecationWarningPendingDeprecationWarningr r! iter_markersargsr pytest_warning_recorded
call_historicdict)r ihookr r config_filterscmdline_filterslogr! markargr s r catch_warnings_for_itemr8 s ]]#344N1@FBO - - - R#H7IJJJJ#H7PQQQQno>>> |))/?)@@
V
V9 V VC+-A#e-T-T-TUUUV " O)77$3!!
8
) s CD""D&)D&r c x | j }t j t | | j | j | j | j }| j r ddl }|
| j }|0d | }|d| z
}n!d}|dz
}|d| dz
}n# t $ r Y nw xY 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.
zSee z for more info.)messager'
formatwarningstrr filenamelinenolinesourcetracemallocget_object_tracebackjoinformatImportError)r warn_msgmsgrB tbformatted_tburls r warning_record_to_strrL J s &H
H
C ) 3 11/2HIIB~#yy55 @,@@@ i^^2c2222 D Js B* *
B76B7T)hookwrappertryfirstc # ~ K t | j | j d| 5 d V d d d d S # 1 swxY w Y d S )Nruntestr r2 r r )r8 r r2 )r s r pytest_runtest_protocolrR h s {$*94
s 266sessionc # K | j }t ||j dd 5 d V d d d d S # 1 swxY w Y d S )NcollectrQ r r8 hookrS r s r pytest_collectionrY p s
^F V[yt
488)rM terminalreporterc # K | j }t ||j dd 5 d V d d d d S # 1 swxY 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 dd 5 d V d d d d S # 1 swxY w Y d S r] rV rX s r pytest_sessionfinishr` s
^F V[xd
rZ early_configr c # t K t | | j dd 5 d V d d d d S # 1 swxY w Y d S r] )r8 rW )ra s r pytest_load_initial_conftestsrc s
!<#48$
s -11) 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