Skip to content

Commit 54a82b3

Browse files
authored
Fix async test client cleanup (#801)
1 parent 5ff16ec commit 54a82b3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

tests/conftest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import os
6+
import asyncio
67
import logging
78
from typing import TYPE_CHECKING, Iterator, AsyncIterator
89

@@ -108,6 +109,14 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncRunloop]:
108109
raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict")
109110

110111
async with AsyncRunloop(
111-
base_url=base_url, bearer_token=bearer_token, _strict_response_validation=strict, http_client=http_client
112+
base_url=base_url,
113+
bearer_token=bearer_token,
114+
_strict_response_validation=strict,
115+
http_client=http_client,
116+
shared_http_pool=False,
112117
) as client:
113118
yield client
119+
120+
# Give async transports a chance to finish closing before pytest collects
121+
# unraisable ResourceWarnings under filterwarnings=error.
122+
await asyncio.sleep(0.1)

0 commit comments

Comments
 (0)