Merge "tests: Enable SQLAlchemy 2.0 deprecation warnings"
This commit is contained in:
commit
646bd9fb65
@ -124,7 +124,7 @@ class WarningsFixture(fixtures.Fixture):
|
||||
"""Filters out warnings during test runs."""
|
||||
|
||||
def setUp(self):
|
||||
super(WarningsFixture, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self._original_warning_filters = warnings.filters[:]
|
||||
|
||||
@ -166,18 +166,93 @@ class WarningsFixture(fixtures.Fixture):
|
||||
module='cinder',
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
message='Policy ".*":".*" was deprecated in ',
|
||||
module='oslo_policy',
|
||||
category=UserWarning,
|
||||
)
|
||||
|
||||
# Enable deprecation warnings for cinder itself to capture upcoming
|
||||
# SQLAlchemy changes
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
# TODO: Make this an error and filter out individual failures
|
||||
warnings.filterwarnings(
|
||||
'once',
|
||||
'error',
|
||||
module='cinder',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
# ...but filter everything out until we get around to fixing them
|
||||
# TODO: Fix all of these
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message=r'The "whens" argument to case\(\) is now passed using ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message=r'The "whens" argument to case\(\), when referring to ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message='Using strings to indicate column or relationship paths ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message='Using strings to indicate relationship names in Query',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message='The current statement is being autocommitted using ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message=r'The SelectBase.as_scalar\(\) method is deprecated ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message=r'Passing a string to Connection.execute\(\) is ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message='The Session.begin.subtransactions flag is deprecated ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='cinder',
|
||||
message=r'The legacy calling style of select\(\) is deprecated ',
|
||||
category=sqla_exc.SADeprecationWarning,
|
||||
)
|
||||
|
||||
self.addCleanup(self._reset_warning_filters)
|
||||
|
||||
def _reset_warning_filters(self):
|
||||
|
16
tox.ini
16
tox.ini
@ -10,16 +10,20 @@ ignore_basepython_conflict=true
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONWARNINGS=default::DeprecationWarning
|
||||
usedevelop = true
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
OS_STDOUT_CAPTURE=1
|
||||
OS_STDERR_CAPTURE=1
|
||||
OS_TEST_TIMEOUT=60
|
||||
OS_TEST_PATH=./cinder/tests/unit
|
||||
usedevelop = True
|
||||
install_command=python -m pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
|
||||
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
# TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0
|
||||
SQLALCHEMY_WARN_20=1
|
||||
install_command =
|
||||
python -m pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
|
||||
# By default stestr will set concurrency
|
||||
|
Loading…
Reference in New Issue
Block a user