Skip to content

Commit d82a7ca

Browse files
committed
cover both zero and non-zero linger in test
1 parent 0a7a4cc commit d82a7ca

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/test_batching.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ async def delayed_records():
8585

8686

8787
@pytest.mark.asyncio
88-
async def test_batch_accumulator_flushes_when_source_iter_raises():
88+
@pytest.mark.parametrize(
89+
"linger",
90+
[timedelta(0), timedelta(milliseconds=10)],
91+
ids=["no_linger", "linger"],
92+
)
93+
async def test_batch_accumulator_flushes_when_source_iter_raises(linger):
8994
async def records():
9095
yield Record(body=b"r1")
9196
yield Record(body=b"r2")
@@ -94,7 +99,7 @@ async def records():
9499
batches = []
95100
with pytest.raises(RuntimeError, match="err"):
96101
async for batch in append_record_batches(
97-
records(), batching=Batching(linger=timedelta(0))
102+
records(), batching=Batching(linger=linger)
98103
):
99104
batches.append(batch)
100105

0 commit comments

Comments
 (0)