usnistgov / fipy

FiPy is a Finite Volume PDE solver written in Python
http://pages.nist.gov/fipy/en/latest
Other
505 stars 148 forks source link

Test nix with the Issue1049-numpy_2.0.0_breaks_things branch #1052

Closed wd15 closed 3 months ago

guyer commented 3 months ago

@wd15: Having tried a bunch of diagnostics and getting nothing to show up in the nix tests, I think what's happening is that:

This would explain why we see changes in the doctests (because it's extracting those from the source code), but we don't see changes to the code (because it's running the code that's already installed).

My naive attempt to do something about that (2dd8321) results in

× This environment is externally managed
╰─> This command has been disabled as it tries to modify the immutable
    `/nix/store` filesystem.

    To use Python with Nix and nixpkgs, have a look at the online documentation:
    <https://nixos.org/manual/nixpkgs/stable/#python>.

I don't (want to) understand nix well enough to work around that.

wd15 commented 3 months ago

It is definitely using the updated version of fipy/tests/doctestPlus.py as it prints on at the top of the file and prints to the locally cloned version. Installing with pip install won't work as Nix doesn't allow this for obvious reasons. Although it's using the cloned version of fipy/tests/doctestPlus.py, it is never failing with the raise Exception in the testmod function. What is going on?

wd15 commented 3 months ago

Ok, although fipy/tests/doctestPlus.py is imported, the debugging version of fipy/tests/test.py is never imported. Why is that?

wd15 commented 3 months ago

Other than when fipy uses fipy.test(), fipy.tests.test is never imported in the fipy source. It's handed over to setup.py which knows what to do. It's from this file that we're not getting the debugging info that we should be printing and thus the change in the way numpy operates.

guyer commented 3 months ago

Let me do some experiments

wd15 commented 3 months ago

Oh! Building the egg info actually made it use the modified test module.

guyer commented 3 months ago

Oh! Building the egg info actually made it use the modified test module.

Yes. Turns out it isn't a nix thing, per se. Fresh checkout, without building egg_info, doesn't execute the relevant tweaks to printoptions. After building egg_info, for any reason, all is OK.

Still not right for this particular Action; it doesn't appear to be running the tests after it builds egg_info. I'll leave that to you.

wd15 commented 3 months ago

Oh! Building the egg info actually made it use the modified test module.

Yes. Turns out it isn't a nix thing, per se. Fresh checkout, without building egg_info, doesn't execute the relevant tweaks to printoptions. After building egg_info, for any reason, all is OK.

Still not right for this particular Action; it doesn't appear to be running the tests after it builds egg_info. I'll leave that to you.

Very good. Will get this cleaned up.

wd15 commented 3 months ago

Just one failure now, which also occurs locally as well. Some sort of reordering error with Scipy / Numpy interaction.