@pytest.fixture
def message_mock():
 mmock = MessageMock()
 mmock.patch()
 (yield mmock)
 mmock.unpatch()

@ pytest . fixture def message_mock ( ) : mmock = MessageMock ( ) mmock . patch ( ) ( yield mmock ) mmock . unpatch ( )
fixture to get a messagemock .