4from grpc_reflection.v1alpha.proto_reflection_descriptor_database
import ServerReflectionStub
7pytest_plugins = [
'pytest_userver.plugins.grpc']
9USERVER_CONFIG_HOOKS = [
'prepare_service_config']
12@pytest.fixture(scope='session')
13def unix_socket_path(tmp_path_factory) -> pathlib.Path:
14 with tempfile.TemporaryDirectory(prefix=
'userver-grpc-socket-')
as name:
15 yield pathlib.Path(name) /
's'
18@pytest.fixture(scope='session')
19def grpc_service_endpoint(service_config) -> str:
20 components = service_config[
'components_manager'][
'components']
21 return f
'unix:{components["grpc-server"]["unix-socket-path"]}'
24@pytest.fixture(name='prepare_service_config', scope='session')
25def _prepare_service_config(unix_socket_path):
26 def patch_config(config, config_vars):
27 components = config[
'components_manager'][
'components']
28 components[
'grpc-server'][
'unix-socket-path'] = str(unix_socket_path)
34def grpc_reflection_client(grpc_channel, service_client):
35 return ServerReflectionStub(grpc_channel)