aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_testing/grpc_testing/_channel/_channel.py
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2018-05-02 18:36:46 -0700
committerGravatar GitHub <noreply@github.com>2018-05-02 18:36:46 -0700
commit72a85b1b2d7326239250717c69c3e8dc42136400 (patch)
tree1611bdabb8a66b3bf32da3a95fee04865b8ca1c3 /src/python/grpcio_testing/grpc_testing/_channel/_channel.py
parentc955125c32fe453b8f6b8d0fbade3fb792538a01 (diff)
parentbccd32dafa1ed60e745c958a55960cf75c56d7d2 (diff)
Merge pull request #15254 from nathanielmanistaatgoogle/12531
Add grpc.Channel.close.
Diffstat (limited to 'src/python/grpcio_testing/grpc_testing/_channel/_channel.py')
-rw-r--r--src/python/grpcio_testing/grpc_testing/_channel/_channel.py15
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)