python unittest question
Lloyd Kvam
python at venix.com
Wed Apr 29 13:35:47 EDT 2009
On Wed, 2009-04-29 at 13:11 -0400, Paul Lussier wrote:
> Lloyd Kvam <lkvam at venix.com> writes:
>
> > On Tue, 2009-04-28 at 19:46 -0400, Paul Lussier wrote:
> >> Is anyone here familiar with unit testing in python using the unittest
> >> module? If so, I'm rather stumped on something.
> >>
> > The nosetests module (package probably named python-nose) will do what
> > you want though it supports a different naming convention for your test
> > modules.
> >
> > Essentially it looks for test*.py modules and runs them. It provides
> > consistent ordering and reasonably smart reporting. You can use command
> > line options to control essential aspects of your test runs.
> >
> > Highly recommended.
>
> Fascinating. How does nosetest differ from unittest ?
It's a test "runner". It supports unittest as well as more relaxed
methods for writing your test scripts. From the README:
nose: a discovery-based unittest extension.
nose provides extended test discovery and running features for
unittest.
Basic usage
-----------
nosetests [options] [(optional) test files or directories]
> Is it a
> built-in python module?
No
> Or do I have to download it from somewhere?
yum install python-nose (or apt-get)
> Pointers?
http://code.google.com/p/python-nose
If you are not using a package manager on your system easy_install is
likely the easiest way to install third party Python modules. It works
quite simply so long as you:
do not need an automatic uninstall capability
do not need multiple versions of the same module
http://peak.telecommunity.com/EasyInstall.html
Once you have EasyInstall in place:
easy_install nose
I use easy_install pretty sparingly since I lose the benefit of a
package manager documenting the system setup.
--
Lloyd Kvam
Venix Corp
DLSLUG/GNHLUG library
http://dlslug.org/library.html
http://www.librarything.com/catalog/dlslug
http://www.librarything.com/rsshtml/recent/dlslug
http://www.librarything.com/rss/recent/dlslug
More information about the gnhlug-discuss
mailing list