Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
466 changes: 44 additions & 422 deletions qiskit/providers/ibmq/api/ibmqconnector.py

Large diffs are not rendered by default.

407 changes: 407 additions & 0 deletions qiskit/providers/ibmq/api/utils.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qiskit-terra>=0.7,<0.8
marshmallow>=2.16.3,<3
marshmallow>=2.17.0,<3
requests>=2.19
requests-ntlm>=1.1.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

requirements = [
"qiskit-terra>=0.7,<0.8",
"marshmallow>=2.16.3,<3",
"marshmallow>=2.17.0,<3",
"requests>=2.19",
"requests-ntlm>=1.1.0",
]
Expand Down
28 changes: 20 additions & 8 deletions test/ibmq/test_ibmq_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ def setUp(self):
self.qasms = [{'qasm': SAMPLE_QASM_1},
{'qasm': SAMPLE_QASM_2}]

@staticmethod
def _get_api(qe_token, qe_url):
"""Helper for instantating an IBMQConnector."""
return IBMQConnector(qe_token, config={'url': qe_url})

@requires_qe_access
def test_api_auth_token(self, qe_token, qe_url):
"""Authentication with IBMQ Platform."""
Expand Down Expand Up @@ -114,10 +119,21 @@ def test_qx_api_version(self, qe_token, qe_url):
version = api.api_version()
self.assertGreaterEqual(int(version.split(".")[0]), 4)

@staticmethod
def _get_api(qe_token, qe_url):
"""Helper for instantating an IBMQConnector."""
return IBMQConnector(qe_token, config={'url': qe_url})
@requires_qe_access
def test_get_job_includes(self, qe_token, qe_url):
"""Check the field includes parameter for get_job."""
api = self._get_api(qe_token, qe_url)

# Run a job and get its id.
backend = 'ibmq_qasm_simulator'
shots = 1
job = api.run_job(self.qasms, backend, shots)
job_id = job['id']

# Get the job, excluding a parameter.
self.assertIn('userId', job)
job_excluded = api.get_job(job_id, exclude_fields=['userId'])
self.assertNotIn('userId', job_excluded)


class TestAuthentication(QiskitTestCase):
Expand Down Expand Up @@ -179,7 +195,3 @@ def test_url_unreachable(self, qe_token, qe_url):
measure q[0] -> c[0];
measure q[44] -> c[44];
"""


if __name__ == '__main__':
unittest.main(verbosity=2)
4 changes: 0 additions & 4 deletions test/ibmq/test_ibmq_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,3 @@ def test_execute_two_remote(self, qe_token, qe_url):
job = execute([qc, qc_extra], backend, seed=TestCompiler.seed)
results = job.result()
self.assertIsInstance(results, Result)


if __name__ == '__main__':
unittest.main(verbosity=2)
4 changes: 0 additions & 4 deletions test/ibmq/test_ibmq_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,3 @@ def _bell_circuit():
qc.cx(qr[0], qr[1])
qc.measure(qr, cr)
return qc


if __name__ == '__main__':
unittest.main(verbosity=2)
4 changes: 0 additions & 4 deletions test/ibmq/test_ibmq_job_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,3 @@ class QObjResultAPI(BaseFakeAPI):
}
}
]


if __name__ == '__main__':
unittest.main(verbosity=2)
4 changes: 0 additions & 4 deletions test/ibmq/test_ibmq_qobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,3 @@ def test_atlantic_circuit(self):
result_local = self._local_backend.run(qobj).result()
self.assertDictAlmostEqual(result_remote.get_counts(circuit),
result_local.get_counts(circuit), delta=50)


if __name__ == '__main__':
unittest.main(verbosity=2)
4 changes: 0 additions & 4 deletions test/ibmq/test_reordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,3 @@ def _get_backends(self, qe_token, qe_url):
real_backend = None

return sim_backend, real_backend


if __name__ == '__main__':
unittest.main(verbosity=2)