How do I create a mock context for grpc unit testing (python)

  grpc-python, pytest, pytest-mock, python-3.x

In normal grpc communications, grpc automatically creates a context to go with the request. How do I create a mock context to pass with my unit test call, so my servicing function has an object to manipulate?

Currently I have the code skip the context calls if it receives a NoneType as context, but that is not a good solution.

Source: Python-3x Questions

LEAVE A COMMENT