Allows to install mocks that are kept active between tests, see grpc_mockserver_session.
Definition at line 34 of file __init__.py.
Public Member Functions | |
| None | __init__ (self, *, grpc.aio.Server server, bool experimental=False) |
| None | reset_mocks (self) |
Removes all mocks for this mockserver that have been installed using MockserverSession or Mockserver API. | |
| asyncexc_append_scope (self, Optional[AsyncExcAppend] asyncexc_append) | |
Sets testsuite's asyncexc_append for use in the returned scope. | |
| grpc.aio.Server | server (self) |
| The underlying grpc.aio.Server. | |
| None | start (self) |
| Starts the server. | |
| None | stop (self) |
| Stops the server properly. | |
| MockserverSession | __aenter__ (self) |
| None | __aexit__ (self, exc_type, exc_val, exc_tb) |
Protected Member Functions | |
| _ServiceMock | _get_auto_service_mock (self, type servicer_class) |
| None | _set_asyncexc_append (self, Optional[AsyncExcAppend] asyncexc_append) |
Protected Attributes | |
| grpc.aio.Server | _server = server |
| dict | _auto_service_mocks = {} |
| Optional[AsyncExcAppend] | _asyncexc_append = None |
| None pytest_userver.grpc.MockserverSession.__init__ | ( | self, | |
| * | , | ||
| grpc.aio.Server | server, | ||
| bool | experimental = False ) |
Initializes MockserverSession. Takes ownership of server. To properly start and stop the server, use MockserverSession as an async contextmanager:
MockserverSession is usually obtained from grpc_mockserver_session. Definition at line 43 of file __init__.py.
| MockserverSession pytest_userver.grpc.MockserverSession.__aenter__ | ( | self | ) |
Definition at line 119 of file __init__.py.
| None pytest_userver.grpc.MockserverSession.__aexit__ | ( | self, | |
| exc_type, | |||
| exc_val, | |||
| exc_tb ) |
Definition at line 123 of file __init__.py.
|
protected |
Definition at line 64 of file __init__.py.
|
protected |
Definition at line 74 of file __init__.py.
| pytest_userver.grpc.MockserverSession.asyncexc_append_scope | ( | self, | |
| Optional[AsyncExcAppend] | asyncexc_append ) |
Sets testsuite's asyncexc_append for use in the returned scope.
Definition at line 89 of file __init__.py.
| None pytest_userver.grpc.MockserverSession.reset_mocks | ( | self | ) |
Removes all mocks for this mockserver that have been installed using MockserverSession or Mockserver API.
Definition at line 79 of file __init__.py.
| grpc.aio.Server pytest_userver.grpc.MockserverSession.server | ( | self | ) |
The underlying grpc.aio.Server.
Definition at line 100 of file __init__.py.
| None pytest_userver.grpc.MockserverSession.start | ( | self | ) |
Starts the server.
Definition at line 106 of file __init__.py.
| None pytest_userver.grpc.MockserverSession.stop | ( | self | ) |
Stops the server properly.
Prefer this method to stopping server manually.
Definition at line 113 of file __init__.py.
|
protected |
Definition at line 62 of file __init__.py.
|
protected |
Definition at line 61 of file __init__.py.
|
protected |
Definition at line 60 of file __init__.py.