Skip to content

Commit adf28b4

Browse files
committed
fix: ensure iterator is properly closed in sync event channel test
1 parent 53d2c1b commit adf28b4

File tree

1 file changed

+4
-1
lines changed
  • tests/integration/test_adapters/test_psycopg/test_extensions

1 file changed

+4
-1
lines changed

tests/integration/test_adapters/test_psycopg/test_extensions/test_events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ def test_psycopg_sync_event_channel_queue_fallback(tmp_path, postgres_service: P
3939
try:
4040
event_id = channel.publish("notifications", {"action": "queue"})
4141
iterator = channel.iter_events("notifications", poll_interval=0.1)
42-
message = next(iterator)
42+
try:
43+
message = next(iterator)
44+
finally:
45+
iterator.close()
4346
channel.ack(message.event_id)
4447

4548
with config.provide_session() as driver:

0 commit comments

Comments
 (0)