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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_amgi-0.47.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_amgi-0.47.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pytest_amgi-0.47.0.tar.gz.

File metadata

  • Download URL: pytest_amgi-0.47.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for pytest_amgi-0.47.0.tar.gz
Algorithm Hash digest
SHA256 dbd49abb9a7ab1031a39f0770ef081d49e9febcb092a0615cfc67336326a5a1e
MD5 ece1de5bfd32109bc1bd6162b57e2ce6
BLAKE2b-256 4b9892ae4f5af4617d2179a32280ca490ba1bb6c63e24cda4f380eb2fa0dd900

See more details on using hashes here.

File details

Details for the file pytest_amgi-0.47.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_amgi-0.47.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for pytest_amgi-0.47.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15c1444e23b0d7bfdeb6675b35c82b2774398b7e68110a0ed84441389200b0f5
MD5 c4254fd9390c0a00491ec50909b321b0
BLAKE2b-256 ec0b92ed12bc14972eb0ed0d9a346e73383fac1038579d7d02291a182e4c8d74

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.47.0 This release

2 files

0.46.0

2 files

0.45.1

2 files

0.45.0

2 files

0.44.0

2 files

0.43.0

2 files

0.42.0

2 files

0.41.1

2 files

0.41.0

2 files

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