[Numpy-discussion] Doctests for extensions/cython code
Sun Jul 13 09:28:08 CDT 2008
On Sun, Jul 13, 2008 at 2:32 AM, Fernando Perez <firstname.lastname@example.org> wrote:
> For numpy, we obviously must first remove all the ipython-specific
> code from there. The two plugins are separated, so it's perfectly
> doable, I just ran out of time. I'm putting it here in the hopes that
> it will be useful to Alan, who can strip it of the ipython
> dependencies and start using it in the numpy tests.
Thanks! I'll see if I can work this in soon.
> The one thing I didn't figure out yet was how to load the plugin from
> within a python script (instead of doing it at the command line via
> 'nosetests --extdoctests'). But this should be trivial, it's just a
> matter of finding the right call in nose, and you may already know
If you're constructing a TestProgram, you can pass in a list of plugin
instances. If I recall correctly, you have to pass in every plugin
that you might want to use, even if they're builtin (I suppose the
given list replaces the internal plugin list somewhere, I haven't
traced it). So if you leave the doctest plugin out of this list, for
example, the "--with-doctest" will cause an error. (This is all from
memory, though, so take it with a grain of salt)
> I don't know if today's numpy.test() picks up doctests in extension
> modules (if it does, I'd like to know how). I suspect the answer is
> not, but if we are to encourage better examples that serve as
> doctests, then actdually testing them would be good.
I'd be surprised if it did; I'll have a look.
> I hope this helps in that regard.
Certainly, thanks for doing it!
More information about the Numpy-discussion