PyTexas 2013

Unit Testing Django Apps with Mock

Jeremy Boyd

This 30-minute talk will demonstrate unit test-based techniques for testing Django applications, with an aim toward running our tests quickly and often and testing smaller pieces of code. The primary tool to be shown will be Michael Foord's mock library.

I won't be providing an in-depth mock tutorial, but I'll cover the basics if you've never seen it in action. Along the way, I'll show several common testing scenarios and talk about pitfalls to avoid when writing your app. Other tools such as mock-django will be discussed.

The talk is ideal for developers who want to try alternative methods for testing their Django apps - whether it's because they've heard of unit testing and want to try it out or because Django's built-in tools are getting too slow for their needs. As a result, it's an intermediate talk, but I'll strive to make it accessible to beginners. Developers who are already familiar with mock but want to see how to use it with Django apps may also find this talk interesting.

Status: Accepted