summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/warnings.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-05-17 22:26:20 +0200
committerFederico Caselli <cfederico87@gmail.com>2022-05-18 23:47:25 +0200
commit7a8c4732cc8b066b4059680df40bc079d9b08009 (patch)
tree33a531793a6f14850bdaed13b841bb33d05b4e8a /lib/sqlalchemy/testing/warnings.py
parent9e7bed9df601ead02fd96bf2fc787b23b536d2d6 (diff)
downloadsqlalchemy-7a8c4732cc8b066b4059680df40bc079d9b08009.tar.gz
Fix warnings raised by the testing module
Adjust the automatic stacklevel counter to ignore sqlalchemy.testing Properly apply warning filters Change-Id: Ib3d2eb6269af5fc72881df4d39194b3b0cbb1353
Diffstat (limited to 'lib/sqlalchemy/testing/warnings.py')
-rw-r--r--lib/sqlalchemy/testing/warnings.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py
index db36a2891..db8379049 100644
--- a/lib/sqlalchemy/testing/warnings.py
+++ b/lib/sqlalchemy/testing/warnings.py
@@ -28,9 +28,13 @@ def setup_filters():
as we need to delay importing SQLAlchemy until conftest.py has been
processed.
+ NOTE: filters on subclasses of DeprecationWarning or
+ PendingDeprecationWarning have no effect if added here, since pytest
+ will add at each test the following filters
+ ``always::PendingDeprecationWarning`` and ``always::DeprecationWarning``
+ that will take precedence over any added here.
+
"""
- warnings.filterwarnings("ignore", category=exc.SAPendingDeprecationWarning)
- warnings.filterwarnings("error", category=exc.SADeprecationWarning)
warnings.filterwarnings("error", category=exc.SAWarning)
warnings.filterwarnings("always", category=exc.SATestSuiteWarning)