[SciPy-user] numpy.testing and other test runners

David M. Cooke cookedm at physics.mcmaster.ca
Wed Jun 28 13:36:53 CDT 2006


On Wed, 28 Jun 2006 16:09:12 +0200
Neilen Marais <nmarais at sun.ac.za> wrote:

> Hi
> 
> I've been playing around with using other test runners together with my
> numpy.testing based tests. I've tried nosetest and TestGears so far. Has
> anyone else tried any others, and what have your experiences been?
> 
> Nosetest is kinda nice since it allows you to run pdb on tests that error
> out, and allows you to specify tests by name from the commandline. I've
> been using nosetest on another project that uses only normal unittest
> derrived tests for a while. On NumpyTestCase derived tests it would not run
> at first, but I got it working by hacking a little on
> numpy/testing/numpytest.py:
> 
> --- numpy/testing/numpytest.py.orig     2006-06-16 22:40:11.000000000 +0200
> +++ numpy/testing/numpytest.py 2006-06-28 14:18:45.000000000 +0200
> @@ -139,7 +139,7 @@
>          result.stream = _dummy_stream(save_stream)
>          unittest.TestCase.__call__(self, result)
>          if nof_errors != len(result.errors):
> -            test, errstr = result.errors[-1]
> +           test, errstr = result.errors[-1][0:2]
>              if isinstance(errstr, tuple):
>                  errstr = str(errstr[0])
>              elif isinstance(errstr, str):
> 
> I don't know the unittest API well enough to know if this is a bug in
> numpytest or in nose, but it seems to work OK.

I applied the patch as it won't impact numpy (it just loosens the requirement
that len(result.errors) == 2 to >= 2).

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca



More information about the SciPy-user mailing list