mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Fix deprecated asyncio.iscoroutinefunction usage in test_cleanup_hooks.py (#4563)
Fixes #4522 Replace deprecated `asyncio.iscoroutinefunction()` with `inspect.iscoroutinefunction()` to resolve Python 3.13+ deprecation warning. Changes: - Added `import inspect` to imports - Replaced `asyncio.iscoroutinefunction(hook)` with `inspect.iscoroutinefunction(hook)` on line 126 - This makes the code consistent with other test methods in the same file (lines 201, 236) The rest of the file already uses `inspect.iscoroutinefunction()` correctly, making this change consistent with the existing codebase pattern. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Tao Chen <taochen@microsoft.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
e532ced950
commit
371a869e44
@@ -3,6 +3,7 @@
|
||||
"""Tests for cleanup hook registration and execution."""
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
@@ -123,7 +124,7 @@ async def test_register_cleanup_multiple_hooks():
|
||||
|
||||
# Execute all hooks
|
||||
for hook in hooks:
|
||||
if asyncio.iscoroutinefunction(hook):
|
||||
if inspect.iscoroutinefunction(hook):
|
||||
await hook()
|
||||
else:
|
||||
hook()
|
||||
|
||||
Reference in New Issue
Block a user