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:%2522sqlalchemy-20%2522+project:openstack/oslo.db Change-Id: Iafe726d3819031c357460fd131bb2bb58babb4e2 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
e28afc5647
commit
52bd1e51d6
|
@ -820,16 +820,126 @@ class WarningsFixture(fixtures.Fixture):
|
|||
'error', message='Evaluating non-mapped column expression',
|
||||
category=sqla_exc.SAWarning)
|
||||
|
||||
# Enable deprecation warnings to capture upcoming SQLAlchemy changes
|
||||
# Enable deprecation warnings for nova itself to capture upcoming
|
||||
# SQLAlchemy changes
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'error',
|
||||
module='nova',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
# TODO(stephenfin): Remove once we fix this is oslo.db 10.0.1 or so
|
||||
# ...but filter everything out until we get around to fixing them
|
||||
# TODO(stephenfin): Fix all of these
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The Engine.execute\(\) method is considered legacy',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The autoload parameter is deprecated .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The current statement is being autocommitted .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The MetaData.bind argument is deprecated .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The legacy calling style of select\(\) .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The ``bind`` argument for schema methods .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The Column.copy\(\) method is deprecated .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The Row.keys\(\) method is considered legacy .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'Using non-integer/slice indices on Row is deprecated .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The .close\(\) method on a so-called .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The Connection.connect\(\) method is considered .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'Passing a string to Connection.execute\(\) is .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The insert.inline parameter will be removed .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'Using strings to indicate column or relationship .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'Using strings to indicate relationship names .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The Executable.execute\(\) method is considered .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The Executable.scalar\(\) method is considered .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'Invoking and_\(\) without arguments is deprecated, .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
|
|
2
tox.ini
2
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 =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/requirements.txt
|
||||
|
|
Loading…
Reference in New Issue