-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Suppress nonsense DeprecationWarning
caused by unittest
#12676
Conversation
One or more of the following people are relevant to this code:
|
`unittest.TestCase.assertWarns` in context-manager form has an awkward habit of querying the `__warningregistry__` attribute on every module in existence. This interacts poorly with a Numpy 2 deprecation warning trigger for code that's attempting to import functions from modules that became private in Numpy 2, if a warning has previously been triggered out of `numpy.linalg._linalg`. This simply suppresses that particular warning from the test suite.
541dae4
to
3447642
Compare
66d1421
to
e1b4adc
Compare
Pull Request Test Coverage Report for Build 9705924154Details
💛 - Coveralls |
@@ -7,6 +7,10 @@ scipy<1.11; python_version<'3.12' | |||
# See https://github.com/Qiskit/qiskit/issues/12655 for current details. | |||
scipy==1.13.1; python_version=='3.12' | |||
|
|||
# Rustworkx 0.15.0 contains a bug that breaks graphviz-related tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this then unrelated to the NumPy deprecation warning? Edit: Nvm just saw the offline discussion 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's just that Rustworkx 0.14 wasn't compatible with Numpy 2 and Rustworkx 0.15 is, so the release caused us to start pulling in Numpy 2 in CI. We didn't see the failures before because not only do you need Numpy 2, you also need to have the test suite generate a warning out of np.linalg._linalg
, which we don't do on most platforms, but there are some about numerical-precision things on macOS ARM specifically, and we weren't running the Numpy 2 tests on macOS ARM previously because it wasn't available to us at the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider creating tracking issues so that we don't forget to follow up on these things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a tracking issue and added it to the comment! Let me know if it works.
Pull Request Test Coverage Report for Build 9710892224Details
💛 - Coveralls |
Co-authored-by: Elena Peña Tapia <[email protected]>
Pull Request Test Coverage Report for Build 9712800437Details
💛 - Coveralls |
* Suppress nonsense `DeprecationWarning` caused by `unittest` `unittest.TestCase.assertWarns` in context-manager form has an awkward habit of querying the `__warningregistry__` attribute on every module in existence. This interacts poorly with a Numpy 2 deprecation warning trigger for code that's attempting to import functions from modules that became private in Numpy 2, if a warning has previously been triggered out of `numpy.linalg._linalg`. This simply suppresses that particular warning from the test suite. * Refine filter * Pin Rustworkx to avoid buggy graphviz drawing * Update test/utils/base.py Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Elena Peña Tapia <[email protected]> (cherry picked from commit 3adcd5d)
…12687) * Suppress nonsense `DeprecationWarning` caused by `unittest` `unittest.TestCase.assertWarns` in context-manager form has an awkward habit of querying the `__warningregistry__` attribute on every module in existence. This interacts poorly with a Numpy 2 deprecation warning trigger for code that's attempting to import functions from modules that became private in Numpy 2, if a warning has previously been triggered out of `numpy.linalg._linalg`. This simply suppresses that particular warning from the test suite. * Refine filter * Pin Rustworkx to avoid buggy graphviz drawing * Update test/utils/base.py Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Elena Peña Tapia <[email protected]> (cherry picked from commit 3adcd5d) Co-authored-by: Jake Lishman <[email protected]>
…2676) * Suppress nonsense `DeprecationWarning` caused by `unittest` `unittest.TestCase.assertWarns` in context-manager form has an awkward habit of querying the `__warningregistry__` attribute on every module in existence. This interacts poorly with a Numpy 2 deprecation warning trigger for code that's attempting to import functions from modules that became private in Numpy 2, if a warning has previously been triggered out of `numpy.linalg._linalg`. This simply suppresses that particular warning from the test suite. * Refine filter * Pin Rustworkx to avoid buggy graphviz drawing * Update test/utils/base.py Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Elena Peña Tapia <[email protected]>
Summary
unittest.TestCase.assertWarns
in context-manager form has an awkward habit of querying the__warningregistry__
attribute on every module in existence. This interacts poorly with a Numpy 2 deprecation warning trigger for code that's attempting to import functions from modules that became private in Numpy 2, if a warning has previously been triggered out ofnumpy.linalg._linalg
.This simply suppresses that particular warning from the test suite.
Details and comments