[Numpy-discussion] Switching to nose test framework (was: NumpyTest problem)

Anne Archibald peridot.faceted@gmail....
Mon Jun 9 18:07:17 CDT 2008


2008/6/8 Alan McIntyre <alan.mcintyre@gmail.com>:
> On Sun, Jun 8, 2008 at 6:49 PM, Nathan Bell <wnbell@gmail.com> wrote:
>> On Sun, Jun 8, 2008 at 6:15 AM, Alan McIntyre <alan.mcintyre@gmail.com> wrote:
>>> Right now there's "if __name__ == '__main__'" boilerplate at the end
>>> of every test module; nose can find and run tests without that being
>>> there.  I wanted to get the list's take on removing that--it just
>>> means that if you want to run the tests in one module, you have to do
>>> "nosetests numpy/blah/test_foo.py" instead of "python
>>> numpy/blah/test_foo.py".  Is there a reason not to remove that
>>> boilerplate since we've already decided to use nose?
>>
>> When making frequent changes to test_foo.py, it's often nice to run
>> test_foo.py directly, rather than installing the whole package and
>> then testing via nose.
>>
>> I would leave the decision up to the maintainers of the individual
>> submodules.  Personally, I find it useful to have.
>
> You can run the test scripts from the source tree without installing
> them by using nosetests, like this:
>
> nosetests nump/numpy/ilb/tests/test_getlimits.py
> or
> nosetests nump/numpy/ilb/tests

I am not enthusiastic about this change: it makes it harder for J.
Random Hacker to run a fileful of tests. She has to know about the
magical nose invocation - where should she find it out? If she's
fiddling with the code she can hardly avoid finding the boilerplate,
but will she know to go digging through the wiki (assuming it appears
there) to find the magical invocation required to run a particular
test?

Then again, it doesn't usually work for me to use the boilerplate to
run a single test without installing, since the non-installed test
doesn't necessarily find all the non-installed code, sometimes falling
back on the installed code and giving false passes or mysterious
failures. Usually I give up and just reinstall the whole beast and
rerun all tests every time I make a change. How does nose behave in
this situation?

Anne


More information about the Numpy-discussion mailing list