Exemple #1
0
 def test_get_job_result(self):
     """Test get result of job"""
     Honeywell.load_account()
     job = self._submit_job()
     result = job.result()
     self.assertEqual(result.success, True)
     return result
Exemple #2
0
 def test_job_with_id(self):
     """Test creating a job with an id."""
     Honeywell.load_account()
     backend = Honeywell.get_backend(self.backend_name)
     job = self._submit_job()
     job_id = job.job_id()
     credentials = backend.provider().credentials
     job_created_with_id = HoneywellJob(backend, job_id, self.api_cls(credentials))
     result = job_created_with_id.result()
     self.assertEqual(result.success, True)
     return result
Exemple #3
0
    def _wrapper(self, *args, **kwargs):
        # To avoid checking the connection in each test
        global HAS_NET_CONNECTION  # pylint: disable=global-statement

        if os.getenv('QISKIT_TEST_SKIP_ONLINE'):
            raise unittest.SkipTest('Skipping online tests')

        if HAS_NET_CONNECTION is None:
            HAS_NET_CONNECTION = _has_connection('qapi.honeywell.com', 443)

        if not HAS_NET_CONNECTION:
            raise unittest.SkipTest("Test requires internet connection.")

        try:
            Honeywell.load_account()
        except exceptions.HoneywellError:
            raise unittest.SkipTest(
                "Test requires valid, configured honeywell credentials")

        return func(self, *args, **kwargs)
Exemple #4
0
 def test_get_job_id(self):
     """Test get id of job"""
     Honeywell.load_account()
     job = self._submit_job()
     job_id = job.job_id()
     self.assertIsNotNone(job_id)
Exemple #5
0
 def test_get_creation_date(self):
     """Test get creation date of job"""
     Honeywell.load_account()
     job = self._submit_job()
     creation_date = job.creation_date()
     self.assertIsNotNone(creation_date)
Exemple #6
0
 def test_get_job_status(self):
     """Test get status of job"""
     job = self._submit_job()
     Honeywell.load_account()
     status = job.status()
     self.assertIsInstance(status, JobStatus)
Exemple #7
0
 def test_submit_job(self):
     """Test running a single circuit."""
     Honeywell.load_account()
     job = self._submit_job()
     self.assertIsInstance(job, HoneywellJob)
Exemple #8
0
 def _submit_job(self):
     """Helper method to submit job and return job instance"""
     Honeywell.load_account()
     backend = Honeywell.get_backend(self.backend_name)
     return execute(self.circuit, backend)
Exemple #9
0
 def test_name(self):
     """Test backend.name()."""
     Honeywell.load_account()
     backend = Honeywell.get_backend(self.backend_name)
     name = backend.name()
     self.assertEqual(name, self.backend_name)
Exemple #10
0
 def test_status(self):
     """Test backend.status()."""
     Honeywell.load_account()
     backend = Honeywell.get_backend(self.backend_name)
     status = backend.status()
     self.assertIsInstance(status, BackendStatus)
Exemple #11
0
 def test_provider(self):
     """Test backend.provider()."""
     Honeywell.load_account()
     backend = Honeywell.get_backend(self.backend_name)
     provider = backend.provider()
     self.assertEqual(provider, self.provider_cls())