skillfed

pytest-grpc

pytest plugin for grpc

pytest-grpc v0.8.0 180.0K downloads/30d#10,156 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

pytest-grpc is a pytest plugin that simplifies testing gRPC services by providing pre-built fixtures for server setup, channel creation, and stub instantiation. It lets you write tests that call gRPC handlers directly, without manually managing server lifecycle or channel configuration.

The plugin supports two testing modes: a real gRPC server running in a background thread and a fake in-process mode that bypasses the network layer for faster unit tests. You define fixtures to inject your service implementation and protobuf stubs, then write test functions that receive a ready-to-use stub. It also supports SSL/TLS by allowing you to override the default server and channel fixtures with custom credentials.

Use it for:

  • Unit-test individual gRPC service handlers without spinning up a real server
  • Integration-test gRPC services against a real server running in a pytest worker thread
  • Test gRPC services with SSL/TLS by providing custom certificate and key fixtures
  • Verify error handling in gRPC handlers by catching exceptions raised during RPC calls

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that provides fixtures to write and run tests for gRPC services, supporting both real server and fake in-process testing modes.

No—the package is abandoned (last release 2020-05-01) with no maintenance signal. While it has low install friction and a permissive MIT license, the lack of updates means it will likely break with newer pytest or gRPC versions. Use only if locked to old dependencies; otherwise, maintain your own test fixtures or evaluate actively maintained alternatives.

Install

pytest-grpc on PyPI

pip

pip install pytest-grpc

uv

uv add pytest-grpc

poetry

poetry add pytest-grpc

Installing pytest-grpc

Before you install

Installation is straightforward with only pytest as a runtime dependency. However, the package is abandoned—last released 2020-05-01 with no recent maintenance, so expect no bug fixes or updates for modern gRPC or pytest versions.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.

Quickstart

pip install pytest-grpc

import pytest

@pytest.fixture(scope='module')
def grpc_add_to_server():
    # Import your generated gRPC add_*_to_server function
    pass

@pytest.fixture(scope='module')
def grpc_servicer():
    # Return your service implementation
    pass

def test_handler(grpc_stub):
    # grpc_stub is provided by the plugin
    response = grpc_stub.handler(request)
    assert response is not None

Requires proto files compiled to *_pb2.py and *_pb2_grpc.py using grpcio-tools before tests can run.

Verify before relying

  • Whether the package remains compatible with current versions of pytest and grpcio
  • Whether SSL/TLS fixture overrides work reliably with modern gRPC channel APIs
  • What Python versions beyond 3.6 and 3.7 are actually supported despite the abandoned status

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — pytest
Maintenance abandoned — 2,296 days since the last release
First released
Downloads 179,974/month — #10,156 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_grpc-0.8.0-py3-none-any.whl

Framework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Topic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities

Tags

pytest grpc testinggrpc service unit testsgrpc mock server testingpytest fixtures grpcgrpc integration testing
grpc-testingabandoned

More Utilities packages