Skip to content

Commit bb61cfe

Browse files
committed
adding test for warning.
1 parent 5226e57 commit bb61cfe

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/test_task.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,33 @@ def test_batch_error(*args):
2020
Chain(5, 6.1)
2121
.rydberg.detuning.uniform.linear(-10, 10, 3.0)
2222
.quera.mock()
23-
.run(100)
23+
.run_async(100)
24+
)
25+
26+
error_files = glob.glob("partial-batch-errors-*")
27+
batch_files = glob.glob("partial-batch-future-*")
28+
29+
assert len(error_files) == 1
30+
assert len(batch_files) == 1
31+
32+
for error_file, batch_file in zip(error_files, batch_files):
33+
os.remove(error_file)
34+
os.remove(batch_file)
35+
36+
37+
@patch("bloqade.ir.routine.quera.MockBackend")
38+
def test_batch_warn(*args):
39+
backend = bloqade.ir.routine.quera.MockBackend()
40+
41+
backend.submit_task.side_effect = ValueError("some random error")
42+
backend.dict.return_value = {"state_file": ".mock_state.txt"}
43+
44+
with pytest.warns():
45+
(
46+
Chain(5, 6.1)
47+
.rydberg.detuning.uniform.linear(-10, 10, 3.0)
48+
.quera.mock()
49+
.run_async(100, ignore_submission_error=True)
2450
)
2551

2652
error_files = glob.glob("partial-batch-errors-*")

0 commit comments

Comments
 (0)