Skip to content

TST: a coordinates test in need to adapt for numpy 2.5 #19133

Open

Description

@neutrinoceros

See parent issue #19126 for context

coordinates.tests.test_representation_method.TestSetShape's entire design revolves around the ability to mutate shape attributes in place, and some assertions can only be satisfied if reshaping one array implicitly modifies other arrays in place, which I don't think we can replicate using only non-deprecated numpy APIs, so there's a need for a discussion here.
I would personally argue that the test case should be modified to reflect a thread-safe usage of numpy arrays (thread safety is the motivation behind the deprecation we're facing), which means eventually dropping support for the exact case that is currently being tested, as it doesn't seem viable to support this in the future if numpy doesn't (and FTR I think their decision is reasonable).

Activity

  1. neutrinoceros commented on Jan 8, 2026

    @neutrinoceros
    ContributorAuthor

    ping @mhvk as the original author of this test

  2. mhvk commented on Jan 8, 2026

    @mhvk
    Contributor

    Agreed that numpy's decision is reasonable and that we should just deprecate along with them. Shape setting was/is tricky to get right and it would in fact be nice to get rid of it altogether. Easiest would seem to just let the numpy warnings appear, and adjust the tests to expect them. I.e., I think setting shapes is likely done so infrequently that we do not need to add our own deprecation warnings; yet,given the likely rare use, I don't think we need to move ahead of numpy and remove setting shape earlier (unless elsewhere it becomes a real problem to support it).

  3. changed the title [-]TST: a coordinates test in need to adapt for numpy 1.25[/-] [+]TST: a coordinates test in need to adapt for numpy 2.25[/+] on Jan 19, 2026
  4. changed the title [-]TST: a coordinates test in need to adapt for numpy 2.25[/-] [+]TST: a coordinates test in need to adapt for numpy 2.5[/+] on Jan 19, 2026
  5. pllim commented on Aug 10, 2026

    @pllim
    Member

    Is this still an issue?

  6. neutrinoceros commented on Aug 11, 2026

    @neutrinoceros
    ContributorAuthor

    Evidently this isn't posing an immediate issue with CI, but I think the underlying issue might still exist, in that we are still testing, hence, explicitly supporting a use case that is bound to be thread unsafe, so a decision is needed on whether we want to keep supporting it but explicitly document it as unsafe, or fade out support for it at some point.

  7. mhvk commented on Aug 11, 2026

    @mhvk
    Contributor

    I'm in favour of deprecating setting shapes - it is a lot of risky, entangled code for a not very useful purpose. As I wrote above, I think it is easiest to just let numpy warnings percolate up, adjusting the test to expect these, and then let things fail if they fail with numpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions