pytest-grpc icon indicating copy to clipboard operation
pytest-grpc copied to clipboard

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

Open togakangaroo opened this issue 6 years ago • 3 comments

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.

togakangaroo avatar Aug 16 '19 21:08 togakangaroo

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.

jinnatar avatar Sep 03 '19 18:09 jinnatar

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

MaksimDan avatar Dec 02 '19 08:12 MaksimDan

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

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

nils-werner avatar Aug 20 '20 14:08 nils-werner