# Resetting rabbitmq state between tests

**URL:** <https://discourse.nameko.io/t/resetting-rabbitmq-state-between-tests/194>\
**Category:** googlegroup\
**Created:** [May 18, 2017, 6:19pm UTC](https://discourse.nameko.io/t/resetting-rabbitmq-state-between-tests/194 "2017-05-18T18:19:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Diego](https://discourse.nameko.io/u/Diego)\
**Post date:** [May 18, 2017, 6:19pm UTC](https://discourse.nameko.io/t/resetting-rabbitmq-state-between-tests/194/1 "2017-05-18T18:19:48Z")

</div>

Hi,

I'm writing tests around nameko and I'm trying to figure out the best way  
to reset the state of my rabbitmq in between tests. Does nameko or kombu  
have a way to do this? (Ideally something like, nameko.test.reset\_queues())

Thanks!

---

<div class="post-metadata">

**Author:** ![mattbennett](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/mattbennett/32/13_2.png) [@mattbennett](https://discourse.nameko.io/u/mattbennett)\
**Post date:** [May 18, 2017, 10:16pm UTC](https://discourse.nameko.io/t/resetting-rabbitmq-state-between-tests/194/2 "2017-05-18T22:16:16Z")

</div>

If you use pytest, the fixtures will do this for you.

See [https://github.com/nameko/nameko/blob/master/nameko/testing/pytest.py](https://github.com/nameko/nameko/blob/master/nameko/testing/pytest.py),  
in particular `rabbit_config`, `vhost_pipeline` and `fast_teardown`. They  
all work together to make sure every test is isolated in rabbit, and that  
the tests run as quickly as possible.

If you're not using pytest for some reason, you may be able to import the  
fixtures and use them as bare functions.

> **···**
>
> On Thursday, May 18, 2017 at 7:19:48 PM UTC+1, di...@clearmetal.com wrote:
> 
> > Hi,
> > 
> > I'm writing tests around nameko and I'm trying to figure out the best way  
> > to reset the state of my rabbitmq in between tests. Does nameko or kombu  
> > have a way to do this? (Ideally something like, nameko.test.reset\_queues())
> > 
> > Thanks!
