def modules(): modules_to_mock = [ 'numpy', 'grpc.beta', 'tensorflow.python.framework', 'tensorflow.core.framework', 'tensorflow.core.protobuf', 'tensorflow_serving.apis', 'tensorflow.python.saved_model.signature_constants', 'google.protobuf.json_format', 'tensorflow.core.example', 'grpc.framework.interfaces.face.face' ] mock, modules = mock_import_modules(modules_to_mock) patcher = patch.dict('sys.modules', modules) patcher.start() yield mock patcher.stop()
def run(): modules_to_mock = [ 'numpy', 'grpc.beta', 'tensorflow.python.framework', 'tensorflow.core.framework', 'tensorflow_serving.apis', 'tensorflow.python.saved_model.signature_constants', 'google.protobuf.json_format', 'tensorflow.contrib.learn.python.learn.utils', 'tensorflow.core.example', 'logging', 'tensorflow.python.estimator', 'grpc.framework.interfaces.face.face' ] mock, modules = mock_import_modules(modules_to_mock) patcher = patch.dict('sys.modules', modules) patcher.start() import tf_container.run as run yield run patcher.stop()
def set_up(): modules_to_mock = [ 'numpy', 'grpc.beta', 'tensorflow.python.framework', 'tensorflow.core.framework', 'tensorflow_serving.apis', 'tensorflow.python.saved_model.signature_constants', 'google.protobuf.json_format', 'tensorflow.contrib.learn.python.learn.utils', 'tensorflow.python.estimator', 'tensorflow.core.example', 'grpc.framework.interfaces.face.face' ] mock, modules = mock_import_modules(modules_to_mock) patcher = patch.dict('sys.modules', modules) patcher.start() from tf_container.proxy_client import GRPCProxyClient proxy_client = GRPCProxyClient(9000, input_tensor_name='inputs', signature_name='serving_default') yield mock, proxy_client patcher.stop()
def set_up(): modules_to_mock = [ 'numpy', 'grpc.beta', 'tensorflow.python.framework', 'tensorflow.core.framework', 'tensorflow_serving.apis', 'tensorflow.python.saved_model.signature_constants', 'google.protobuf.json_format', 'tensorflow.contrib.learn.python.learn.utils', 'tensorflow.contrib.training.HParams', 'tensorflow.python.estimator', 'tensorflow.core.example', 'grpc.framework.interfaces.face.face' ] mock, modules = mock_import_modules(modules_to_mock) patcher = patch.dict('sys.modules', modules) patcher.start() from tf_container.proxy_client import GRPCProxyClient proxy_client = GRPCProxyClient(9000, input_tensor_name='inputs', signature_name='serving_default') yield mock, proxy_client patcher.stop()