Use LOG.warning instead of deprecated LOG.warn
The LOG.warn method is deprecated[1] and the LOG.warning method should be used instead. [1] https://docs.python.org/3/library/logging.html#logging.warning Change-Id: I43e2269d4b1c425119c86919eb869941d621c6de
This commit is contained in:
parent
daeae9c8a5
commit
2a5ef1b933
@ -26,6 +26,7 @@ Tempest Specific Commandments
|
||||
- [T116] Unsupported 'message' Exception attribute in PY3
|
||||
- [T117] Check negative tests have ``@decorators.attr(type=['negative'])``
|
||||
applied.
|
||||
- [T118] LOG.warn is deprecated. Enforce use of LOG.warning.
|
||||
|
||||
It is recommended to use ``tox -eautopep8`` before submitting a patch.
|
||||
|
||||
|
@ -130,7 +130,7 @@ def verify_glance_api_versions(os, update):
|
||||
msg = ('Glance is available in the catalog, but no known version, '
|
||||
'(v1.x or v2.x) of Glance could be found, so Glance should '
|
||||
'be configured as not available')
|
||||
LOG.warn(msg)
|
||||
LOG.warning(msg)
|
||||
print_and_or_update('glance', 'service-available', False, update)
|
||||
return
|
||||
|
||||
|
@ -318,3 +318,16 @@ def negative_test_attribute_always_applied_to_negative_tests(physical_line,
|
||||
" to all negative API tests"
|
||||
)
|
||||
_HAVE_NEGATIVE_DECORATOR = False
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def no_log_warn(logical_line):
|
||||
"""Disallow 'LOG.warn('
|
||||
|
||||
Use LOG.warning() instead of Deprecated LOG.warn().
|
||||
https://docs.python.org/3/library/logging.html#logging.warning
|
||||
"""
|
||||
|
||||
msg = ("T118: LOG.warn is deprecated, please use LOG.warning!")
|
||||
if "LOG.warn(" in logical_line:
|
||||
yield (0, msg)
|
||||
|
@ -240,3 +240,9 @@ class HackingTestCase(base.TestCase):
|
||||
with_other_decorators=True,
|
||||
with_negative_decorator=False,
|
||||
expected_success=False)
|
||||
|
||||
def test_no_log_warn(self):
|
||||
self.assertFalse(list(checks.no_log_warn(
|
||||
'LOG.warning("LOG.warn is deprecated")')))
|
||||
self.assertTrue(list(checks.no_log_warn(
|
||||
'LOG.warn("LOG.warn is deprecated")')))
|
||||
|
Loading…
x
Reference in New Issue
Block a user