Skip to content

Bug: test_topic_message_query_receives_message #945

@exploreriii

Description

@exploreriii

We just merged a PR to main that had passed checks but didn't on main

We should debug this error and resolve it

https://github.com/hiero-ledger/hiero-sdk-python/actions/runs/19894801230/job/57022339904
877cf10

interstingly, the tests for python 3.10 and 3.13 succeded but 3.12 and 3.14 failed

=================================== FAILURES ===================================
__________________ t

Image

s __________________

env = <tests.integration.utils_for_test.IntegrationTestEnv object at 0x7faeb7139510>

@pytest.mark.integration
def test_topic_message_query_receives_messages(env):
    """Test that topic message query receives a message."""
    topic_id = create_topic(env.client)

    messages: List[str] = []

    def get_message(m: TopicMessage):
        messages.append(m.contents.decode('utf-8'))

    def on_error_handler(e):
        raise RuntimeError(f"Subscription error: {e}")

    query = TopicMessageQuery(
        topic_id=topic_id,
        start_time=datetime.now(timezone.utc),
        limit=0
    )

    handle = query.subscribe(
        env.client,
        on_message=get_message,
        on_error=on_error_handler
    )

    message_receipt = (
        TopicMessageSubmitTransaction(
            topic_id=topic_id,
            message="Hello, Python SDK!"
        )
        .freeze_with(env.client)
        .execute(env.client)
    )

    assert (
        message_receipt.status == ResponseCode.SUCCESS
    ), f"Message submission failed with status: {ResponseCode(message_receipt.status).name}"


    start = datetime.now()

    while len(messages) == 0:
        if datetime.now() - start > timedelta(seconds=120):
          raise TimeoutError("TopicMessage was not received in time")

E TimeoutError: TopicMessage was not received in time

tests/integration/topic_message_query_e2e_test.py:100: TimeoutError
=========================== short test summary info ============================
FAILED tests/integration/topic_message_query_e2e_test.py::test_topic_message_query_receives_messages - TimeoutError: TopicMessage was not received in time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions