Skip to content

Commit 9bd43ed

Browse files
authored
[PR #10943/b1e9462 backport][3.12] Small improvements to payload cleanup fixture (#10944)
1 parent e9808c3 commit 9bd43ed

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

CHANGES/10943.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10915.bugfix.rst

tests/conftest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from hashlib import md5, sha1, sha256
99
from pathlib import Path
1010
from tempfile import TemporaryDirectory
11-
from typing import Any, Generator, Iterator
11+
from typing import Any, AsyncIterator, Generator, Iterator
1212
from unittest import mock
1313
from uuid import uuid4
1414

@@ -336,15 +336,13 @@ def parametrize_zlib_backend(
336336

337337

338338
@pytest.fixture()
339-
def cleanup_payload_pending_file_closes(
339+
async def cleanup_payload_pending_file_closes(
340340
loop: asyncio.AbstractEventLoop,
341-
) -> Generator[None, None, None]:
341+
) -> AsyncIterator[None]:
342342
"""Ensure all pending file close operations complete during test teardown."""
343343
yield
344344
if payload._CLOSE_FUTURES:
345345
# Only wait for futures from the current loop
346346
loop_futures = [f for f in payload._CLOSE_FUTURES if f.get_loop() is loop]
347347
if loop_futures:
348-
loop.run_until_complete(
349-
asyncio.gather(*loop_futures, return_exceptions=True)
350-
)
348+
await asyncio.gather(*loop_futures, return_exceptions=True)

0 commit comments

Comments
 (0)