Skip to content

Commit 2a395d2

Browse files
authored
test: Don't try job creation with offline device (#1150)
1 parent 2638b90 commit 2a395d2

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/integ_tests/test_reservation_arn.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ def test_create_task_via_reservation_arn_on_simulator(reservation_arn):
6161
reason="Python version mismatch",
6262
)
6363
def test_create_job_with_decorator_via_invalid_reservation_arn(reservation_arn):
64-
with pytest.raises(ClientError, match="Reservation arn is invalid"):
65-
66-
@hybrid_job(
67-
device=Devices.IQM.Garnet,
68-
reservation_arn=reservation_arn,
69-
)
70-
def hello_job():
71-
device = AwsDevice(get_job_device_arn())
72-
bell = Circuit().h(0).cnot(0, 1)
73-
task = device.run(bell, shots=10)
74-
measurements = task.result().measurements
75-
return measurements
76-
77-
hello_job()
64+
if AwsDevice(Devices.IQM.Garnet).status == "ONLINE":
65+
with pytest.raises(ClientError, match="Reservation arn is invalid"):
66+
@hybrid_job(
67+
device=Devices.IQM.Garnet,
68+
reservation_arn=reservation_arn,
69+
)
70+
def hello_job():
71+
device = AwsDevice(get_job_device_arn())
72+
bell = Circuit().h(0).cnot(0, 1)
73+
task = device.run(bell, shots=10)
74+
measurements = task.result().measurements
75+
return measurements
76+
77+
hello_job()

0 commit comments

Comments
 (0)