Interaction between Numpy and the nose framework (was : packaging scipy)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Interaction between Numpy and the nose framework (was : packaging scipy)

Matthieu Brucher-2
BTW, I stumbled on something strange with the nose framework. If you from numpy.testing import * in a test file, the nose framework will try to test the testing module by calling every test* method.

I just mention it there because I think I'm not the only one to do this for set_package_path, assert_equal, ...

Matthieu

2008/4/7, Gael Varoquaux <[hidden email]>:
On Mon, Apr 07, 2008 at 05:20:47PM +0200, Stéfan van der Walt wrote:
> I agree, and I think we can come to some compromise -- maybe a
> numpy.all namespace, that simply imports all the other subpackages.


For the beginner, "from numpy.all import *" is more confusing than "from
numpy import *" (which is already confusing).

I know namespace are good things, but the beginner struggles with them.
This is why I used the "import *" in my above examples.

My 2 cents,

Gaël

_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion



--
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Interaction between Numpy and the nose framework (was : packaging scipy)

Stéfan van der Walt
On 07/04/2008, Matthieu Brucher <[hidden email]> wrote:
> BTW, I stumbled on something strange with the nose framework. If you from
> numpy.testing import * in a test file, the nose framework will try to test
> the testing module by calling every test* method.
>
> I just mention it there because I think I'm not the only one to do this for
> set_package_path, assert_equal, ...

I've noticed that behaviour, too.  Note, however, that you do not need
to use set_package_path and friends with nose; you can instead do a
fully qualified import:

from numpy.submod.mod import foo

Regards
Stéfan
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Interaction between Numpy and the nose framework (was : packaging scipy)

Matthew Brett
Hi,

On Mon, Apr 7, 2008 at 4:25 PM, Stéfan van der Walt <[hidden email]> wrote:

> On 07/04/2008, Matthieu Brucher <[hidden email]> wrote:
>  > BTW, I stumbled on something strange with the nose framework. If you from
>  > numpy.testing import * in a test file, the nose framework will try to test
>  > the testing module by calling every test* method.
>  >
>  > I just mention it there because I think I'm not the only one to do this for
>  > set_package_path, assert_equal, ...
>
>  I've noticed that behaviour, too.  Note, however, that you do not need
>  to use set_package_path and friends with nose; you can instead do a
>  fully qualified import:
>
>  from numpy.submod.mod import foo

Actually, it was intentional to make the scipy.testing * space a more
limited version of the numpy testing space - in particular,
set_package_path was often being used unnecessarily (by me among
others) and was clearly leading to confusion.  You do however have
assert_equal and friends with from scipy.testing  import *, so I'd
strongly recommend you use that in preference to the numpy.testing
import within scipy.

Best,

Matthew
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion