Skip to content

Conversation

@imzs
Copy link

@imzs imzs commented May 30, 2025

#2305
Add virtual transport for RocketMQ

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please also fix the failing test

=================================== FAILURES ===================================
____________________________ test_Channel.test_get _____________________________

self = <t.unit.transport.test_rocketmq.test_Channel object at 0x7f75eb63bbf0>

def test_get(self):
    queue = 'new-queue'
    self.channel.basic_consume(queue, True, None, 'cg1')

    self.consumer.receive.return_value = []
    with pytest.raises(Empty):
        self.channel._get(queue)

    rocketmq_message = _message_to_rocketmq_ack_message(_mock_message(topic=queue, queue=queue))
  rocketmq_message.body = str_to_bytes(dumps(self.channel.prepare_message({})))

t/unit/transport/test_rocketmq.py:150:


self = <rocketmq.v5.model.message.Message object at 0x7f75d9132c00>
body = b'{"body": {}, "content-encoding": null, "content-type": null, "headers": {}, "properties": {"delivery_info": {}, "priority": 0}}'
Restoring 2 unacknowledged message(s)

@body.setter
def body(self, body):
  if body is None or body.strip() == "":

E BytesWarning: Comparison between bytes and string

.tox/3.12-unit/lib/python3.12/site-packages/rocketmq/v5/model/message.py:175: BytesWarning

@Nusnus Nusnus marked this pull request as draft May 31, 2025 15:59
@imzs
Copy link
Author

imzs commented Jun 1, 2025

can you please also fix the failing test

=================================== FAILURES =================================== ____________________________ test_Channel.test_get _____________________________

self = <t.unit.transport.test_rocketmq.test_Channel object at 0x7f75eb63bbf0>

def test_get(self):
    queue = 'new-queue'
    self.channel.basic_consume(queue, True, None, 'cg1')

    self.consumer.receive.return_value = []
    with pytest.raises(Empty):
        self.channel._get(queue)

    rocketmq_message = _message_to_rocketmq_ack_message(_mock_message(topic=queue, queue=queue))
  rocketmq_message.body = str_to_bytes(dumps(self.channel.prepare_message({})))

t/unit/transport/test_rocketmq.py:150:

self = <rocketmq.v5.model.message.Message object at 0x7f75d9132c00> body = b'{"body": {}, "content-encoding": null, "content-type": null, "headers": {}, "properties": {"delivery_info": {}, "priority": 0}}' Restoring 2 unacknowledged message(s)

@body.setter
def body(self, body):
  if body is None or body.strip() == "":

E BytesWarning: Comparison between bytes and string

.tox/3.12-unit/lib/python3.12/site-packages/rocketmq/v5/model/message.py:175: BytesWarning

hi, I've suppressed the BytesWarning for those test cases, and I'll submit an issue to the SDK community to get it fixed.

@auvipy
Copy link
Member

auvipy commented Jun 2, 2025

Ok, thanks

@imzs
Copy link
Author

imzs commented Jun 25, 2025

@auvipy hi, I've fixed the issue which causes test failure in py313, could you help me trigger the workflow?

@auvipy
Copy link
Member

auvipy commented Jun 25, 2025

Sure

@imzs imzs marked this pull request as ready for review June 25, 2025 09:04
@imzs imzs requested a review from auvipy June 25, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants