diff --git a/tests/test_task.py b/tests/test_task.py index 779b77d27..db09ffd8f 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -20,7 +20,33 @@ def test_batch_error(*args): Chain(5, 6.1) .rydberg.detuning.uniform.linear(-10, 10, 3.0) .quera.mock() - .run(100) + .run_async(100) + ) + + error_files = glob.glob("partial-batch-errors-*") + batch_files = glob.glob("partial-batch-future-*") + + assert len(error_files) == 1 + assert len(batch_files) == 1 + + for error_file, batch_file in zip(error_files, batch_files): + os.remove(error_file) + os.remove(batch_file) + + +@patch("bloqade.ir.routine.quera.MockBackend") +def test_batch_warn(*args): + backend = bloqade.ir.routine.quera.MockBackend() + + backend.submit_task.side_effect = ValueError("some random error") + backend.dict.return_value = {"state_file": ".mock_state.txt"} + + with pytest.warns(): + ( + Chain(5, 6.1) + .rydberg.detuning.uniform.linear(-10, 10, 3.0) + .quera.mock() + .run_async(100, ignore_submission_error=True) ) error_files = glob.glob("partial-batch-errors-*")