예제 #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
예제 #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
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #7
0
 def test_submit_job(self):
     """Test running a single circuit."""
     Honeywell.load_account()
     job = self._submit_job()
     self.assertIsInstance(job, HoneywellJob)
예제 #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)
예제 #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)
예제 #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)
예제 #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())