skillfed

pytest-rabbitmq

RabbitMQ process and client fixtures for pytest

pytest-rabbitmq v4.0.0 108.8K downloads/30d#12,540 on PyPI51
Copyleft 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) Active released

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-rabbitmq

uv

uv add pytest-rabbitmq

poetry

poetry add pytest-rabbitmq

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

Tags

pytest rabbitmq fixturesrabbitmq test brokermessage queue testingpytest message brokerrabbitmq integration teststest rabbitmq locallypytest amqp fixtures
pytest-pluginmessage-queue-testingintegration-testing

More Python Modules packages