Skip to content

Commit b1e9462

Browse files
authored
Small improvements to payload cleanup fixture (#10943)
1 parent 6512aaa commit b1e9462

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, Callable, Generator, Iterator
11+
from typing import Any, AsyncIterator, Callable, Generator, Iterator
1212
from unittest import mock
1313
from uuid import uuid4
1414

@@ -338,15 +338,13 @@ def parametrize_zlib_backend(
338338

339339

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

0 commit comments

Comments
 (0)