unitelabs.bus.testing.fixtures

Functions

  • create_mock_connection(
      protocol_factory : typing.Callable[..., asyncio.Protocol],
      stubs : typing.Optional[list[Stub]],
      **kwargs
    ) -> typing.Tuple[Transport, asyncio.Protocol]

    Parameters

    • Name
      protocol_factory
      Type
      typing.Callable[..., asyncio.Protocol]
      Default
      Description

    • Name
      stubs
      Type
      typing.Optional[list[Stub]]
      Default
      = None
      Description

    • Name
      **kwargs
      Type
      Default
      = {}
      Description

    Response

    Type
    typing.Tuple[Transport, asyncio.Protocol]
    Description

  • @pytest.fixture

    mock_factory(event_loop) -> TransportFactory

    Returns `create_mock_connection` function that uses `pytest-asyncio` event-loop fixture to ensure no global loop exists.

    Parameters

    • Name
      event_loop
      Type
      Default
      Description

    Response

    Type
    TransportFactory
    Description

  • @pytest.fixture

    serial_device() -> typing.AsyncGenerator[SerialDeviceMock, None]

    Response

    Type
    typing.AsyncGenerator[SerialDeviceMock, None]
    Description

Copyright © 2024