summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Alla <browniebroke@users.noreply.github.com>2018-09-27 14:12:44 +0100
committerAsif Saif Uddin <auvipy@gmail.com>2018-09-27 19:12:44 +0600
commit62087a67cfbae4e87718fbb917f5140aa66e8287 (patch)
treeef824dc348c43c4362d2fe2905ed11f64f408312
parent5f9261d1259ecc97bc34b6b63c276e290f115e6e (diff)
downloadkombu-62087a67cfbae4e87718fbb917f5140aa66e8287.tar.gz
Fix a deprecation warning about logger.warn() (#924)
* Fix a deprecation warning about logger.warn() This fixes a deprecation warning from the standard library's logging module: > The 'warn' method is deprecated, use 'warning' instead * Update test
-rw-r--r--AUTHORS1
-rw-r--r--kombu/common.py4
-rw-r--r--kombu/connection.py6
-rw-r--r--kombu/transport/etcd.py2
-rw-r--r--kombu/transport/virtual/base.py2
-rw-r--r--t/unit/test_common.py2
6 files changed, 10 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index 5813c597..55c638b2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,6 +22,7 @@ Basil Mironenko <bmironenko@ddn.com>
Bobby Beever <bobby.beever@yahoo.com>
Brian Bernstein
Brian Bouterse <bmbouter@redhat.com>
+Bruno Alla <alla.brunoo@gmail.com>
C Anthony Risinger <anthony+corvisa.com@xtfx.me>
Chris Erway <cce@appneta.com>
Christophe Chauvet <christophe.chauvet@gmail.com>
diff --git a/kombu/common.py b/kombu/common.py
index d5d4e0dc..56d63127 100644
--- a/kombu/common.py
+++ b/kombu/common.py
@@ -403,8 +403,8 @@ class QoS(object):
if pcount != self.prev:
new_value = pcount
if pcount > PREFETCH_COUNT_MAX:
- logger.warn('QoS: Disabled: prefetch_count exceeds %r',
- PREFETCH_COUNT_MAX)
+ logger.warning('QoS: Disabled: prefetch_count exceeds %r',
+ PREFETCH_COUNT_MAX)
new_value = 0
logger.debug('basic.qos: prefetch_count->%s', new_value)
self.callback(prefetch_count=new_value)
diff --git a/kombu/connection.py b/kombu/connection.py
index 392a2542..665cec60 100644
--- a/kombu/connection.py
+++ b/kombu/connection.py
@@ -243,8 +243,10 @@ class Connection(object):
if transport == 'amqp' and supports_librabbitmq():
transport = 'librabbitmq'
if transport == 'rediss' and ssl_available and not ssl:
- logger.warn('Secure redis scheme specified (rediss) with no ssl '
- 'options, defaulting to insecure SSL behaviour.')
+ logger.warning(
+ 'Secure redis scheme specified (rediss) with no ssl '
+ 'options, defaulting to insecure SSL behaviour.'
+ )
ssl = {'ssl_cert_reqs': CERT_NONE}
self.hostname = hostname
self.userid = userid
diff --git a/kombu/transport/etcd.py b/kombu/transport/etcd.py
index 025c1d7a..04e67cda 100644
--- a/kombu/transport/etcd.py
+++ b/kombu/transport/etcd.py
@@ -267,5 +267,5 @@ class Transport(virtual.Transport):
if x.startswith('python-etcd'):
return x.split('==')[1]
except (ImportError, IndexError):
- logger.warn('Unable to find the python-etcd version.')
+ logger.warning('Unable to find the python-etcd version.')
return 'Unknown'
diff --git a/kombu/transport/virtual/base.py b/kombu/transport/virtual/base.py
index 089a256b..61ede626 100644
--- a/kombu/transport/virtual/base.py
+++ b/kombu/transport/virtual/base.py
@@ -977,7 +977,7 @@ class Transport(base.Transport):
try:
callback = self._callbacks[queue]
except KeyError:
- logger.warn(W_NO_CONSUMERS, queue)
+ logger.warning(W_NO_CONSUMERS, queue)
self._reject_inbound_message(message)
else:
callback(message)
diff --git a/t/unit/test_common.py b/t/unit/test_common.py
index a7241613..2a8d1e22 100644
--- a/t/unit/test_common.py
+++ b/t/unit/test_common.py
@@ -337,7 +337,7 @@ class test_QoS:
# cannot use 2 ** 32 because of a bug on macOS Py2.5:
# https://jira.mongodb.org/browse/PYTHON-389
qos.set(4294967296)
- logger.warn.assert_called()
+ logger.warning.assert_called()
callback.assert_called_with(prefetch_count=0)
def test_qos_increment_decrement(self):