Django Test Driven Development with Pytest

Last updated 1 year ago by Afroshok Afroshok

django

We made the decision that our own website and all the next upcoming projects will be built using the Test Driven Development method. We need to be “world class” and follow the best practices used by professional devs in the wild.

On searching online for the best way to do this for a Django project we found the book by Harry Percival, Obey the Testing Goat! . We started with Harry Percival’s workshop — TDD with Django, from scratch a beginner’s intro to testing and web development that took place at PyCon 2015.

We followed it up with a talk by Martin Brochhaus at the Singapore Djangonauts, titled The Django Test Driven Development Cookbook and the slides. This tutorial is based on this talk and what we found interesting as we worked through it.

We use pyenv because it allows us to make sure our application can run on different versions of Python.

Read full Article