From ca6c94bd16ec0f9d0ebec5acbff2dce4a3c06704 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 7 Sep 2022 22:35:36 +0100 Subject: [PATCH] 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 Change-Id: If3a9bed39872012f8c64333cf378c434c22a2d15 --- manila/test.py | 31 +++++++++++++++++++++++++++++++ tox.ini | 2 ++ 2 files changed, 33 insertions(+) diff --git a/manila/test.py b/manila/test.py index fedc513dbf..3851bbe321 100644 --- a/manila/test.py +++ b/manila/test.py @@ -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 diff --git a/tox.ini b/tox.ini index 9a061691b2..a6907d72af 100644 --- a/tox.ini +++ b/tox.ini @@ -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