PyConTomBryan¶
Legacy Wiki Page
This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.
Introduction¶
This page concerns the talk on “Unit Testing in Python” that I gave on March 26 at the PyCon 2003. If you missed the talk, you can view the slides on my Starship Python page. You may also download the slides from my Starship ftp directory. The slides and code are both available as .tgz and .zip files.
I’d appreciate any feedback on the slides or the talk itself. Feel free to hit the Edit Text link and add your comments or questions to the section at the end. For more about me, see my Python wiki page TomBryan.
Vote for the talk you want to see!¶
This paper was prepared with the ability to support two talks. While all of the content is available in the conference proceedings, I only presented part of the content during my scheduled time slot.
Unit Testing in Python¶
This talk is based on one I gave for the the Triangle Python/Zope User Group in November 2002. I extended the content for the PyCon. The original talk covered the following topics:
Definition of unit testing
Why should you unit test?
What does Python provide for unit testing?
Simple example of using doctest
unittest terminology and history
Simple example with unittest
Test-driven development with unittest
Overview of more advanced unit testing issues
What to expect when you start unit testing
I cleaned up the existing content and added more. I covered some of the more advanced topics, such as
Refactoring test fixtures beyond the setUp and tearDown methods
Writing testable code
Using mock objects
How to organize and run your tests
More advanced options in unittest
Feedback from visitors to this page¶
Feel free to add feedback on the talk (how to improve the slides, other resources, etc.) to this section. –Tom