Polyconseil / aioamqp

AMQP implementation using asyncio
Other
280 stars 88 forks source link

Testing aioamqp code #98

Closed timofurrer closed 8 years ago

timofurrer commented 8 years ago

Are there any example projects you could refer to which have tests for code using aioamqp? Is there any documentation about that? Is there an easy way to mock RabbitMQ (Exchanges, Queues, ...). e.g. so I'm able to manually put messages into a queue or just trigger the consumer handler?

Do you have other noteworthy comments for testing aioamqp code?

RemiCardona commented 8 years ago

Nothing public I'm afraid. We do have some tests that try to mock aioamqp out but we're slowly going towards not mocking it. We have code that spawns a new vhost with a random name in setUp and destroys it in tearDown on the host's rabbitmq. Maybe at some point we'll even have code that spawns a completely independent rabbitmq in a temporary directory but we haven't felt the need for that yet.

We use https://github.com/bkjones/pyrabbit/ to talk to rabbitmq's management API, though the project is somewhat unmaintained. The current master uses requests, I'd recommend using that instead of the latest release.

Hope that helps.

Cheers