the standard unit testing framework for Python (original) (raw)
Author: Steve Purcell, Pythangelist,Available for Python & Ruby On Rails consulting/training
Latest release: 1.4.1, 10th August 2001 (download) (notes)
Documentation: [English] [Japanese] [Chinese] [Serbo-Croatian] [Hungarian (courtesy of Zsolt Boros)]
This unit testing framework, dubbed 'PyUnit' by convention, is a Python language version of JUnit. JUnit was written by smart cookies Kent Beck and Erich Gamma, and is, in turn, a Java version of Kent's Smalltalk testing framework. Each is the de facto standard unit testing framework for its respective language, and therefore both are a strong basis for an effective and elegant Python framework.
News
10th June 2013 -- Serbo-Croatian translation of the PyUnit documentation by Anja Skrba from Webhostinggeeks.com
4th December 2007 -- Chinese translation of the PyUnit documentation submitted by Bing Yuan
22nd June 2004 -- Double-clickable application bundle for OS-X by Kevin Walzer
19th July 2002 -- Cocoa test GUI for Mac OS X users from Dinu Gherman
10th December 2001 -- Japanese translation of the PyUnit documentation submitted by Suzuki Hisao
6th August 2001 -- the much-delayed stand-alone release of the PyUnit version bundled with Python 2.1
June 2001 -- Mark Pilgrim has written an amazing chapter about unit testing using PyUnitas part of his online Python book "Dive Into Python".
28th March 2001 -- PyUnit featured in Stephen Figgins' article 'Extreme Python' on the O'Reilly Network
23rd March 2001 -- PyUnit is included in the Python Standard Library as of today's Python 2.1 release. More information about this can be found in this postingto the pyunit-interest mailing list.
Testimonials
"PyUnit is cool. It's helping us find lots of bugs." --Jim Fulton, Digital Creations
"I am really impressed with the effect of unit testing on the quality of my code since I started using PyUnit about two months ago. I know that the extra effort has saved me literally days of looking for subtle bugs. Writing the unit tests first is also a very good innoculation against over-engineering." -- Terrel Shumway
What is it?
Some quick facts about PyUnit:-
- Lets you write tests easily, aggregate them torun en-masse, and run them in text or GUI mode
- PyUnit is based on Java'sJUnit, and therefore uses a proven testing architecture
- PyUnit is part of the Python 2.1 standard library
- In production use on many sites since the first release in late 1999
- There have been over 5000 downloads
- PyUnit is used to testZope, probably the largest and best-known piece of Python software
Where can I get it?
Update: Unless you're stuck in the year 2000, PyUnit is in your Python standard library as module unittest
.
The framework is currently two Python source modules (i.e. no messy installation) and is packaged for download together with documentation and examples. The documentation provides a cookbook for writing tests, usage guidelines, known issues, future plans, and links to sources of related information.
- Screenshots of the GUI on Linux andWindows 98
- Download latest version (1.4.1): (tar/gz,zip, release notes)
- Download older releases
- Debian package 'python-unit' (thanks to Jérôme Marant)
- Public mailing list (archived here)
- Note on reloading modules each time a test is run
- Anonymous CVS access (also browsable online)
- Bug database
- PyUnit project page at Sourceforge.net
- Module API docs forunittest andunittestgui (generated usinghtmldoc)
Feedback and discussion via themailing listis encouraged. This low-volume list is a good place to discuss PyUnit, to ask others about their practises, and to share your wisdom.
Important note for Windows users
Please note that the PythonWin IDE and Tkinter do not co-exist happily. This means the PyUnit GUI should not be run from within PythonWin, otherwise a crash is possible. Instead, run it separately using the standardpython.exe
or pythonw.exe
, or by double-clicking on unittestgui.py
in Explorer.
(Of course, using the text mode of PyUnit from PythonWin will work just fine.)
Projects using PyUnit
Some known projects and groups reportedly using PyUnit are:
- Zope Corporation (PyUnit is used to test Zope)
- ReportLab
- WebWare
- Whirlwind by Aculab is a portable Computer Telephony (CT) server for UNIX and NT
- Logilab use PyUnit; see Narval, their personal network assistant
- QuantLib C++ library for quantitative finance
- Solar X-Ray Imager project at the NOAA
- ESSS (Engineering Simulation and Scientific Software) in Brazil
- StressMyDotCom web site testing tool from Downright Software LLC
- ADODBAPI Python DB API for Microsoft ADO
- Cheetah template engine
- BSDDB python extension
- PAmie is a Web automation tool for Internet Explorer
- rdiff-backup project by Ben Escoto
- pyPgSQL Python interface to PostgreSQL
- zxJDBC Python DB API for Jython
- ZWiki Wiki product for Zope (uses PyUnit via Zope's ZUnit)
- Twisted Python distribution
- Python weak reference extension
- HappyDoc Python API documentation generator
- MonkeyFist
- Roundup issue tracker
- YakTrack issue-tracking system
- MoinMoin WikiWiki clone
- BicycleRepairMan project
- Ransacker project
- Zike project
- Weblib project
Related software and extensions
- TestOOB by Ori Peleg provides extensions for conveniently running test suites
- GUI test runner using wxPython
The gossip
Recent mentions of PyUnit:
- Article on O'Reilly Network
- Article in Korea's Micro Software Magazine by Changjune Kim
- Note in Linux Weekly News
- Discussions of Zope/PyUnit co-operation; search for 'pyunit' onZope.org
- Short article at MonkeyFist by Bijan Parsia, who also wrote a PyUnit some time ago
Contacting me
Feel free to send me e-mail usingthis formor directly to: steve at pythonconsulting dot com.
Also check outAirspeed, a small and fast Velocity-compatible template engine.
Last modified: 2013-06-10
Visits since 2nd July 2000: