Skip to content

Commit

Permalink
Update tests for Qiskit 1.0 (#41)
Browse files Browse the repository at this point in the history
* Update tests for Qiskit 1.0

This commit updates the execute tests to remove the use of execute()
which was removed in Qiskit 1.0 after being deprecated in 0.46. How this
managed to merge, I'm not entirely clear on because it should have
failed CI on the removal PR, so there is likely a configuration issue in
the neko custom action as well that will need to be fixed.

* Fix fake provider usage

* Fix typo
  • Loading branch information
mtreinish authored Feb 23, 2024
1 parent 7f9bc6b commit 336bd34
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion qiskit_neko/aer_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""Qiskit Aer default backend plugin."""

import qiskit_aer as aer
from qiskit.providers import fake_provider
from qiskit_ibm_runtime import fake_provider

from qiskit_neko import backend_plugin

Expand Down
8 changes: 4 additions & 4 deletions qiskit_neko/tests/circuits/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import math

from qiskit.circuit import QuantumCircuit
from qiskit import execute
from qiskit import transpile

from qiskit_neko import decorators
from qiskit_neko.tests import base
Expand All @@ -40,7 +40,7 @@ def test_bell_execute_fixed_shots(self):
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()
job = execute(circuit, self.backend, shots=100)
job = self.backend.run(transpile(circuit, self.backend), shots=100)
result = job.result()
counts = result.get_counts()
self.assertDictAlmostEqual(counts, {"00": 50, "11": 50}, delta=10)
Expand All @@ -53,7 +53,7 @@ def test_bell_execute_default_shots(self):
circuit.cx(0, 1)
circuit.measure_all()
expected_count = self.backend.options.shots / 2
job = execute(circuit, self.backend)
job = self.backend.run(transpile(circuit, self.backend))
result = job.result()
counts = result.get_counts()
delta = 10 ** (math.log10(self.backend.options.shots) - 1)
Expand All @@ -69,7 +69,7 @@ def test_bell_execute_backend_shots_set_options(self):
circuit.cx(0, 1)
circuit.measure_all()
self.backend.set_options(shots=100)
job = execute(circuit, self.backend)
job = self.backend.run(transpile(circuit, self.backend))
result = job.result()
counts = result.get_counts()
self.assertDictAlmostEqual(counts, {"00": 50, "11": 50}, delta=10)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ qiskit-aer
qiskit-nature[pyscf]
qiskit-experiments
qiskit-machine-learning
qiskit-ibm-runtime>=0.19
stestr>=3.2.0
testtools>=2.5.0
fixtures>=3.0.0
Expand Down

0 comments on commit 336bd34

Please sign in to comment.