Skip to content

Commit

Permalink
generate
Browse files Browse the repository at this point in the history
  • Loading branch information
ItayGibel-helios committed Oct 21, 2021
1 parent 13b2fbc commit 2c9341d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Any, Callable, List, Optional
from logging import getLogger
from typing import Any, Callable, List, Optional

from pika.channel import Channel
from pika.spec import Basic, BasicProperties
Expand Down Expand Up @@ -68,8 +68,8 @@ def decorated_callback(
with trace.use_span(span, end_on_exit=True):
try:
consume_hook(span, body, properties)
except Exception as e: # noqa: W0703 (Ignore lint error: "Catching too general exception")
_LOG.exception(e)
except Exception as hook_exception: # noqa: W0703 (Ignore lint error: "Catching too general exception")
_LOG.exception(hook_exception)
retval = callback(channel, method, properties, body)
return retval

Expand Down Expand Up @@ -112,8 +112,8 @@ def decorated_function(
propagate.inject(properties.headers)
try:
publish_hook(span, body, properties)
except Exception as e: # noqa: W0703 (Ignore lint error: "Catching too general exception")
_LOG.exception(e)
except Exception as hook_exception: # noqa: W0703 (Ignore lint error: "Catching too general exception")
_LOG.exception(hook_exception)
retval = original_function(
exchange, routing_key, body, properties, mandatory
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ def test_decorate_callback_with_hook(
use_span.assert_called_once_with(
get_span.return_value, end_on_exit=True
)
consume_hook.assert_called_once_with(get_span.return_value, mock_body, properties)
consume_hook.assert_called_once_with(
get_span.return_value, mock_body, properties
)
callback.assert_called_once_with(
channel, method, properties, mock_body
)
Expand Down Expand Up @@ -371,5 +373,7 @@ def test_decorate_basic_publish_with_hook(
callback.assert_called_once_with(
channel, method, mock_body, mock_properties, False
)
publish_hook.assert_called_once_with(get_span.return_value, mock_body, mock_properties)
publish_hook.assert_called_once_with(
get_span.return_value, mock_body, mock_properties
)
self.assertEqual(retval, callback.return_value)

0 comments on commit 2c9341d

Please sign in to comment.