pytest-rabbitmq
RabbitMQ process and client fixtures for pytest
What it is and what it does
pytest-rabbitmq is a pytest plugin that automates the setup and teardown of a local RabbitMQ broker for test suites. It provides two main fixtures: rabbitmq_proc, which starts a RabbitMQ instance at the beginning of a test session and stops it at the end, and rabbitmq, a client fixture that connects to the broker and automatically cleans up queues and exchanges after each test to maintain isolation.
The plugin handles the complexity of spawning and managing a RabbitMQ process, discovering available ports, and configuring broker paths—all configurable via fixture arguments, command-line options, or pytest.ini settings. It depends on pytest, pika (the RabbitMQ client library), mirakuru (for process management), and port-for (for port discovery). Requires Python 3.10 or later and an installed RabbitMQ server on the test machine.
Use it for:
- Write integration tests for message queue consumers and producers without mocking the broker.
- Test RabbitMQ-dependent microservices in isolation with a fresh broker state per test.
- Validate queue and exchange configurations in your application before deployment.
- Run CI/CD pipelines that need a temporary RabbitMQ instance without external service dependencies.
- Develop and test AMQP protocol implementations with a real broker available during test execution.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that provides fixtures to start and manage a local RabbitMQ broker instance for tests, plus a client fixture for interacting with it.
Yes. The plugin is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real testing need for RabbitMQ-dependent code. The LGPLv3+ license is permissive for most use cases. The main blocker is the requirement to have RabbitMQ binaries available on the test machine; if your CI environment already provides RabbitMQ or you can install it easily, this is a straightforward win for test reliability.
Install
pytest-rabbitmq on PyPI
pip
pip install pytest-rabbitmquv
uv add pytest-rabbitmqpoetry
poetry add pytest-rabbitmqInstalling pytest-rabbitmq
Before you install
Low install friction with four runtime dependencies (pytest, port-for, mirakuru, pika). Actively maintained; last commit 2026-08-10 with 51 repository stars. Supports current Python versions (3.10–3.14).
License in practice
Licensed under LGPLv3+, a copyleft license. You may use and modify the package freely, but any derivative works must also be licensed under compatible terms. Suitable for most open-source and commercial projects, though closed-source modifications require careful compliance review.
Quickstart
pip install pytest-rabbitmq
# In your test file:
def test_with_rabbitmq(rabbitmq):
assert rabbitmq is not None
RabbitMQ must be installed on the test machine; the plugin expects rabbitmq-server and rabbitmqctl binaries at /usr/lib/rabbitmq/bin/ (Linux default) or configured paths.
Verify before relying
- Whether the plugin automatically discovers RabbitMQ on non-Linux systems or requires explicit path configuration.
- Performance characteristics when running multiple test sessions with different RabbitMQ instances.
- Compatibility with containerized RabbitMQ or remote broker instances beyond localhost.
Package facts
| License | GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — pytest, port-for, mirakuru, pika |
| Maintenance | actively maintained — 145 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 108,779/month — #12,540 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_rabbitmq-4.0.0-py3-none-any.whl
Keywords: tests, pytest, fixture, rabbitmq, messsage queue
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pytest-grpcA pytest plugin that provides fixtures to write…
permissive · top 15,000 on PyPI
pytest-redisA pytest plugin that provides fixtures for…
copyleft · top 15,000 on PyPI
pytest-sparkA pytest plugin that integrates Apache Spark…
permissive · top 15,000 on PyPI
pytest-postgresqlA pytest plugin that provides fixtures to…
copyleft · top 5,000 on PyPI
pytest-mysqlA pytest plugin that provides MySQL and MariaDB…
copyleft · top 15,000 on PyPI
pytest-localftpserverProvides pytest fixtures for running local FTP…
permissive · top 15,000 on PyPI
pytest-shutilProvides pytest fixtures and utilities for…
permissive · top 15,000 on PyPI
pytest-qtpytest-qt is a pytest plugin that provides…
permissive · top 5,000 on PyPI
pytest-deadfixturesA pytest plugin that identifies unused and…
permissive · top 5,000 on PyPI
pytest-homeassistant-custom-componentProvides pytest fixtures and testing utilities…
permissive · top 5,000 on PyPI