Closed mudit2812 closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.39%. Comparing base (
d9e833a
) to head (455c9a9
). Report is 4 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Should we also replace use_legacy_opmath
with legacy_opmath_only
in this test?
Looks like running some tests only when legacy op math is active has caused some humps with codecov. Not sure if it should be addressed or not.
To fix the error in:
tests/optimize/test_momentum_qng.py::TestOptimize::test_single_qubit_vqe_using_expval_h_multiple_input_params
(added today) and tests/optimize/test_qng.py::TestOptimize::test_single_qubit_vqe_using_expval_h_multiple_input_params
I guess we can safely remove the recwarn
parameter. I am not sure about the other failures
It looks like I just need to add back some of the duplicate tests we had for legacy opmath tests to pass. For some reason, the legacy opmath enable only happens after all the parameters for parametrized tests are created, so we're ending up in a situation where we create LinearCombinations and Prods when Hamiltonians and Tensors are expected.
Proceeding to force merge after discussing with @mudit2812 !! Context: Tests that used to run in CI for legacy opmath have been changed to only run in the Plugin Test Matrix
Context: Legacy op math is being deprecated.
Description of the Change:
qml.ops.Hamiltonian
is deprecated.qml.operation.Tensor
is deprecated.qml.operation.disable_new_opmath
andqml.operation.enable_new_opmath
(as well as the context managers) are deprecated.qml.operation.convert_to_legacy_H
is deprecated.PauliWord.hamiltonian
andPauliSentence.hamiltonian
is deprecated.qml.pauli.simplify
is deprecated.Removed
use_legacy_opmath
anduse_new_opmath
fixtures. Instead, we use eitherlegacy_opmath_only
,new_opmath_only
, or no fixture, as appropriate for the tests.Added warning suppression for all the above deprecation warnings to
pytest.ini
. Additionally, I also added the same warning suppressions toconftest.py
for the case when--disable-opmath=True
, since the warning filters inpytest.ini
only suppress warnings that come from inside tests, not ones that come from outside the tests, such as when deprecated code is used for creating parameters for a test.Benefits:
Possible Drawbacks: In some instances, there will be a LOT of deprecation warnings at the same time. The most impactful example of this if if using
qml.qchem.molecular_hamiltonian
,qml.qchem.qubit_observable
. These usingsimplify
andPauliSentence.hamiltonian
with legacy op math, so there will be up to 4 warnings at once when using these.Additionally,
qml.qchem.tapering.symmetry_generators
andqml.qchem.tapering.clifford
usePauliSentence.hamiltonian
when legacy op math is enabled, so there will be up to 3 warnings at once when using these.Related GitHub Issues:
I will run the test suite with
disable_new_opmath
set toTrue
once before merging to confirm that legacy op math tests do not fail.[sc-71940] [sc-66727] [sc-66724]