Ignore SQLAlchemy RemovedIn20Warning

SQLAlchemy 1.4 will be introducing a new warning
class called RemovedIn20Warning, which will indicate behaviors
and APIs that are planned on being changed for the
SQLAlchemy 2.0 release [1].  As SQLAlchemy 2.0 is planned on
being a more major API break, applications will normally need
to wait until they are fully on SQLAlchemy 1.4 only as well as
Python 3 only in order to begin using new APIs that will allow
migration to 2.0.

For now, Keystone and others don't have a need to be raising
for this warning as there are not yet clear upgrade paths
established.

[1] https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#sqlalchemy-1-x-to-2-0-transition

Change-Id: Icb005b2e7b9d851f5a3e8677599b32a6e3edddc2
This commit is contained in:
Mike Bayer 2020-03-03 13:32:19 -05:00
parent 97d83016af
commit a183badaa4

View File

@ -684,6 +684,9 @@ class BaseTestCase(testtools.TestCase):
warnings.filterwarnings('error', category=DeprecationWarning, warnings.filterwarnings('error', category=DeprecationWarning,
module='^keystone\\.') module='^keystone\\.')
warnings.simplefilter('error', exc.SAWarning) warnings.simplefilter('error', exc.SAWarning)
if hasattr(exc, "RemovedIn20Warning"):
warnings.simplefilter('ignore', exc.RemovedIn20Warning)
self.addCleanup(warnings.resetwarnings) self.addCleanup(warnings.resetwarnings)
# Ensure we have an empty threadlocal context at the start of each # Ensure we have an empty threadlocal context at the start of each
# test. # test.