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.

There's a lot more to be done here. However, the work done in oslo.db
[1] should provide a guide for how to resolve the outstanding issues.

[1] https://review.opendev.org/q/topic:"sqlalchemy-20"+project:openstack/oslo.db

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: If3a9bed39872012f8c64333cf378c434c22a2d15
This commit is contained in:
Stephen Finucane 2022-09-07 22:35:36 +01:00
parent 428177c4ea
commit ca6c94bd16
2 changed files with 33 additions and 0 deletions

View File

@ -168,6 +168,37 @@ class WarningsFixture(fixtures.Fixture):
category=sqla_exc.SADeprecationWarning,
)
# ..but filter everything out until we get around to fixing them
# TODO(stephenfin): Fix all of these
warnings.filterwarnings(
'ignore',
module='manila',
message='Using strings to indicate column or relationship paths ',
category=sqla_exc.SADeprecationWarning,
)
warnings.filterwarnings(
'ignore',
module='manila',
message='The current statement is being autocommitted ',
category=sqla_exc.SADeprecationWarning,
)
warnings.filterwarnings(
'ignore',
module='manila',
message='The autoload parameter is deprecated ',
category=sqla_exc.SADeprecationWarning,
)
warnings.filterwarnings(
'ignore',
module='manila',
message='Using strings to indicate relationship names in Query',
category=sqla_exc.SADeprecationWarning,
)
# Enable general SQLAlchemy warnings also to ensure we're not doing
# silly stuff. It's possible that we'll need to filter things out here
# with future SQLAlchemy versions, but that's a good thing

View File

@ -13,6 +13,8 @@ usedevelop = true
setenv =
VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE=1
# TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0
SQLALCHEMY_WARN_20=1
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt