Skip to content

Commit

Permalink
Refactor Q8SBackend initialization to allow optional client parameter…
Browse files Browse the repository at this point in the history
… and update tests accordingly
  • Loading branch information
vstirbu committed Nov 15, 2024
1 parent f03ea78 commit 50f707d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/qiskit/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
class Q8SBackend(BackendV2, ABC):
_client = None

def __init__(self, **kwargs):
def __init__(self, client: Client = None, **kwargs):
super().__init__(**kwargs)

self._client = Client()
if client:
self._client = client
else:
self._client = Client()

@classmethod
def _default_options(self) -> Options:
Expand Down
2 changes: 1 addition & 1 deletion app/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_run_circuit_invalid():


def test_run_circuit_from_backend():
simulator = Q8SBackend()
simulator = Q8SBackend(client=client)

job = simulator.run(circuit)

Expand Down

0 comments on commit 50f707d

Please sign in to comment.