Stephen Finucane 40bce5a2ba tests: Enable SADeprecationWarning warnings
Highlight use of deprecated SQLAlchemy APIs to ensure we keep on top of
things. This requires resolving the following SADeprecationWarning
warnings:

  The from_engine() method on Inspector is deprecated and will be
  removed in a future release.  Please use the sqlalchemy.inspect()
  function on an Engine or Connection in order to acquire an Inspector.

  The Column.copy() method is deprecated and will be removed in a future
  release.

  The ColumnCollectionConstraint.copy() method is deprecated and will be
  removed in a future release.

There are more warnings to be resolved related to SQLAlchemy 2.0, but
those require a special environment option (SQLALCHEMY_WARN_20) to
trigger and a lot of work to resolve. We'll address those in a series of
follow-ups.

Change-Id: I34b395e6d50f4e4151178c327d94308e6f5d5b6e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-07-29 16:37:02 +01:00

26 lines
903 B
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslotest import base
from oslo_db.tests import fixtures
class BaseTestCase(base.BaseTestCase):
"""Test case base class for all oslo.db unit tests."""
def setUp(self):
"""Run before each test method to initialize test environment."""
super().setUp()
self.warning_fixture = self.useFixture(fixtures.WarningsFixture())