Django 1.1 Testing and Debugging Book Review
I just finished reading the copy of Django 1.1 Testing and Debugging by Karen M. Tracey provided to us for review by Packt Publishing. For those of you who don’t know, Karen is a core developer of Django and her knowledge and experience in the framework shines through in this book.
This is a great book for people who want to transition from being a hobbyist tinkering on Django sites to professional developers. It will be a lot to digest for a newcomer to Django and might not contain much new information if you’ve been working with Django for a while (and writing tests for your code). The book covers:
- doctests vs. unit tests
- integrating external tools like Nose, Coverage, and Twill
- debugging with logging, Django Debug Toolbar, and pdb
- how to get help from the Django community and file bugs
- troubleshooting Apache/mod_wsgi deployments
Even though I’ve been working with Django for a few years now, I still picked up some great tips and got a few nice refreshers after reading the book. In Chapter 5, Karen describes how to use Twill instead of the built-in test client. As somebody who has written tests for multi-page form wizards with an automatically generated hash, I wish I had thought of this technique at the time. By using Twill, you can ignore auto-filled form fields and just test the functionality you care about.
Another great thing about this book are the non-trivial code samples included. I love reading other people’s code. You can learn a lot by seeing how other people solve problems and their general coding style. One item that struck me was the use of reverse(admin:[url_name]) in some of the examples. I had missed the addition of URL namespaces in Django 1.1 and will definitely be integrating them into my code in the future.
If you don’t have much experience with testing or real debugging (not sprinkling print statements) and are looking to make the leap to professional development with Django, I strongly recommend grabbing a copy of this book. You’ll learn a lot and it will make a great reference manual for your bookshelf.
Comments
Got something to say?
Our Products
Categories
- accessiblity
- code
- company news
- django
- gondola
- open source
- portfolio
- presentation
- pro tip
- review
- screencast
- seo
- software
- subversion
- trailmapping
- wordpress
Archives
- July, 2010
- June, 2010
- May, 2010
- April, 2010
- February, 2010
- December, 2009
- November, 2009
- October, 2009
Elsewhere
What we’ve been up to online
-
I'll be trying to make dinner reservations for folks at #djangocon tonight. Restaurant recommendations in Portland?
Pete, 7 hours, 29 minutes ago -
forked divio/django-cms
Pete, 6 days, 9 hours ago -
Congrats on the new hires @eldarion_team ! Glad to see more growth in Django commercial services.
Pete, 1 week, 4 days ago -
Video: The amazing John Cleese shares his wisdom…
Pete, 1 week, 4 days ago -
Video: The amazing John Cleese shares his wisdom…
Pete, 1 week, 4 days ago -
@caktusgroup Congrats on the new hire! Great to see the growth of other Django development companies.
Pete, 3 weeks, 4 days ago -
Just launched a Flask/App Engine mini-site we've been tinkering on http://emailed-me.appspot.com/
Pete, 1 month, 1 week ago -
created repository Emailed-Me-
Pete, 1 month, 1 week ago -
Our first iPhone development project hit the App Store last week and is already over 1k users! Check them out @takemyspot #iphone #geodjango
Pete, 2 months ago -
Love the new sites! RT @welikesmall: We just launched two new sites. http://post.ly/mGoq
Pete, 2 months ago -
Pro tip: Using pip safely for automated deployment (no more pesky prompts) http://bit.ly/b5zsPa
Pete, 2 months, 1 week ago -
commented on justquick/django-mailfriend
Pete, 2 months, 1 week ago -
RT @unbracketed: Excited to have @mitsuhiko joining us for some work this summer :)
Pete, 2 months, 2 weeks ago -
New blog post: managing supervisord with upstart http://bit.ly/db3p5N
Pete, 2 months, 2 weeks ago -
Troubleshooting OpenID is just like user/password. Except you have 5 of them and and you don't know which one is failing, and 3 login pages
Pete, 2 months, 2 weeks ago


Never used twill before. I guess it could be quite handy in the automated testing process. As well as the URL technique.