Fix LOG marker to follow the Python 3 guideline

"logging.warn" which is functionally identical to "logging.warning",
is deprecated in Python 3 as guideline [1].
we'd better use "logging.warning" instead.

[1]https://docs.python.org/3/library/logging.html#logging.warning

Change-Id: I3567e04b3d2c358a3e5b520b8c21598e2f0be70d
This commit is contained in:
zhangyanxian
2016-12-16 05:53:22 +00:00
parent c65767fdaa
commit 8330a3b3b9
2 changed files with 6 additions and 6 deletions

View File

@@ -236,8 +236,8 @@ class BanditConfig(object):
# show deprecation message
if legacy:
LOG.warn("Config file '%s' contains deprecated legacy config "
"data. Please consider upgrading to the new config "
"format. The tool 'bandit-config-generator' can help you "
"with this. Support for legacy configs will be removed "
"in a future bandit version.", path)
LOG.warning("Config file '%s' contains deprecated legacy config "
"data. Please consider upgrading to the new config "
"format. The tool 'bandit-config-generator' can help "
"you with this. Support for legacy configs will be "
"removed in a future bandit version.", path)

View File

@@ -233,7 +233,7 @@ class TestConfigCompat(testtools.TestCase):
"'bandit-config-generator' can help you with this. Support for "
"legacy configs will be removed in a future bandit version.")
with mock.patch('bandit.core.config.LOG.warn') as m:
with mock.patch('bandit.core.config.LOG.warning') as m:
self.config._config = {"profiles": {}}
self.config.validate('')
self.assertEqual((msg, ''), m.call_args_list[0][0])