Wrap calls to deprecated functions in qubit_characterizations_test.py#8031
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
pavoljuhas
left a comment
There was a problem hiding this comment.
The functions that were initially tested are still supported (until cirq-2) and should be tested. I will post inline workaround shortly.
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(...)`.
| # Inline import so that warnings (if any) are captured during testing. | ||
| from cirq.experiments import single_qubit_randomized_benchmarking |
There was a problem hiding this comment.
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>
pavoljuhas
left a comment
There was a problem hiding this comment.
We should put back module-level imports. Also, please update the PR title and description. Otherwise LGTM.
qubit_characterizations_test.py to use non-deprecated methodsqubit_characterizations_test.py to catch deprecation messages
Imports moved in the latest push, and title and body updated to something hopefully more appropriate. |
qubit_characterizations_test.py to catch deprecation messagesqubit_characterizations_test.py
Running
check/pytestin Python 3.11 on a Debian Linux system produced a few warnings similar to this: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.pywith thecirq.testing.assert_deprecated(…)context manager to indicate that the deprecation messages are known and expected, and keep them from bubbling up to developers.