B
    KLc                 @   sf   d dl mZ d dlZddlmZ ddlmZ ddlmZ G dd	 d	e	Z
d
d Zdd ZdddZdS )    )absolute_importN   )
assertions   )exc)_warnings_warnc               @   s   e Zd ZdZdS )SATestSuiteWarningzwarning for a condition detected during tests that is non-fatal

    Currently outside of SAWarning so that we can work around tools like
    Alembic doing the wrong thing with warnings.

    N)__name__
__module____qualname____doc__ r   r   :lib/python3.7/site-packages/sqlalchemy/testing/warnings.pyr      s   r   c             C   s   t | td d S )N)category)r   r   )messager   r   r   warn_test_suite   s    r   c              C   s   d} t jdtjd t jdtjd t jdtjd t jdtd t jdt| d t jdtjdd t jdtjd	d yd
dl}W n t	k
r   Y nX t jd|j
| d dS )z/Set global warning behavior for the test suite.z^(?:test|sqlalchemy)\..*ignore)r   erroralways)r   modulez.*\(deprecated since: 2.0\)$)r   r   z8^The (Sybase|firebird) dialect is deprecated and will ber   Nonce)warningsfilterwarningssa_excZSAPendingDeprecationWarningZSADeprecationWarning	SAWarningr   DeprecationWarningpytestImportErrorZPytestDeprecationWarning)originr   r   r   r   setup_filters   s,    r   Fc          	   C   s$   t jtj||d |  S Q R X dS )zzAssert that each of the given warnings are emitted by fn.

    Deprecated.  Please use assertions.expect_warnings().

    )regexN)r   Z_expect_warningsr   r   )fnZwarning_msgsr    r   r   r   assert_warningsH   s    r"   )F)Z
__future__r   r    r   r   r   Zutil.langhelpersr   Warningr   r   r   r"   r   r   r   r   <module>   s   	*