kataev / pytest-grpc

Allow test gRPC with pytest
MIT License
126 stars 20 forks source link

Docs are not clear on how to use this library or what it does #8

Open togakangaroo opened 5 years ago

togakangaroo commented 5 years ago

It is really unclear from the docs what this library does exactly (a short paragraph on it would be nice) and also how to use it

For example in the docs you have

def test_some(grpc_stub):
    request = EchoRequest()
    response = grpc_stub.handler(request)

    assert response.name == f'test-{request.name}'

but grpc_stub is not defined nor imported anywhere - where does it come from? Similarly in the more complex example "with authentication" you have a create_channel fixture passed in which is neither declared nor imported.

jinnatar commented 5 years ago

Both grpc_stub and create_channel magically appeared when I installed the module from pip. Somehow the grpc_stub_cls gets automagically turned into grpc_stub. But I agree, explicitly explaining this in documentation would be preferred.

MaksimDan commented 4 years ago

Looks like its a redirect, defined here: https://github.com/kataev/pytest-grpc/blob/master/pytest_grpc/plugin.py#L149

nils-werner commented 4 years ago

grpc_stub is not defined nor imported anywhere - where does it come from?

It's a pytest fixture, that's just how they work.