Skip to content

Commit 88a278b

Browse files
✅ Fix test that fails with Qiskit 2.2.0 (#470)
## Description Inspired by https://github.com/Qiskit/qiskit/pull/14904/files#r2294777337, this fixes the test that fails with Qiskit 2.2.0. ## Checklist: - [x] The pull request only contains commits that are focused and relevant to this change. - [x] I have added appropriate tests that cover the new/changed functionality. - [x] ~I have updated the documentation to reflect these changes.~ - [x] ~I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.~ - [x] ~I have added migration instructions to the upgrade guide (if needed).~ - [x] The changes follow the project's style guidelines and introduce no new warnings. - [x] The changes are fully tested and pass the CI checks. - [x] I have reviewed my own code changes. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6c4705a commit 88a278b

File tree

4 files changed

+135
-103
lines changed

4 files changed

+135
-103
lines changed

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ dynamic = ["version"]
3030

3131
dependencies = [
3232
"mqt.bench>=2.0.0",
33-
"qiskit>=1.3.3,<2.2.0",
33+
"qiskit>=1.3.3",
3434
"pytket>=1.29.0", # lowest version that supports the used pytket AutoRebase pass instead of auto_rebase
3535
"pytket_qiskit>=0.61.0",
36+
# TODO(denialhaag): Remove once pytket_qiskit is updated
37+
# https://github.com/munich-quantum-toolkit/predictor/issues/471
38+
"qiskit-ibm-runtime>=0.30.0,<0.42.0",
3639
"sb3_contrib>=2.0.0",
3740
"tqdm>=4.66.0",
3841
"rich>=12.6.0",

src/mqt/predictor/rl/parsing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pytket.circuit import Node
2020
from pytket.placement import place_with_map
2121
from qiskit import QuantumRegister
22+
from qiskit.converters import circuit_to_dag, dag_to_circuit
2223
from qiskit.transpiler import Layout, TranspileLayout
2324
from qiskit.transpiler.passes import ApplyLayout
2425

@@ -245,5 +246,5 @@ def postprocess_vf2postlayout(
245246
apply_layout.property_set["final_layout"] = layout_before.final_layout
246247
apply_layout.property_set["post_layout"] = post_layout
247248

248-
altered_qc = apply_layout(qc)
249-
return altered_qc, apply_layout
249+
altered_qc = apply_layout.run(circuit_to_dag(qc))
250+
return dag_to_circuit(altered_qc), apply_layout

tests/compilation/test_helper_rl.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ def test_vf2_layout_and_postlayout() -> None:
7777

7878
assert pm.property_set["VF2PostLayout_stop_reason"] == VF2PostLayoutStopReason.SOLUTION_FOUND
7979

80-
postprocessed_vf2postlayout_qc, _ = postprocess_vf2postlayout(
81-
altered_qc, pm.property_set["post_layout"], qc_transpiled.layout
82-
)
80+
_, pass_manager = postprocess_vf2postlayout(altered_qc, pm.property_set["post_layout"], qc_transpiled.layout)
8381

84-
assert initial_layout_before != postprocessed_vf2postlayout_qc.layout.initial_layout
82+
assert initial_layout_before != pass_manager.property_set["initial_layout"]

0 commit comments

Comments
 (0)