-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address several warnings raised during tests (#1351)
This change rolls together several small changes to avoid warnings generated when running the tests. Here is a summary of the changes: * Update use of `datetime.utcnow()` deprecated in Python 3.12 * Concatenate pandas dataframes more carefully to avoid `FutureWarning` when concatenating an empty dataframe (see pandas-dev/pandas#52532). * Adjust plotter tests to avoid warnings + Use supported options rather than arbitrary options to avoid unexpected option warning + Catch expected warning when passing an untrained discriminator to `IQPlotter` * Move the setting of the axis scale earlier in the logic of `MplDrawer.format_canvas`. `format_canvas` queries the limits of each `axes` object and uses those values. When no data set on a set of axes (an odd edge case), the default values depend on the scale (because the minimum for linear is 0 but for log is 0.1), so the scale needs to be set first. * Remove transpile options from `FineDragCal` (`_transpiled_circuits` for `BaseCalibrationExperiment` warns about and ignores transpile options) * Replace `isinstance` checks with `pulse_type` checks for calibration tests checking pulse shape * Replace `qiskit.Aer` usage with `qiskit_aer` * Set tolerance on cvxpy test to larger value, close to the tolerance achieved in practice. The routine was maxing out its iterations without achieving tolerance but still producing a close enough result for the test to pass. Increasing the tolerance avoids the max iterations warning and makes the test faster. * Rename `TestLibrary` to `MutableTestLibrary`. The class name starting with `Test*` causes pytest to warn about the class looking like a class holding test cases. pytest is not the main way we run the tests but it still seems best to avoid confusion between test case classes and test helper classes. * Catch warnings about insufficient trials in `QuantumVolume` tests using small numbers of trials. * Catch user and deprecation warnings about calibration saving and loading to csv files. * Convert existing calibration saving and loading tests from json to csv, leaving basic coverage of csv saving. A bug was found with json saving, resulting in one test being marked as an expected failure. * Set data on the `ExperimentData` for `TestFramework.test_run_analysis_experiment_data_pickle_roundtrip` to avoid a warning about an empty experiment data object. Other cases of this warning were addressed in 729014b but this test case was added afterward in a6c9e53. In order to avoid warnings creeping in in the future, this change also makes any warnings emitted by qiskit-experiments code be treated as exceptions by the tests (with an exception for `ScatterTable` methods for which it is planned to remove the deprecation). Any expected warnings in tests can be handled by using `assertWarns` or `warnings.catch_warnings`. As all the changes relate to tests (except the `FineDragCal` one which is a non-functional change to avoid a warning), no release note was added. --------- Co-authored-by: Helena Zhang <[email protected]>
- Loading branch information
1 parent
bf980b4
commit c536026
Showing
15 changed files
with
214 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.