Tag archive for "testing"
I often want to mock reading from a file when writing unit tests in Python, and I always struggle to find the right solution again. So I'm posting it on my own blog in the hope of finding it later 🤣 My solution is to return a StringIO object from … more
Recently I started working on a Django project, loaded the prod database into it, and ran the tests. Then the data was gone. I know some people intentionally want to run tests on the "main database", and there is a very simple way to achieve this. Simply inherit from a … more