summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
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
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')
-rw-r--r--lib/sqlalchemy/testing/suite/test_sequence.py4
-rw-r--r--lib/sqlalchemy/testing/warnings.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_sequence.py b/lib/sqlalchemy/testing/suite/test_sequence.py
index 53398ea31..eae051992 100644
--- a/lib/sqlalchemy/testing/suite/test_sequence.py
+++ b/lib/sqlalchemy/testing/suite/test_sequence.py
@@ -88,7 +88,7 @@ class SequenceTest(fixtures.TablesTest):
)
def test_nextval_direct(self, connection):
- r = connection.execute(self.tables.seq_pk.c.id.default)
+ r = connection.scalar(self.tables.seq_pk.c.id.default)
eq_(r, testing.db.dialect.default_sequence_base)
@requirements.sequences_optional
@@ -139,7 +139,7 @@ class SequenceTest(fixtures.TablesTest):
schema_translate_map={"alt_schema": config.test_schema}
)
- r = connection.execute(seq)
+ r = connection.scalar(seq)
eq_(r, testing.db.dialect.default_sequence_base)
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)