Skip to content

patch_broker_calls

faststream.broker.test.patch_broker_calls #

patch_broker_calls(broker: BrokerUsecase[Any, Any]) -> None

Patch broker calls.

PARAMETER DESCRIPTION
broker

The broker to patch.

TYPE: BrokerUsecase[Any, Any]

RETURNS DESCRIPTION
None

None.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/broker/test.py
def patch_broker_calls(broker: BrokerUsecase[Any, Any]) -> None:
    """Patch broker calls.

    Args:
        broker: The broker to patch.

    Returns:
        None.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    broker.middlewares = tuple(
        filter(  # type: ignore[assignment]
            lambda x: not isinstance(x, CriticalLogMiddleware),
            broker.middlewares,
        )
    )
    broker._abc_start()

    for handler in broker.handlers.values():
        for f, _, _, _, _, _ in handler.calls:
            f.set_test()

Last update: 2023-11-13