
Some test files have a set_local_path()/restore_path() pair at the top, and some don't. Is there any reason to be changing sys.path like this in the test modules? If not, I'll take them out when I see them. Thanks, Alan

Alan McIntyre wrote:
Some test files have a set_local_path()/restore_path() pair at the top, and some don't. Is there any reason to be changing sys.path like this in the test modules? If not, I'll take them out when I see them.
The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package. set_local_path()/restore_path() are convenient when debugging or developing a subpackage. If you are sure that there are no bugs in numpy subpackges that need such debugging process, then the set_local_path() restore_path() calls can be removed. (But please do not remove them from scipy tests files, rebuilding scipy just takes too much time and debugging subpackages globally would be too painful). Pearu

On Wed, Jul 2, 2008 at 9:35 AM, Pearu Peterson <pearu@cens.ioc.ee> wrote:
Alan McIntyre wrote:
Some test files have a set_local_path()/restore_path() pair at the top, and some don't. Is there any reason to be changing sys.path like this in the test modules? If not, I'll take them out when I see them.
The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package.
Ah, thanks; I'd forgotten about that. I'll leave them alone, then. I made a note for myself to make sure it's possible to run tests locally without doing a full build/install (where practical).

Hi,
The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package.
Ah, thanks; I'd forgotten about that. I'll leave them alone, then. I made a note for myself to make sure it's possible to run tests locally without doing a full build/install (where practical).
I noticed that people were often putting this at the top of scipy test files as boilerplate when they didn't in fact need the local directory on the path. I did it myself when I first started using the Numpy test rig. So, to avoid that happening, it would be good to remove all the cases where it is not necessary... Best, Matthew

On Wed, Jul 2, 2008 at 09:01, Alan McIntyre <alan.mcintyre@gmail.com> wrote:
On Wed, Jul 2, 2008 at 9:35 AM, Pearu Peterson <pearu@cens.ioc.ee> wrote:
Alan McIntyre wrote:
Some test files have a set_local_path()/restore_path() pair at the top, and some don't. Is there any reason to be changing sys.path like this in the test modules? If not, I'll take them out when I see them.
The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package.
Ah, thanks; I'd forgotten about that. I'll leave them alone, then. I made a note for myself to make sure it's possible to run tests locally without doing a full build/install (where practical).
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

On Wed, July 2, 2008 8:25 pm, Robert Kern wrote:
On Wed, Jul 2, 2008 at 09:01, Alan McIntyre <alan.mcintyre@gmail.com> wrote:
On Wed, Jul 2, 2008 at 9:35 AM, Pearu Peterson <pearu@cens.ioc.ee> wrote:
Alan McIntyre wrote:
Some test files have a set_local_path()/restore_path() pair at the top, and some don't. Is there any reason to be changing sys.path like this in the test modules? If not, I'll take them out when I see them.
The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package.
Ah, thanks; I'd forgotten about that. I'll leave them alone, then. I made a note for myself to make sure it's possible to run tests locally without doing a full build/install (where practical).
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path.
Note that the point of set_local_path is not to test uninstalled code but to test only a subpackage. For example, cd svn/scipy/scipy/fftpack python setup.py build python tests/test_basic.py would run the tests using the extensions from the build directory. Well, at least it used to do that in past but it seems that the feature has been removed from scipy svn:( Scipy subpackages used to be usable as standalone packages (even not requiring scipy itself) but this seems to be changed. This is not good from from the refactoring point of view. Pearu

On Wed, Jul 2, 2008 at 13:58, Pearu Peterson <pearu@cens.ioc.ee> wrote:
On Wed, July 2, 2008 8:25 pm, Robert Kern wrote:
On Wed, Jul 2, 2008 at 09:01, Alan McIntyre <alan.mcintyre@gmail.com> wrote:
On Wed, Jul 2, 2008 at 9:35 AM, Pearu Peterson <pearu@cens.ioc.ee> wrote:
Alan McIntyre wrote:
Some test files have a set_local_path()/restore_path() pair at the top, and some don't. Is there any reason to be changing sys.path like this in the test modules? If not, I'll take them out when I see them.
The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package.
Ah, thanks; I'd forgotten about that. I'll leave them alone, then. I made a note for myself to make sure it's possible to run tests locally without doing a full build/install (where practical).
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path.
Note that the point of set_local_path is not to test uninstalled code but to test only a subpackage.
And nose does that just fine by itself. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

On Wed, Jul 2, 2008 at 12:25 PM, Robert Kern <robert.kern@gmail.com> wrote:
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path.
+1 -- Jarrod Millman Computational Infrastructure for Research Labs 10 Giannini Hall, UC Berkeley phone: 510.643.4014 http://cirl.berkeley.edu/

On Wed, Jul 2, 2008 at 1:25 PM, Robert Kern <robert.kern@gmail.com> wrote:
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path.
Ok. Since set_package_path is also just used for adjusting sys.path, should that go away as well? If so, I'll remove set_package_path, set_local_path, and restore_path from numpy/testing/numpytest.py, and of course remove all their uses.

On Wed, Jul 2, 2008 at 14:34, Alan McIntyre <alan.mcintyre@gmail.com> wrote:
On Wed, Jul 2, 2008 at 1:25 PM, Robert Kern <robert.kern@gmail.com> wrote:
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path.
Ok. Since set_package_path is also just used for adjusting sys.path, should that go away as well? If so, I'll remove set_package_path, set_local_path, and restore_path from numpy/testing/numpytest.py, and of course remove all their uses.
Please deprecate the functions for 1.2 and schedule them for removal in 1.3. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

2008/7/2 Robert Kern <robert.kern@gmail.com>:
On Wed, Jul 2, 2008 at 14:34, Alan McIntyre <alan.mcintyre@gmail.com> wrote:
On Wed, Jul 2, 2008 at 1:25 PM, Robert Kern <robert.kern@gmail.com> wrote:
Please remove them and adjust the imports. As I've mentioned before, numpy and scipy can now reliably be built in-place with "python setup.py build_src --inplace build_ext --inplace". This is a more robust method to test uninstalled code than adjusting sys.path.
Ok. Since set_package_path is also just used for adjusting sys.path, should that go away as well? If so, I'll remove set_package_path, set_local_path, and restore_path from numpy/testing/numpytest.py, and of course remove all their uses.
Please deprecate the functions for 1.2 and schedule them for removal in 1.3.
I'm really glad these are disappearing -- they were never working properly for arbitrarily deeply nested modules. Regards Stéfan
participants (6)
-
Alan McIntyre
-
Jarrod Millman
-
Matthew Brett
-
Pearu Peterson
-
Robert Kern
-
Stéfan van der Walt