I have implemented a gRPC server and and client following this example. I'm using the grpc.ServicerContext.abort_with_status() method to raise the exceptions in the server. The unit tests for the error cases in the server are written the same way I'm calling the server from the client, by catching the grpc.GrpcClient exception: try: result = client.my_rpc(request) except grpc.RpcError as rpc_error: status = rpc_status.from_call(rpc_error) Now I want to test the client, but I have not found way to test the cases where this exception occours. I'm trying to mock the stub method call to raise this exception. But in the tests, when trying to obtain the status: status = rpc_status.from_call(rpc_error) I'm getting the following exception: AttributeError: 'RpcError' object has no attribute 'trailing_metadata' I have not even tried to add a status to this RpcError, I'm following what was done in this answer. Anyone has faced this issue? I have tried so many things and I can not find a way to make it work. I implemented a class to act as a stub that uses the grpcio-testing library to make calls to another class which is a servicer class I implemented. Then mocking the stub in the client, but I couldn't make it raise the exception when using the grpc.ServicerContext.abort_with_status(). Any help is welcome, if there is a better way to test this, please let me know. Continue reading...