Your IP : 216.73.216.196
B
C$�X� � @ s� d Z ddlZddlZddlZddlZddlZddlZejdd� �Z dd� Z
ddd�Zd d
� ZG dd� de
�ZG d
d� de
�ZG dd� de�ZdS )z4 recording warnings during test function execution. � Nc c s* t � }|� t�d� |V W dQ R X dS )a Return a WarningsRecorder instance that provides these methods:
* ``pop(category=None)``: return last warning matching the category.
* ``clear()``: clear list of warnings
See http://docs.python.org/library/warnings.html for information
on warning categories.
�defaultN)�WarningsRecorder�warnings�simplefilter)�requestZwrec� r �@/opt/alt/python37/lib/python3.7/site-packages/_pytest/recwarn.py�recwarn s
r c C s
t td�S )N)�deprecated_call�warns)r
r r r r r �pytest_namespace s r c s� | st td�S g � � �fdd�}d� �fdd� }tj�tj�|t_|t_z| ||�}W d�t_�t_X ttf�t�fdd�� D ��s�d }td
| f ��|S )ag assert that calling ``func(*args, **kwargs)`` triggers a
``DeprecationWarning`` or ``PendingDeprecationWarning``.
This function can be used as a context manager::
>>> import warnings
>>> def api_call_v2():
... warnings.warn('use v3 of this api', DeprecationWarning)
... return 200
>>> with deprecated_call():
... assert api_call_v2() == 200
Note: we cannot use WarningsRecorder here because it is still subject
to the mechanism that prevents warnings of the same type from being
triggered twice for the same module. See #1190.
)�expected_warningc s � � |� �| |f|�|� d S )N)�append)�message�category�args�kwargs)�
categories�old_warn_explicitr r �
warn_explicit8 s
z&deprecated_call.<locals>.warn_explicitNc s8 t | t�r� �| j� n
� �|� �| |f|�|� d S )N)�
isinstance�Warningr � __class__)r r r r )r �old_warnr r �warn<