We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, Thanks for the awesome library! I'm trying to do assert that on_message was called on publish.
from unittest.mock import create_autospec import pytest from asyncio_paho import AsyncioPahoClient async def on_connect_async(client, _1, _2, _3) -> None: client.subscribe("mytopic") async def on_message(_, _1, msg): print(f"Received from {msg.topic}: {str(msg.payload)}") mock_on_message = create_autospec(on_message) @pytest.mark.asyncio async def test_pubsub(): async with AsyncioPahoClient(client_id="paho 🐝") as client: client.asyncio_listeners.add_on_connect(on_connect_async) await client.asyncio_connect("localhost") client.asyncio_listeners.add_on_message(mock_on_message) client.publish("mytopic", "foo") mock_on_message.assert_called_once()
However, I'm getting AssertionError: Expected 'mock' to have been called once. Called 0 times.
AssertionError: Expected 'mock' to have been called once. Called 0 times.
Thanks for taking a look :)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
Thanks for the awesome library! I'm trying to do assert that on_message was called on publish.
However, I'm getting
AssertionError: Expected 'mock' to have been called once. Called 0 times.
Thanks for taking a look :)
The text was updated successfully, but these errors were encountered: