Kris Neuharth

Code and adventure.

Apr 25, 2013

Your Tests Are Lying To You

This is a lightning talk I delivered (shouted?) during PyCon 2013 at the infamous TIP-BOF open space. It covers potential ways your unit tests may be yielding false positives when they should indeed be failing when using the Mock library.

I include some example code to demonstrate how not using autospec is bad and present an example of how to extend the basic Mock and MagicMock classes to add new test assertions to further prevent common testing mistakes.

Code and slides can be found here: Your Tests Are Lying To You

Apr 25, 2013

Pika and RabbitMQ Reconnect Example

For a recent infrastructure project at work we decided to use RabbitMQ as our message broker to queue up e-mail messages to be sent to to our customers. While we ultimately ended up using Celery for managing and processing the tasks, I initially wrote a few custom classes to do this using Pika.

We mainly decided to go with Celery because it was very mature and abstracted things away in a very usable way. While the pure Pika implementation was faster, it did not make sense when Celery offers so much more.

One thing I ran into while using Pika was the lack of a good example in their documentation to cover reconnecting when a connection to the queue is lost.

I threw together a Github repository that correctly demonstrates how to reconnect to RabbitMQ when a connection is lost.

You can find it here.

Feb 15, 2013

First!

Hello world !