Skip to main content

pytest-amgi

Pytest helpers for driving AMGI applications in-process.

Installation

pip install pytest-amgi==0.47.0

Example

This example uses AsyncFast:

from asyncfast import AsyncFast
from pytest_amgi import AMGIProducerFactory


async def test_message(amgi_producer: AMGIProducerFactory) -> None:
    app = AsyncFast()

    @app.channel("topic")
    async def handler(payload: int) -> None:
        assert payload == 1

    producer = await amgi_producer(app)
    response = await producer.send("topic", json=1)

    response.assert_acked()

The amgi_producer fixture starts lifespan before returning the producer and shuts it down when the test finishes.

Message Sends

Use assert_has_message_send to assert that the application sent a follow-up message:

from dataclasses import dataclass

from asyncfast import AsyncFast
from asyncfast import Message
from asyncfast import MessageSender
from pytest_amgi import AMGIProducerFactory


@dataclass
class ProcessOrder(Message, address="order.process"):
    payload: dict[str, int]


async def test_message_send(amgi_producer: AMGIProducerFactory) -> None:
    app = AsyncFast()

    @app.channel("order.created")
    async def handle_order_created(
        message_sender: MessageSender[ProcessOrder],
    ) -> None:
        await message_sender.send(ProcessOrder(payload={"id": 1}))

    producer = await amgi_producer(app)
    response = await producer.send("order.created")

    response.assert_acked()
    response.assert_has_message_send("order.process", json={"id": 1})

Contact

For questions or suggestions, please contact jack.burridge@mail.com.

License

Copyright 2026 AMGI

Metadata

Release files for pytest-amgi 0.47.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-amgi 0.47.0
File Size Uploaded Provenance
pytest_amgi-0.47.0.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-amgi 0.47.0
File Interpreter ABI Platform
pytest_amgi-0.47.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / pytest_amgi-0.47.0.tar.gz

Download URL pytest_amgi-0.47.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dbd49abb9a7ab1031a39f0770ef081d49e9febcb092a0615cfc67336326a5a1e
BLAKE2b-256 checksum
How to use checksums
4b9892ae4f5af4617d2179a32280ca490ba1bb6c63e24cda4f380eb2fa0dd900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pytest_amgi-0.47.0-py3-none-any.whl

Download URL pytest_amgi-0.47.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15c1444e23b0d7bfdeb6675b35c82b2774398b7e68110a0ed84441389200b0f5
BLAKE2b-256 checksum
How to use checksums
ec0b92ed12bc14972eb0ed0d9a346e73383fac1038579d7d02291a182e4c8d74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pytest-amgi 0.47.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page