[Numpy-discussion] nose changes checked in

Anne Archibald peridot.faceted@gmail....
Wed Jun 18 10:42:57 CDT 2008

2008/6/17 Alan McIntyre <alan.mcintyre@gmail.com>:
> On Tue, Jun 17, 2008 at 8:15 PM, Anne Archibald
> <peridot.faceted@gmail.com> wrote:
>> Uh, I assumed NumpyTestCase was public and used it. I'm presumably not
>> alone, so perhaps a deprecation warning would be good. What
>> backward-compatible class should I use? unittest.TestCase?
> Yes, unittest.TestCase seemed to be completely adequate for all the
> existing tests in NumPy.  Unless you need some functionality
> explicitly implemented in NumpyTestCase (like the 'measure' or
> 'rundocs' methods), you can just replace it with TestCase.   TestCase
> can be imported from numpy.testing, although (now that I think about
> it) it's probably less cryptic to just import it from unittest.
> For module-level doctests, you can place something like this in the module:
> from numpy.testing import *
> def test():
>    return rundocs()
> You can replace ParametricTest with generators, as described here:
>     http://scipy.org/scipy/scipy/wiki/TestingGuidelines

Hmm. This won't work with the current version of numpy, will it? That
is, it needs nose. (I run much code on the work machines, which I
(thankfully) do not administer, and which are running a variety of
ancient versions of numpy (some even have only Numeric, to support
horrible quasi-in-house C extensions).) So I'd like to write my tests
in a way that they can run on both new and old versions of numpy.

> I will document all this more completely once the test setup isn't
> changing on a daily basis, honest.
> I'm assuming this experience should tell me that any item "bar" that I
> can get by issuing "from numpy.foo import bar" should be considered
> the public API and therefore deprecated instead of removed?  ;)

Well, probably. But more so for those that are used widely throughout
numpy itself, since many of us learn how to write code using numpy by
reading numpy source. (Yes, this means that "internal" conventions
like "numpy.core.whatever" get used by people who aren't writing


More information about the Numpy-discussion mailing list