diff options
author | Takashi Kajinami <tkajinam@redhat.com> | 2021-11-29 15:36:17 +0900 |
---|---|---|
committer | Takashi Kajinami <tkajinam@redhat.com> | 2021-11-29 18:21:40 +0900 |
commit | 3d585b7d4c31a44f81859acb5522b707257b5117 (patch) | |
tree | aa055de47c4f66a4917299f94dd5a0f156b0d08e | |
parent | 3b5eebdc1c8606552ca00cff8f675f556e076d0e (diff) | |
download | oslo-utils-3d585b7d4c31a44f81859acb5522b707257b5117.tar.gz |
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: If352bbb14a1a44fb2229e633d15e1bf1099fa425
-rw-r--r-- | oslo_utils/netutils.py | 2 | ||||
-rw-r--r-- | oslo_utils/tests/test_netutils.py | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/oslo_utils/netutils.py b/oslo_utils/netutils.py index 3d8a2a2..19f54e7 100644 --- a/oslo_utils/netutils.py +++ b/oslo_utils/netutils.py @@ -112,7 +112,7 @@ def is_valid_ipv4(address, strict=None): return True else: if netaddr.valid_ipv4(address): - LOG.warn( + LOG.warning( 'Converting in non strict mode is deprecated. ' 'You should pass strict=False if you want to ' 'preserve legacy behavior') diff --git a/oslo_utils/tests/test_netutils.py b/oslo_utils/tests/test_netutils.py index 93fedf3..087522c 100644 --- a/oslo_utils/tests/test_netutils.py +++ b/oslo_utils/tests/test_netutils.py @@ -166,16 +166,16 @@ class NetworkUtilsTest(test_base.BaseTestCase): self.assertFalse(netutils.is_valid_ipv4('')) self.assertTrue(netutils.is_valid_ipv4('10')) - mock_log.warn.assert_called_with(expected_log) + mock_log.warning.assert_called_with(expected_log) mock_log.reset_mock() self.assertTrue(netutils.is_valid_ipv4('10.10')) - mock_log.warn.assert_called_with(expected_log) + mock_log.warning.assert_called_with(expected_log) mock_log.reset_mock() self.assertTrue(netutils.is_valid_ipv4('10.10.10')) - mock_log.warn.assert_called_with(expected_log) + mock_log.warning.assert_called_with(expected_log) mock_log.reset_mock() self.assertTrue(netutils.is_valid_ipv4('10.10.10.10')) - mock_log.warn.assert_not_called() + mock_log.warning.assert_not_called() mock_log.reset_mock() self.assertFalse( netutils.is_valid_ipv4('10', strict=True) @@ -186,7 +186,7 @@ class NetworkUtilsTest(test_base.BaseTestCase): self.assertFalse( netutils.is_valid_ipv4('10.10.10', strict=True) ) - mock_log.warn.assert_not_called() + mock_log.warning.assert_not_called() mock_log.reset_mock() self.assertTrue( netutils.is_valid_ipv4('10', strict=False) @@ -197,7 +197,7 @@ class NetworkUtilsTest(test_base.BaseTestCase): self.assertTrue( netutils.is_valid_ipv4('10.10.10', strict=False) ) - mock_log.warn.assert_not_called() + mock_log.warning.assert_not_called() mock_log.reset_mock() def test_is_valid_ipv6(self): |