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

Neilen Marais nmarais at sun.ac.za
Wed Jun 28 09:09:12 CDT 2006


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.

TestGears looks interesting since it can generate a unittest compatible
test-suite using its own collector. Ideally you could then feed this testsuite
to a GUI runner or something similar. I've only tried it quickly, but couldn't
get it to work.


you know its kind of tragic 
we live in the new world
but we've lost the magic
-- Battery 9 (www.battery9.co.za)

More information about the SciPy-user mailing list