Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Move from asyncio.Task.current_task() to asyncio.current_task() #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

libnoon
Copy link
Contributor

@libnoon libnoon commented Oct 23, 2019

asyncio.Task.current_task() is deprecated, and generates lots of warnings in the pytests.

$ python3.7 -m pytest tests
[...]
platform linux -- Python 3.7.5rc1, pytest-3.10.1, py-1.8.0, pluggy-0.12.0
[...]
tests/scope_managers/test_asyncio.py::AsyncioCompabilityCheck::test_activate
  /home/noon/git/opentracing-python/opentracing/scope_managers/asyncio.py:110: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
    return asyncio.Task.current_task(loop=loop)
  /home/noon/git/opentracing-python/opentracing/scope_managers/asyncio.py:110: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
    return asyncio.Task.current_task(loop=loop)
  /home/noon/git/opentracing-python/opentracing/scope_managers/asyncio.py:110: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
    return asyncio.Task.current_task(loop=loop)
  /home/noon/git/opentracing-python/opentracing/scope_managers/asyncio.py:110: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
    return asyncio.Task.current_task(loop=loop)
  /home/noon/git/opentracing-python/opentracing/scope_managers/asyncio.py:110: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
    return asyncio.Task.current_task(loop=loop)
  /home/noon/git/opentracing-python/opentracing/scope_managers/asyncio.py:110: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
    return asyncio.Task.current_task(loop=loop)
[...]

asyncio.Task.current_task() is deprecated, and generates lots of
warnings in the pytests.
@libnoon
Copy link
Contributor Author

libnoon commented Oct 23, 2019

This PR fails on Python 3.5 and 3.6. Should we test the Python version and use the correct function call depending on it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant