Merge pull request #18172 from ericgribkoff/fix_mocks

use isinstance for internal api to workaround mocks
pull/18181/head
Eric Gribkoff 6 years ago committed by GitHub
commit 05f63ef7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/python/grpcio/grpc/_server.py
  2. 2
      src/python/grpcio_tests/tests/unit/thread_pool.py

@ -19,6 +19,7 @@ import logging
import threading
import time
from concurrent import futures
import six
import grpc
@ -565,8 +566,8 @@ def _send_message_callback_to_blocking_iterator_adapter(
def _select_thread_pool_for_behavior(behavior, default_thread_pool):
if hasattr(behavior, 'experimental_thread_pool'
) and behavior.experimental_thread_pool is not None:
if hasattr(behavior, 'experimental_thread_pool') and isinstance(
behavior.experimental_thread_pool, futures.ThreadPoolExecutor):
return behavior.experimental_thread_pool
else:
return default_thread_pool

@ -16,7 +16,7 @@ import threading
from concurrent import futures
class RecordingThreadPool(futures.Executor):
class RecordingThreadPool(futures.ThreadPoolExecutor):
"""A thread pool that records if used."""
def __init__(self, max_workers):

Loading…
Cancel
Save