Last active
May 3, 2019 15:26
-
-
Save pfreixes/110dbdd88e3b0e1e450da9c6fc97496c to your computer and use it in GitHub Desktop.
Test experimental gRPC using Native Asyncio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import pytest | |
import subprocess | |
import time | |
from grpc_asyncio import grpc_init_asyncio | |
from grpc_asyncio import create_channel | |
from tests.acceptance.fixtures import echo_pb2 | |
class TestClient: | |
@pytest.mark.asyncio | |
async def test_unary_call(self, server): | |
grpc_init_asyncio() | |
channel = await create_channel("127.0.0.1", 3333) | |
response = await channel.unary_call( | |
b'/echo.Echo/Hi', | |
echo_pb2.EchoRequest(message="Hi Grpc Asyncio").SerializeToString() | |
) | |
assert echo_pb2.EchoReply.FromString(response).message == "Hi Grpc Asyncio" |
Author
pfreixes
commented
May 3, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment