Skip to content

Commit

Permalink
add test for grpcio issue
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Aug 28, 2023
1 parent 2e04d51 commit c909066
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ outputs:
- {{ pin_subpackage('libgrpc', exact=True) }}
- __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }} # [osx and x86_64]
test:
source_files:
- examples/
files:
- grpcio_distribtest.py
requires:
- pip
- grpcio-tools
imports:
- grpc
- grpc._cython
Expand All @@ -173,6 +176,10 @@ outputs:
commands:
- python -m pip check
- python grpcio_distribtest.py
# generate helloworld, see https://grpc.io/docs/languages/python/quickstart/#generate-grpc-code
- cd examples/python/helloworld
- python -m grpc_tools.protoc -I../../protos --python_out=. --pyi_out=. --grpc_python_out=. ../../protos/helloworld.proto
- python test_grpcio_helloworld.py

about:
home: https://grpc.io/
Expand Down
12 changes: 12 additions & 0 deletions recipe/test_grpcio_helloworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# this test assumes it is being run in examples/python/helloworld,
# after having generated the helloworld_pb2{,_grpc} modules (see meta.yaml)
import grpc
import helloworld_pb2
import helloworld_pb2_grpc

# run this a couple times because it happens randomly, see
# https://github.com/conda-forge/grpc-cpp-feedstock/issues/281
for _ in range(1000):
with grpc.insecure_channel('localhost:50051') as channel:
stub = helloworld_pb2_grpc.GreeterStub(channel)
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))

0 comments on commit c909066

Please sign in to comment.