[Numpy-discussion] set_local_path in test files

Pearu Peterson pearu at cens.ioc.ee
Wed Jul 2 14:58:28 EDT 2008


On Wed, July 2, 2008 8:25 pm, Robert Kern wrote:
> On Wed, Jul 2, 2008 at 09:01, Alan McIntyre <alan.mcintyre at gmail.com>
> wrote:
>> On Wed, Jul 2, 2008 at 9:35 AM, Pearu Peterson <pearu at 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




More information about the NumPy-Discussion mailing list