summaryrefslogtreecommitdiff
path: root/oslo_db
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-07-16 12:08:28 +0100
committerStephen Finucane <stephenfin@redhat.com>2021-07-29 16:37:02 +0100
commit4c1eb966c08d29214c1905e74965f4109f41b013 (patch)
tree2fd2062f8f1c8309e1e82a5422a3bc0e7a3bb422 /oslo_db
parentda002a82f113afc1eb9f0329d567ae9db573091b (diff)
downloadoslo-db-4c1eb966c08d29214c1905e74965f4109f41b013.tar.gz
tests: Enable SQLAlchemy 2.0 deprecation warnings
Well, sort of. We enable them but immediately filter out the ones we're actually seeing, the rationale being that we can address these in a piecemeal fashion without the risk of introducing new issues. Change-Id: I32cad5fd9ddbfd2ff6b62e5e2f87fad6ece7a4c1 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'oslo_db')
-rw-r--r--oslo_db/tests/fixtures.py114
1 files changed, 114 insertions, 0 deletions
diff --git a/oslo_db/tests/fixtures.py b/oslo_db/tests/fixtures.py
index c08a34d..dbdffba 100644
--- a/oslo_db/tests/fixtures.py
+++ b/oslo_db/tests/fixtures.py
@@ -29,8 +29,122 @@ class WarningsFixture(fixtures.Fixture):
category=sqla_exc.SAWarning)
# Enable deprecation warnings to capture upcoming SQLAlchemy changes
+
warnings.filterwarnings(
'error',
category=sqla_exc.SADeprecationWarning)
+ # ...but filter everything out until we get around to fixing them
+ # FIXME(stephenfin): Remove all of these
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The legacy calling style of select\(\) is deprecated .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The MetaData.bind argument is deprecated .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The ``bind`` argument for schema methods .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The Session.autocommit parameter is deprecated .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The Session.begin.subtransactions flag is deprecated .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The autoload parameter is deprecated .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'Using non-integer/slice indices on Row is deprecated .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The insert.values parameter will be removed .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The update.values parameter will be removed .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The Engine.execute\(\) method is considered legacy .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The Executable.execute\(\) method is considered .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The Row.keys\(\) method is considered legacy .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'Retrieving row members using strings or other .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The connection.execute\(\) method in SQLAlchemy 2.0 .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'Calling the mapper\(\) function directly outside .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'Passing a string to Connection.execute\(\) .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'Using plain strings to indicate SQL statements .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The current statement is being autocommitted .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'Calling \.begin\(\) when a transaction is already .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The update.whereclause parameter will be removed .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The Engine.scalar\(\) method is considered legacy .*',
+ category=sqla_exc.SADeprecationWarning)
+
+ warnings.filterwarnings(
+ 'once',
+ message=r'The ``declarative_base\(\)`` function is now .*',
+ category=sqla_exc.SADeprecationWarning)
+
self.addCleanup(warnings.resetwarnings)