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:
Shalabh Gupta
2026-05-28 07:59:31 +05:30
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()