mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-20 12:34:17 +02:00
Fix unawaited coroutine warning and treat as test error (#2806)
This commit is contained in:
parent
befaad8a08
commit
da965db5cb
2 changed files with 5 additions and 0 deletions
|
|
@ -110,6 +110,9 @@ filterwarnings = [
|
|||
# Suppress OAuth in-memory token storage warnings in tests
|
||||
# Tests intentionally use ephemeral storage; this warning is for end users
|
||||
"ignore:Using in-memory token storage:UserWarning",
|
||||
# Treat unawaited coroutine warnings as errors - these are almost always bugs
|
||||
"error:coroutine .* was never awaited:RuntimeWarning",
|
||||
"error:Exception ignored in.*coroutine:pytest.PytestUnraisableExceptionWarning",
|
||||
]
|
||||
timeout = 5
|
||||
env = [
|
||||
|
|
|
|||
|
|
@ -686,6 +686,8 @@ class Client(Generic[ClientTransportT]):
|
|||
|
||||
# If session task already failed, raise immediately
|
||||
if session_task.done():
|
||||
# Close the coroutine to avoid "was never awaited" warning
|
||||
coro.close()
|
||||
exc = session_task.exception()
|
||||
if exc:
|
||||
raise exc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue