Skip to content

MockEvents

Part of Offline testing in the Python API reference.

Related guidance: getting-started/mock-setup.

Runnable examples: preflight.py.

from picogrid_ecn_client.testing import MockEvents

Expose synchronization events for deterministic asynchronous tests.

class MockEvents: ...

Source · testing/mock_ecn.py

Set when an MQTT v5 client connection is accepted.

mqtt_connected: asyncio.Event

Source · testing/mock_ecn.py

Set when an accepted MQTT v5 client disconnects.

mqtt_disconnected: asyncio.Event

Source · testing/mock_ecn.py

Set when the mock receives a client publication.

message_received: asyncio.Event

Source · testing/mock_ecn.py

Set when the mock forwards a publication to subscribed clients.

message_forwarded: asyncio.Event

Source · testing/mock_ecn.py

Set when a configured drop suppresses publication forwarding.

message_dropped: asyncio.Event

Source · testing/mock_ecn.py

Set when a configured malformed payload is forwarded.

malformed_message_sent: asyncio.Event

Source · testing/mock_ecn.py

Set when synthetic authentication rejects a client.

authentication_failed: asyncio.Event

Source · testing/mock_ecn.py

Set when a synthetic mock-only ACL label denies an operation.

authorization_denied: asyncio.Event

Source · testing/mock_ecn.py

Set when deterministic forced disconnection is requested.

forced_disconnect: asyncio.Event

Source · testing/mock_ecn.py

Set when a transient connection drop consumes one configured attempt.

connection_dropped: asyncio.Event

Source · testing/mock_ecn.py

Set when an operation-specific negative acknowledgment is returned.

acknowledgement_denied: asyncio.Event

Source · testing/mock_ecn.py

Set when one configured raw MQTT reason code is returned.

acknowledgement_reason_returned: asyncio.Event

Source · testing/mock_ecn.py

Set when the mock sends one deliberately malformed MQTT response.

malformed_protocol_response: asyncio.Event

Source · testing/mock_ecn.py

Set when clients are disconnected before a caller starts publication.

publication_disconnected_before_send: asyncio.Event

Source · testing/mock_ecn.py

publication_disconnected_qos0_before_completion

Section titled “publication_disconnected_qos0_before_completion”

Set when a QoS 0 PUBLISH is interrupted after its fixed header.

publication_disconnected_qos0_before_completion: asyncio.Event

Source · testing/mock_ecn.py

Set when a processed QoS 1 publication is disconnected before PUBACK.

publication_disconnected_before_puback: asyncio.Event

Source · testing/mock_ecn.py

Set when a QoS 1 publisher is disconnected immediately after PUBACK.

publication_disconnected_after_puback: asyncio.Event

Source · testing/mock_ecn.py

Clear every synchronization event without replacing event objects.

def reset() -> None

Source · testing/mock_ecn.py

Version 0.2.0 · branch main