Skip to content

BUG: Fix repeatability issues in test suite #29380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

bmwoodruff
Copy link
Member

Resolves test failures caused by persistent global state when running numpy.test() twice in the same Python session.

  • core/tests: Skip TestAddNewdocUfunc on repeated runs. This avoids C-level mutation errors.
  • f2py/tests: Reset f77modulename at end of callcrackfortran. This change alters the code base.
  • lib/tests: Wrap StringIO parameters in lambdas.
  • f2py/tests/test_docs: Reset ftype.data.a at end of test_ftype.

These changes ensure that the full test suite can be run multiple times in the same interpreter without failure. Closes #26718.

The change to f2py/tests cause a change in the behavior of callcrackfortran. I'd like feedback. I believe the change here solves the root problem of the failing tests. An alternative is to just patch over the issue in the test suite alone using setup_module() + reset_global_f2py_vars().

A more detailed description of each change is located at #26718 (comment).

@ngoldbaum , this should finish up the issue from the sprints at SciPy.

Resolves test failures caused by persistent global state
when running numpy.test() twice in the same Python session.

- core/tests: Skip TestAddNewdocUfunc on repeated runs.
              This avoids C-level mutation errors.
- f2py/tests: Reset f77modulename at end of callcrackfortran.
              This change alters the code base.
- lib/tests: Wrap StringIO parameters in lambdas.
- f2py/tests/test_docs: Reset ftype.data.a at end of test_ftype.

These changes ensure that the full test suite can be run multiple
times in the same interpreter without failure. Closes numpy#26718.
Copy link
Member

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems harmless enough, let's bring it in. Thanks @bmwoodruff!

@ngoldbaum ngoldbaum merged commit d323705 into numpy:main Jul 15, 2025
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: test fail when run a second time
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy