Skip to content

Commit c346e50

Browse files
authored
Deflake the status test of an asynchronous SimulatedLocalJob (#7862)
When SimulatedLocalJob runs asynchronously it may report the initial READY state right after its creation because the scheduling of the job and test threads is undefined. Accept READY as a valid job status. This avoids flaky test failure on Windows.
1 parent 3b03ef6 commit c346e50

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cirq-google/cirq_google/engine/simulated_local_job_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def test_run_async():
107107
sweeps=[{}],
108108
simulation_type=LocalSimulationType.ASYNCHRONOUS,
109109
)
110-
assert job.execution_status() == quantum.ExecutionStatus.State.RUNNING
110+
assert job.execution_status() in (
111+
quantum.ExecutionStatus.State.READY,
112+
quantum.ExecutionStatus.State.RUNNING,
113+
)
111114
_ = job.results()
112115
assert job.execution_status() == quantum.ExecutionStatus.State.SUCCESS

0 commit comments

Comments
 (0)