Skip to content

Commit

Permalink
Merge branch 'main' into backendv2
Browse files Browse the repository at this point in the history
  • Loading branch information
rathishcholarajan committed Apr 8, 2022
2 parents 217570e + a59db47 commit 32ee038
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
6 changes: 5 additions & 1 deletion test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _get_integration_test_config():
def integration_test_setup_with_backend(
backend_name: Optional[str] = None,
simulator: Optional[bool] = True,
min_num_qubits: Optional[int] = None,
) -> Callable:
"""Returns a decorator that retrieves the appropriate backend to use for testing.
Expand All @@ -57,6 +58,7 @@ def integration_test_setup_with_backend(
Args:
backend_name: The name of the backend.
simulator: If set to True, the list of suitable backends is limited to simulators.
min_num_qubits: Minimum number of qubits the backend has to have.
Returns:
Decorator that retrieves the appropriate backend to use for testing.
Expand All @@ -75,7 +77,9 @@ def _wrapper(self, *args, **kwargs):
else:
_backend = least_busy(
provider.backends(
simulator=simulator, instance=dependencies.instance
simulator=simulator,
instance=dependencies.instance,
min_num_qubits=min_num_qubits,
)
)
if not _backend:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_account_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class TestAccountClientJobs(IBMTestCase):
"""

@classmethod
@integration_test_setup_with_backend(backend_name="ibmq_qasm_simulator")
@integration_test_setup_with_backend()
def setUpClass(
cls, dependencies: IntegrationTestDependencies, backend: IBMBackend
) -> None:
Expand Down
4 changes: 1 addition & 3 deletions test/integration/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def test_backend_options(self):
def test_sim_backend_options(self):
"""Test simulator backend options."""
provider: IBMProvider = self.backend.provider
backend = provider.get_backend(
"ibmq_qasm_simulator", instance=self.dependencies.instance
)
backend = provider.get_backend("ibmq_qasm_simulator")
backend.options.shots = 2048
backend.set_options(memory=True)
job = backend.run(ReferenceCircuits.bell(), shots=1024, foo="foo")
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_filter_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TestBackendFilters(IBMTestCase):
"""Qiskit Backend Filtering Tests."""

@classmethod
@integration_test_setup_with_backend(backend_name="ibmq_qasm_simulator")
@integration_test_setup_with_backend()
def setUpClass(
cls, backend: IBMBackend, dependencies: IntegrationTestDependencies
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_ibm_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TestIBMIntegration(IBMTestCase):
seed = 42

@classmethod
@integration_test_setup_with_backend(simulator=False)
@integration_test_setup_with_backend(simulator=False, min_num_qubits=2)
def setUpClass(
cls, backend: IBMBackend, dependencies: IntegrationTestDependencies
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_ibm_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TestIBMJob(IBMTestCase):
"""Test ibm_job module."""

@classmethod
@integration_test_setup_with_backend(simulator=False)
@integration_test_setup_with_backend(simulator=False, min_num_qubits=2)
def setUpClass(
cls, backend: IBMBackend, dependencies: IntegrationTestDependencies
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_ibm_job_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TestIBMJobAttributes(IBMTestCase):
"""Test IBMJob instance attributes."""

@classmethod
@integration_test_setup_with_backend(backend_name="ibmq_qasm_simulator")
@integration_test_setup_with_backend()
def setUpClass(
cls, backend: IBMBackend, dependencies: IntegrationTestDependencies
) -> None:
Expand Down

0 comments on commit 32ee038

Please sign in to comment.