Skip to content

Conversation

@mmasztalerczuk
Copy link

Fix deprecation warnings for Python 3.14+

This PR replaces the deprecated asyncio.iscoroutinefunction() with inspect.iscoroutinefunction() to ensure Sanic tests run without deprecation warnings on Python 3.14+.

When running Sanic tests with Python 3.14, the following deprecation warnings appear:
DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

The warnings originate from pytest_sanic/plugin.py at lines 124 and 238.

Replace asyncio.iscoroutinefunction() with inspect.iscoroutinefunction() in both locations. The inspect module is already imported, so no additional dependencies are needed.

…routinefunction

`asyncio.iscoroutinefunction` is deprecated since Python 3.14 and slated
for removal in Python 3.16. Replace with `inspect.iscoroutinefunction`
which is available since Python 3.5 and provides the same functionality.

This change maintains backward compatibility with Python 3.9+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant