Skip to content

Wrap calls to deprecated functions in qubit_characterizations_test.py#8031

Merged
pavoljuhas merged 7 commits into
quantumlib:mainfrom
mhucka:fix-deprecation-characterizations
Apr 14, 2026
Merged

Wrap calls to deprecated functions in qubit_characterizations_test.py#8031
pavoljuhas merged 7 commits into
quantumlib:mainfrom
mhucka:fix-deprecation-characterizations

Conversation

@mhucka
Copy link
Copy Markdown
Contributor

@mhucka mhucka commented Apr 13, 2026

Running check/pytest in Python 3.11 on a Debian Linux system produced a few warnings similar to this:

cirq-core/cirq/experiments/qubit_characterizations_test.py::test_parallel_single_qubit_parallel_single_qubit_randomized_benchmarking
   /usr/local/google/home/mhucka/projects/github/cirq-pr-warnings/cirq-core/cirq/experiments/qubit_characterizations_test.py:130: DeprecationWarning: parallel_single_qubit_randomized_benchmarking was used but is deprecated.
   It will be removed in cirq v2.0.
   please use parallel_single_qubit_rb instead

     results = parallel_single_qubit_randomized_benchmarking(

These are not critical, but it is a little bit surprising to see them in Cirq's own unit tests.

This wraps the relevant calls in qubit_characterizations_test.py with the cirq.testing.assert_deprecated(…) context manager to indicate that the deprecation messages are known and expected, and keep them from bubbling up to developers.

@github-actions github-actions Bot added the size: S 10< lines changed <50 label Apr 13, 2026
@mhucka mhucka added the kind/health For CI/testing/release process/refactoring/technical debt items label Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.63%. Comparing base (603755a) to head (cf96053).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8031      +/-   ##
==========================================
- Coverage   99.63%   99.63%   -0.01%     
==========================================
  Files        1110     1110              
  Lines       99752    99750       -2     
==========================================
- Hits        99390    99388       -2     
  Misses        362      362              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mhucka mhucka marked this pull request as ready for review April 13, 2026 04:16
@mhucka mhucka requested review from a team, mrwojtek and vtomole as code owners April 13, 2026 04:16
@mhucka mhucka requested a review from senecameeks April 13, 2026 04:16
@mhucka mhucka added this pull request to the merge queue Apr 13, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 13, 2026
Copy link
Copy Markdown
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

The functions that were initially tested are still supported (until cirq-2) and should be tested. I will post inline workaround shortly.

Comment thread cirq-core/cirq/experiments/qubit_characterizations_test.py Outdated
mhucka and others added 4 commits April 13, 2026 16:56
Per review comments by Pavol, `single_qubit_randomized_benchmarking` and
`parallel_single_qubit_randomized_benchmarking` will be removed in
Cirq 2. They are still supported and thus need to be tested.

This revises the changes in this PR to keep the tests but wrap them in
`cirq.test.assert_deprecated(...)`.
@mhucka mhucka requested a review from pavoljuhas April 14, 2026 00:45
Comment on lines +112 to +113
# Inline import so that warnings (if any) are captured during testing.
from cirq.experiments import single_qubit_randomized_benchmarking
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is already imported with cirq so there is no benefit in using a local import. Please revert to module-level imports.

$ python -c "import cirq; print(cirq.experiments.single_qubit_randomized_benchmarking)"
<function single_qubit_randomized_benchmarking at 0x7f30ed960b80>

Copy link
Copy Markdown
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

We should put back module-level imports. Also, please update the PR title and description. Otherwise LGTM.

@mhucka mhucka changed the title Update qubit_characterizations_test.py to use non-deprecated methods Wrap calls to deprecated functions in qubit_characterizations_test.py to catch deprecation messages Apr 14, 2026
@mhucka
Copy link
Copy Markdown
Contributor Author

mhucka commented Apr 14, 2026

We should put back module-level imports. Also, please update the PR title and description. Otherwise LGTM.

Imports moved in the latest push, and title and body updated to something hopefully more appropriate.

@mhucka mhucka changed the title Wrap calls to deprecated functions in qubit_characterizations_test.py to catch deprecation messages Wrap calls to deprecated functions in qubit_characterizations_test.py Apr 14, 2026
@mhucka mhucka requested a review from pavoljuhas April 14, 2026 03:32
@pavoljuhas pavoljuhas enabled auto-merge April 14, 2026 16:38
@pavoljuhas pavoljuhas added this pull request to the merge queue Apr 14, 2026
Merged via the queue into quantumlib:main with commit b8ff93e Apr 14, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/health For CI/testing/release process/refactoring/technical debt items size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants