diff options
author | Nathaniel Manista <nathaniel@google.com> | 2018-05-02 23:35:00 +0000 |
---|---|---|
committer | Nathaniel Manista <nathaniel@google.com> | 2018-05-02 23:59:15 +0000 |
commit | bccd32dafa1ed60e745c958a55960cf75c56d7d2 (patch) | |
tree | 49944d8d3df4e27226d13af8ee0d88d688ab1d7c /src/python/grpcio_testing | |
parent | ca7ba4d0ac3ab452c5db60befc8be37fd6e2339b (diff) |
Add grpc.Channel.close
Diffstat (limited to 'src/python/grpcio_testing')
-rw-r--r-- | src/python/grpcio_testing/grpc_testing/_channel/_channel.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/python/grpcio_testing/grpc_testing/_channel/_channel.py b/src/python/grpcio_testing/grpc_testing/_channel/_channel.py index b015b8d738..0c1941e6be 100644 --- a/src/python/grpcio_testing/grpc_testing/_channel/_channel.py +++ b/src/python/grpcio_testing/grpc_testing/_channel/_channel.py @@ -56,6 +56,21 @@ class TestingChannel(grpc_testing.Channel): response_deserializer=None): return _multi_callable.StreamStream(method, self._state) + def _close(self): + # TODO(https://github.com/grpc/grpc/issues/12531): Decide what + # action to take here, if any? + pass + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self._close() + return False + + def close(self): + self._close() + def take_unary_unary(self, method_descriptor): return _channel_rpc.unary_unary(self._state, method_descriptor) |