Consuming and Publishing Celery Tasks in C++ via AMQP

Celery is an asynchronous task queue based on distributed message passing. It is written in Python, but the protocol can be implemented in any language. However, there is currently no C++ client that is able to publish (send) and consume (receive) tasks. This is needed when your project is written in a combination of Python and C++, and you would like to process tasks in both of these languages. In the present post, I describe a way of interoperating between Python and C++ workers via the AMQP back-end (RabbitMQ).
Read More

Unit-Testing With unittest.mock.patch()

Sometimes, you need to unit-test functions that call functions from the standard library that rely on side effects. In this post, I show a way of doing so in Python with unittest.mock.patch(). More specifically, we implement two context managers that use os.chdir() to perform actions in the given directory, and show a way of unit-testing them without relying on the file system.
Read More