Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated #468

Closed
hroncok opened this issue Oct 24, 2024 · 0 comments · Fixed by #469
Closed

DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated #468

hroncok opened this issue Oct 24, 2024 · 0 comments · Fixed by #469

Comments

@hroncok
Copy link
Member

hroncok commented Oct 24, 2024

Hello,

when building dependent packages in Fedora with Python 3.14.0a1, I got this when building meson-python:

____________________________ test_invalid_build_dir ____________________________

package_pure = PosixPath('/builddir/build/BUILD/python-meson-python-0.17.0-build/meson_python-0.17.0/tests/packages/pure')
tmp_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_invalid_build_dir0')
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f1b7d91b750>

    @pytest.mark.skipif(
        sys.version_info < (3, 8),
        reason="unittest.mock doesn't support the required APIs for this test",
    )
    def test_invalid_build_dir(package_pure, tmp_path, mocker):
>       meson = mocker.spy(mesonpy.Project, '_run')

/builddir/build/BUILD/python-meson-python-0.17.0-build/meson_python-0.17.0/tests/test_project.py:168: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.14/site-packages/pytest_mock/plugin.py:199: in spy
    if asyncio.iscoroutinefunction(method):
/usr/lib64/python3.14/asyncio/coroutines.py:23: in iscoroutinefunction
    warnings._deprecated("asyncio.iscoroutinefunction",
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'asyncio.iscoroutinefunction'
message = '{name!r} is deprecated and slated for removal in Python {remove}; use inspect.iscoroutinefunction() instead'

    def _deprecated(name, message=_DEPRECATED_MSG, *, remove, _version=sys.version_info):
        """Warn that *name* is deprecated or should be removed.
    
        RuntimeError is raised if *remove* specifies a major/minor tuple older than
        the current Python version or the same version but past the alpha.
    
        The *message* argument is formatted with *name* and *remove* as a Python
        version tuple (e.g. (3, 11)).
    
        """
        remove_formatted = f"{remove[0]}.{remove[1]}"
        if (_version[:2] > remove) or (_version[:2] == remove and _version[3] != "alpha"):
            msg = f"{name!r} was slated for removal after Python {remove_formatted} alpha"
            raise RuntimeError(msg)
        else:
            msg = message.format(name=name, remove=remove_formatted)
>           warn(msg, DeprecationWarning, stacklevel=3)
E           DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

/usr/lib64/python3.14/warnings.py:668: DeprecationWarning

I just thought I send you a heads-up. It seems inspect.iscoroutinefunction is available since Python 3.5, so that should be safe to use. Will check.

hroncok added a commit to hroncok/pytest-mock that referenced this issue Oct 24, 2024
DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

Fixes pytest-dev#468
nicoddemus pushed a commit to hroncok/pytest-mock that referenced this issue Oct 25, 2024
DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

Fixes pytest-dev#468
nicoddemus pushed a commit that referenced this issue Oct 25, 2024
…469)

DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

Fixes #468
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 a pull request may close this issue.

1 participant