[Numpy-discussion] Monkeypatching vs nose plugin?

Fernando Perez fperez.net@gmail....
Wed Jul 16 23:14:33 CDT 2008

On Wed, Jul 16, 2008 at 8:21 PM, Alan McIntyre <alan.mcintyre@gmail.com> wrote:

> The monkeypatching approach was the first one that I could make to
> work with the least amount of hassle, but it's definitely not the best
> way.  I only had to monkeypatch a couple of things at first, but as I
> figured out what the test framework needed to do, it just got worse,
> so I was beginning to get uncomfortable with it myself. (Honest! :)
> Once the NumPy and SciPy test suites are mostly fixed up to work under
> the current rules, I'll go back and use a method that doesn't require
> monkeypatching.  It shouldn't have any effect on the public interface
> or the tests themselves.

Great.  As I mentioned, the code I sent a few days ago already has a
non-monkeypatching plugin you can use as a starting point.

> Since we're discussing this sort of thing, there's something I've been
> meaning to ask anyway: do we really need to allow end users to pass in
> arbitrary extra arguments to nose (via the extra_argv in test())?
> This seems to lock us in to having a mostly unobstructed path from
> test() through to an uncustomized nose backend.

As RK said, it's often handy to be able to run the tests from the
plain command line to tweak nose's behavior.  What I plan for ipython
is to have a little script (installed to $PREFIX/bin) that loads all
the necessary machinery but otherwise works like 'nosetests
--necessary-options'.  This will let us run the ipython tests from the
command line (and adding  additional nose flags as required) but
without users needing to install the plugin.  I think it's perfectly
doable, I just haven't finished it.

If you don't like for numpy the script option, then users would need
to have the plugin installed when working at the command  line (though
a python numpy.test() call wouldn't need that, since it can do the
plugin loading itself).



More information about the Numpy-discussion mailing list