Image for post
Image for post
Photo by Chris Ried on Unsplash

Coming from a Ruby on Rails background, I really appreciate solutions that became community standards of solving problems. One of such things is DatabaseCleaner gem, which ensures that your tests run in separation and there are no data leaks between them.

Recently I was looking for a similar solution for Python, but, to my surprise, I haven’t found any. However, it’s easy to leverage what SQLAlchemy and Pytest offer to wrap tests in separate database transactions. Let me show you a neat take on the problem that I hope you will find convenient to use.

Setting up a DB connection

Before we’re able to use…

Your path does not need to be a conventional one. Mine was a series of lucky events combined with some hard work.

Image for post
Image for post
Photo by Hitesh Choudhary on Unsplash

The company I work for tries to mitigate the social impact of the COVID-19 pandemic. Once in a while, we have on-line coffees and lunches. During one of them, we were exchanging stories about how we started to code. When I finished telling mine, I saw my colleagues surprised by the absurdity of the turn of events. It was the time when I realized how peculiar my story is, so I decided to write it down.

The beginnings

For the…

If I knew those things when I started coding, my life as a programmer would have been much easier

Image for post
Image for post
Photo by Danial RiCaRoS on Unsplash

At the beginning of my career as a Ruby developer, I used to work on a project that had barely any tests. This, combined with poor code quality, made the development of any new feature similar to a walk through a minefield — you never knew if your change is going to crash the app, even in a different place. Add my lack of knowledge at the time and a lot of stress, and you get a nightmare of experience for any beginner programmer.

Honestly, it was a miserable time. The project left such a vivid memory that it serves…

Damian Kampik

💻 Ruby, Python & a bit of JS 👨‍👩‍👧 Husband & father 🎸 Bass player 🧗‍♂️ Amateur climber | Proud member of @u2iKRK

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store