def test_stop(mocks: Mocks, context: yogi.Context): """Checks the stop() function in the error-free case""" def fn(context): assert context == 1234 return yogi.ErrorCode.OK mocks.MOCK_ContextStop(fn) context.stop()
def test_stop_error(mocks: Mocks, context: yogi.Context): """Checks the stop() function in the error case""" mocks.MOCK_ContextStop(lambda *_: yogi.ErrorCode.WRONG_OBJECT_TYPE) with pytest.raises(yogi.FailureException): context.stop()