From 20fdc44bfdd0e72fa7777042fd4a94ff6c07638d Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 15 Jul 2021 12:00:46 +0100 Subject: [PATCH] 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 --- placement/tests/functional/fixtures/capture.py | 9 +++++++-- tox.ini | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/placement/tests/functional/fixtures/capture.py b/placement/tests/functional/fixtures/capture.py index 118750ca8..c58119acf 100644 --- a/placement/tests/functional/fixtures/capture.py +++ b/placement/tests/functional/fixtures/capture.py @@ -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) diff --git a/tox.ini b/tox.ini index dd0fd1b8b..4d25b8df6 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =