Skip to content

Commit

Permalink
remove error message test
Browse files Browse the repository at this point in the history
  • Loading branch information
kt474 committed Oct 3, 2023
1 parent cc9df6e commit 96f6248
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
15 changes: 0 additions & 15 deletions test/integration/test_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from qiskit.primitives import BaseEstimator, EstimatorResult

from qiskit_ibm_runtime import Estimator, Session
from qiskit_ibm_runtime.exceptions import RuntimeJobFailureError

from ..decorators import run_integration_test
from ..ibm_test_case import IBMIntegrationTestCase
Expand Down Expand Up @@ -187,20 +186,6 @@ def test_estimator_coeffs(self, service):
self.assertTrue(np.allclose(chsh1_terra.values, chsh1_runtime.values, rtol=0.3))
self.assertTrue(np.allclose(chsh2_terra.values, chsh2_runtime.values, rtol=0.3))

@run_integration_test
def test_estimator_error_messages(self, service):
"""Test that the correct error message is displayed"""
circuit = QuantumCircuit(2, 2)
circuit.h(0)
with Session(service, self.backend) as session:
estimator = Estimator(session=session)
job = estimator.run(circuits=circuit, observables="II")
with self.assertRaises(RuntimeJobFailureError) as err:
job.result()
self.assertIn("register name", str(err.exception))
self.assertFalse("python -m uvicorn server.main" in str(err.exception))
self.assertIn("register name", str(job.error_message()))

@run_integration_test
def test_estimator_no_session(self, service):
"""Test estimator primitive without a session."""
Expand Down
14 changes: 0 additions & 14 deletions test/integration/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,6 @@ def _callback(job_id_, result_):
self.assertEqual(job.job_id(), job_ids.pop())
session.close()

@run_integration_test
def test_sampler_error_messages(self, service):
"""Test that the correct error message is displayed"""
circuit = QuantumCircuit(2, 2)
circuit.h(0)
with Session(service, self.backend) as session:
sampler = Sampler(session=session)
job = sampler.run(circuits=circuit)
with self.assertRaises(RuntimeJobFailureError) as err:
job.result()
self.assertIn("No counts for experiment", str(err.exception))
self.assertFalse("python -m uvicorn server.main" in err.exception.message)
self.assertIn("No counts for experiment", str(job.error_message()))

@run_integration_test
def test_sampler_no_session(self, service):
"""Test sampler without session."""
Expand Down

0 comments on commit 96f6248

Please sign in to comment.