Skip to content

Commit

Permalink
Fixing linting
Browse files Browse the repository at this point in the history
  • Loading branch information
oxeye-yuval committed Oct 21, 2021
1 parent bf02dd2 commit 03b83ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def decorated_callback(
tracer,
channel,
properties,
destination=method.exchange if method.exchange else method.routing_key,
destination=method.exchange
if method.exchange
else method.routing_key,
span_kind=SpanKind.CONSUMER,
task_name=task_name,
operation=MessagingOperationValues.RECEIVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import typing
from unittest import TestCase, mock

from pika.channel import Channel
Expand Down Expand Up @@ -42,7 +41,9 @@ def test_get_span(
destination = "myqueue"
span_kind = mock.MagicMock(spec=SpanKind)
get_value.return_value = None
_ = utils._get_span(tracer, channel, properties, task_name, destination, span_kind)
_ = utils._get_span(
tracer, channel, properties, task_name, destination, span_kind
)
generate_span_name.assert_called_once()
tracer.start_span.assert_called_once_with(
name=generate_span_name.return_value, kind=span_kind
Expand Down Expand Up @@ -282,8 +283,7 @@ def test_decorate_basic_publish_no_properties(

@mock.patch("opentelemetry.instrumentation.pika.utils._get_span")
def test_decorate_basic_publish_published_message_to_queue(
self,
get_span: mock.MagicMock,
self, get_span: mock.MagicMock,
) -> None:
callback = mock.MagicMock()
tracer = mock.MagicMock()
Expand All @@ -292,8 +292,12 @@ def test_decorate_basic_publish_published_message_to_queue(
routing_key = "test-routing-key"
properties = mock.MagicMock()
mock_body = b"mock_body"
decorated_basic_publish = utils._decorate_basic_publish(callback, channel, tracer)
decorated_basic_publish(exchange_name, routing_key, mock_body, properties)
decorated_basic_publish = utils._decorate_basic_publish(
callback, channel, tracer
)
decorated_basic_publish(
exchange_name, routing_key, mock_body, properties
)

get_span.assert_called_once_with(
tracer,
Expand All @@ -303,4 +307,4 @@ def test_decorate_basic_publish_published_message_to_queue(
span_kind=SpanKind.PRODUCER,
task_name="(temporary)",
operation=None,
)
)

0 comments on commit 03b83ae

Please sign in to comment.