pytest-grpc
pytest plugin for grpc
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-grpcuv
uv add pytest-grpcpoetry
poetry add pytest-grpcInstalling 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
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytest-rabbitmqA pytest plugin that provides fixtures to start…
copyleft · top 15,000 on PyPI
pytest-dockerpytest-docker provides pytest fixtures that…
permissive · top 5,000 on PyPI
pytest-twistedA pytest plugin that enables testing of…
permissive · top 15,000 on PyPI
grpcio-testingProvides testing utilities and fixtures for…
permissive · top 15,000 on PyPI
rtestA Python test runner built in Rust that uses…
permissive · top 15,000 on PyPI
pytest-mock-resourcesProvides pytest fixtures that spin up real…
permissive · top 15,000 on PyPI
pytest-catchlogA pytest plugin that automatically captures log…
permissive · top 15,000 on PyPI
pytest-redisA pytest plugin that provides fixtures for…
copyleft · top 15,000 on PyPI
tavernTavern is a pytest plugin and command-line tool…
permissive · top 15,000 on PyPI
pytest-console-scriptsA pytest plugin that runs Python console…
permissive · top 15,000 on PyPI