tox: Enable SQLAlchemy 2.0 warnings

As described in [1]. Unfortunately it doesn't seem to be possible to
silence these for other modules (cough...oslo.db...cough), presumably
due to how SQLAlchemy has configured warnings. We'll have to ignore
these for now.

[1] https://docs.sqlalchemy.org/en/14/changelog/migration_20.html

Change-Id: I28bc91d515440553828976dd1d3a3aef36a6d6a9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2021-07-15 12:00:46 +01:00
parent 13bbdba06d
commit 20fdc44bfd
2 changed files with 9 additions and 2 deletions

View File

@ -91,11 +91,16 @@ class WarningsFixture(fixtures.Fixture):
message='Evaluating non-mapped column expression',
category=sqla_exc.SAWarning)
# Configure SQLAlchemy 2.0 warnings
# TODO(stephenfin): Remove once we're using sqlalchemy 2.0 which should
# remove this functionality entirely
# remove these deprecated features entirely
warnings.filterwarnings(
'ignore',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'error',
message='Implicit coercion of SELECT and textual SELECT .*',
module='placement',
category=sqla_exc.SADeprecationWarning)
self.addCleanup(self._reset_warning_filters)

View File

@ -23,6 +23,8 @@ setenv =
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=160
PYTHONDONTWRITEBYTECODE=1
# TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0
SQLALCHEMY_WARN_20=1
deps = -r{toxinidir}/test-requirements.txt
# For a venv that doesn't use stestr commands must be overridden.
commands =