Skip to content

Commit fde1b24

Browse files
committed
fix: E2E tests regression
1 parent 6d63d9c commit fde1b24

File tree

4 files changed

+17
-33
lines changed

4 files changed

+17
-33
lines changed

azure-quantum/azure/quantum/cirq/targets/quantinuum.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
##
5+
import json
56
import numpy as np
67

78
from typing import TYPE_CHECKING, Any, Dict, Sequence
@@ -97,7 +98,7 @@ def submit(
9798
metadata = {
9899
"qubits": len(program.all_qubits()),
99100
"repetitions": repetitions,
100-
"measurement_dict": self._measurement_dict(program)
101+
"measurement_dict": json.dumps(self._measurement_dict(program))
101102
}
102103
# Override metadata with value from kwargs
103104
metadata.update(kwargs.get("metadata", {}))

azure-quantum/azure/quantum/qiskit/backends/ionq.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
if TYPE_CHECKING:
2828
from azure.quantum.qiskit import AzureQuantumProvider
2929

30+
import json
31+
3032
import logging
3133

3234
logger = logging.getLogger(__name__)
@@ -244,7 +246,7 @@ def _prepare_job_metadata(self, circuit, **kwargs):
244246
_, _, meas_map = qiskit_circ_to_ionq_circ(circuit, gateset=self.gateset())
245247

246248
metadata = super()._prepare_job_metadata(circuit, **kwargs)
247-
metadata["meas_map"] = meas_map
249+
metadata["meas_map"] = json.dumps(meas_map)
248250

249251
return metadata
250252

azure-quantum/tests/unit/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,14 @@ def create_echo_target(
318318
**kwargs
319319
) -> Target:
320320
"""
321-
Create a `Microsoft.Test.echo-target` Target for simple job submission tests.
321+
Create a `Microsoft.Test.FirstParty.echo-target` Target for simple job submission tests.
322322
Uses the Workspace returned from `create_workspace()` method.
323323
"""
324324
workspace = self.create_workspace(credential=credential, **kwargs)
325325
target = Target(
326326
workspace=workspace,
327327
name="echo-output",
328-
provider_id="Microsoft.Test",
328+
provider_id="Microsoft.Test.FirstParty",
329329
input_data_format = "microsoft.quantum-log.v1",
330330
output_data_format = "microsoft.quantum-log.v1"
331331
)

azure-quantum/tests/unit/test_microsoft_elements_dft.py

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ class TestMicrosoftElementsDftJob(QuantumTestBase):
1616
@pytest.mark.microsoft_elements_dft
1717
def test_dft_success(self):
1818
dft_input_params = {
19-
"tasks": [
20-
{
21-
"taskType": "spe",
22-
"basisSet": { "name": "def2-svp", "cartesian": False },
23-
"xcFunctional": { "name": "m06-2x", "gridLevel": 4 },
24-
"scf": { "method": "rks", "maxSteps": 100, "convergeThreshold": 1e-8 }
25-
}
26-
]
19+
"driver": "energy",
20+
"model": {"method": "m06-2x", "basis": "def2-svp"},
2721
}
2822

2923
job = self._run_job(dft_input_params)
@@ -37,14 +31,8 @@ def test_dft_success(self):
3731
@pytest.mark.microsoft_elements_dft
3832
def test_dft_failure_invalid_input(self):
3933
dft_input_params = {
40-
"tasks": [
41-
{
42-
"taskType": "invlidTask",
43-
"basisSet": { "name": "def2-svp", "cartesian": False },
44-
"xcFunctional": { "name": "m06-2x", "gridLevel": 4 },
45-
"scf": { "method": "rks", "maxSteps": 100, "convergeThreshold": 1e-8 }
46-
}
47-
]
34+
"driver": "energy",
35+
"model": {"method": "m06-2x", "basis": "invalidBasis"},
4836
}
4937

5038
job = self._run_job(dft_input_params)
@@ -58,14 +46,8 @@ def test_dft_failure_invalid_input(self):
5846
@pytest.mark.microsoft_elements_dft
5947
def test_dft_failure_algorithm_produces_output(self):
6048
dft_input_params = {
61-
"tasks": [
62-
{
63-
"taskType": "spe",
64-
"basisSet": { "name": "def2-svp", "cartesian": False },
65-
"xcFunctional": { "name": "m06-2x", "gridLevel": 4 },
66-
"scf": { "method": "rks", "maxSteps": 1, "convergeThreshold": 1e-8 }
67-
}
68-
]
49+
"driver": "energy",
50+
"model": {"method": "m06-2x", "basis": "invalidBasis"},
6951
}
7052

7153
job = self._run_job(dft_input_params)
@@ -82,12 +64,11 @@ def _run_job(self, input_params) -> Job:
8264
target = workspace.get_targets("microsoft.dft")
8365
dir_path = os.path.dirname(os.path.realpath(__file__))
8466

85-
with open(f"{dir_path}/molecule.xyz", "r") as file:
86-
job = target.submit(input_data=file.read(), input_params=input_params)
87-
job.wait_until_completed(timeout_secs=DEFAULT_TIMEOUT_SECS)
88-
job.refresh()
67+
job = target.submit(input_data=[f"{dir_path}/molecule.xyz"], input_params=input_params)
68+
job.wait_until_completed(timeout_secs=DEFAULT_TIMEOUT_SECS)
69+
job.refresh()
8970

90-
return job
71+
return job
9172

9273
test_xyz_file = Path(__file__).parent / "molecule.xyz"
9374

0 commit comments

Comments
 (0)