Skip to content
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

Added warning filter to ignore warning #2211

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

bdg221
Copy link
Collaborator

@bdg221 bdg221 commented Feb 27, 2024

Fixes #2103

Description

When running test_closest_positive_distribution_error() from test_inverse_confusion_matrix.py the following warning is given:

mitiq/rem/tests/test_inverse_confusion_matrix.py::test_closest_positive_distribution_error
  /home/runner/work/mitiq/mitiq/mitiq/rem/inverse_confusion_matrix.py:145: RuntimeWarning: invalid value encountered in divide
    init_guess /= np.sum(init_guess)

Since this is expected to raise an error with an invalid input, the warning is not necessary and should be disabled.

Steps to Duplicate

To duplicate this behavior locally, run make test then search the output for the warning.

License

  • I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Fund the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.

@bdg221 bdg221 requested a review from natestemen February 27, 2024 18:31
@bdg221 bdg221 self-assigned this Feb 27, 2024
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.28%. Comparing base (c5afbd4) to head (34dbd88).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2211      +/-   ##
==========================================
- Coverage   98.31%   98.28%   -0.03%     
==========================================
  Files          90       90              
  Lines        4262     4262              
==========================================
- Hits         4190     4189       -1     
- Misses         72       73       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Awesome, thanks Brian! Are there any other tests that raise this warning that we should consider adding this filter to?

@bdg221
Copy link
Collaborator Author

bdg221 commented Feb 27, 2024

At this point there are two warnings, both PendingDeprecationWarning related to Qiskit deprecations.

/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pennylane_qiskit/qiskit_device.py:26: PendingDeprecationWarning: The qiskit.extensions module is pending deprecation since Qiskit 0.45.0. It will be deprecated in a following release, no sooner than 3 months after the 0.45.0 release.
    from qiskit import extensions as ex

mitiq/interface/mitiq_qiskit/tests/test_qiskit_utils.py: 42 warnings
mitiq/pec/representations/tests/test_learning.py: 594 warnings
mitiq/zne/tests/test_zne.py: 175 warnings
  /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/qiskit/utils/deprecation.py:183: PendingDeprecationWarning: Building a flow controller with keyword arguments is going to be deprecated. Custom controllers must be explicitly instantiated and appended to the task list.
    return func(*args, **kwargs)

@natestemen
Copy link
Member

Oh yeah no need to worry about those! We have an issue to upgrade to qiskit 1.0 open #2204 that will hopefully resolve one/both of those warnings. Thanks for checking!

@natestemen natestemen merged commit 2b33976 into unitaryfund:master Feb 27, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pytest RuntimeWarning
2 participants