From 45480bc52181f608c5f997c507ec161ce01d5a4b Mon Sep 17 00:00:00 2001 From: Will Shanks Date: Sat, 3 Feb 2024 01:35:36 -0500 Subject: [PATCH] Use internal FakeProvider in place of one removed in Qiskit 1.0 --- qiskit_experiments/framework/backend_data.py | 2 +- qiskit_experiments/test/fake_backend.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/framework/backend_data.py b/qiskit_experiments/framework/backend_data.py index c5d420d24c..3d4e91eb92 100644 --- a/qiskit_experiments/framework/backend_data.py +++ b/qiskit_experiments/framework/backend_data.py @@ -22,7 +22,7 @@ class unifies data access for various data fields. try: # Removed in Qiskit 1.0. Different from the other FakeBackendV2's - from qiskit.providers.fake_provider import FakeBackendV2 + from qiskit.providers.fake_provider import QiskitFakeBackendV2 except ImportError: class QiskitFakeBackendV2: diff --git a/qiskit_experiments/test/fake_backend.py b/qiskit_experiments/test/fake_backend.py index 3918cca70b..0fcf06f626 100644 --- a/qiskit_experiments/test/fake_backend.py +++ b/qiskit_experiments/test/fake_backend.py @@ -13,8 +13,8 @@ """Fake backend class for tests.""" import uuid from qiskit.circuit.library import Measure +from qiskit.providers import ProviderV1 from qiskit.providers.backend import BackendV2 -from qiskit.providers.fake_provider import FakeProvider from qiskit.providers.options import Options from qiskit.transpiler import Target @@ -23,6 +23,14 @@ from qiskit_experiments.test.utils import FakeJob +class FakeProvider(ProviderV1): + """Fake provider with no backends for testing""" + + def backends(self, name=None, **kwargs): + """List of available backends. Empty in this case""" + return [] + + class FakeBackend(BackendV2): """ Fake backend for test purposes only.