asynctest icon indicating copy to clipboard operation
asynctest copied to clipboard

DeprecationWarning in 3.8

Open tirkarthi opened this issue 5 years ago • 5 comments

asyncio.coroutine is deprecated in python/cpython#13346 . Since 3.4 not supported maybe async def can be used? I ran pytest on CPython master and warnings as below :

========================================= warnings summary =========================================
/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:434
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:434: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:448
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:448: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:468
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:468: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:489
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:489: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:357
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:357: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:381
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:381: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:392
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:392: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:403
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:403: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:414
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:414: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:445
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:445: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:487
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/case.py:487: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

/home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/helpers.py:13
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/helpers.py:13: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

test/test_case.py:44
  /home/karthi/asynctest/test/test_case.py:44: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def start_wait_process(loop):

test/test_case.py:58
  /home/karthi/asynctest/test/test_case.py:58: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def runTest(self):

test/test_case.py:399
  /home/karthi/asynctest/test/test_case.py:399: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def advance(self, seconds):

test/test_case.py:412
  /home/karthi/asynctest/test/test_case.py:412: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_advance(self):

test/test_case.py:445
  /home/karthi/asynctest/test/test_case.py:445: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_negative_advance(self):

test/test_case.py:451
  /home/karthi/asynctest/test/test_case.py:451: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_callbacks_are_called_on_time(self):

test/test_case.py:477
  /home/karthi/asynctest/test/test_case.py:477: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_setUp(self):

test/test_case.py:484
  /home/karthi/asynctest/test/test_case.py:484: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def setUp(self):

test/test_case.py:494
  /home/karthi/asynctest/test/test_case.py:494: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_setUp(self):

test/test_case.py:876
  /home/karthi/asynctest/test/test_case.py:876: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assertAsyncRaises(self):

test/test_case.py:887
  /home/karthi/asynctest/test/test_case.py:887: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assertAsyncRaisesRegex(self):

test/test_case.py:905
  /home/karthi/asynctest/test/test_case.py:905: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def warns(cls):

test/test_case.py:916
  /home/karthi/asynctest/test/test_case.py:916: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assertAsyncWarns(self):

test/test_case.py:926
  /home/karthi/asynctest/test/test_case.py:926: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assertAsyncWarnsRegex(self):

test/test_helpers.py:11
  /home/karthi/asynctest/test/test_helpers.py:11: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def wait_for(self, coro):

test/test_mock.py:19
  /home/karthi/asynctest/test/test_mock.py:19: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine(self):

test/test_mock.py:35
  /home/karthi/asynctest/test/test_mock.py:35: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine_with_args(self, arg, arg2):

test/test_mock.py:40
  /home/karthi/asynctest/test/test_mock.py:40: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_classmethod_coroutine(cls):

test/test_mock.py:45
  /home/karthi/asynctest/test/test_mock.py:45: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_staticmethod_coroutine():

test/test_mock.py:522
  /home/karthi/asynctest/test/test_mock.py:522: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_awaited_CoroutineMock_sets_awaited(self):

test/test_mock.py:540
  /home/karthi/asynctest/test/test_mock.py:540: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_awaited_CoroutineMock_counts(self):

test/test_mock.py:569
  /home/karthi/asynctest/test/test_mock.py:569: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_awaited_from_autospec_mock(self):

test/test_mock.py:580
  /home/karthi/asynctest/test/test_mock.py:580: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_awaited_wait(self):

test/test_mock.py:595
  /home/karthi/asynctest/test/test_mock.py:595: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_awaited_wait_next(self):

test/test_mock.py:614
  /home/karthi/asynctest/test/test_mock.py:614: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_await_args(self):

test/test_mock.py:632
  /home/karthi/asynctest/test/test_mock.py:632: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_await_args_list(self):

test/test_mock.py:650
  /home/karthi/asynctest/test/test_mock.py:650: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_awaited(self):

test/test_mock.py:660
  /home/karthi/asynctest/test/test_mock.py:660: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_awaited_once(self):

test/test_mock.py:674
  /home/karthi/asynctest/test/test_mock.py:674: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_awaited_with(self):

test/test_mock.py:688
  /home/karthi/asynctest/test/test_mock.py:688: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_awaited_once_with(self):

test/test_mock.py:702
  /home/karthi/asynctest/test/test_mock.py:702: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_any_wait(self):

test/test_mock.py:719
  /home/karthi/asynctest/test/test_mock.py:719: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_has_awaits(self):

test/test_mock.py:763
  /home/karthi/asynctest/test/test_mock.py:763: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_assert_not_awaited(self):

test/test_case.py::Test::StartWaitProcessTestCase::runTest
test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop
test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop
test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop
test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop
test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop
test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop
test/test_case.py::Test_TestCase_and_ChildWatcher::test_watched_process_is_awaited
test/test_case.py::Test_TestCase_and_ChildWatcher::test_watched_process_is_awaited
  /home/karthi/asynctest/test/test_case.py:50: DeprecationWarning: The loop argument is deprecated and scheduled for removal in Python 3.10.
    out, err = yield from asyncio.wait_for(

test/test_case.py::Test_TestCase::test_cleanup_functions_can_be_coroutines
  /home/karthi/asynctest/test/test_case.py:320: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def cleanup_coro():

test/test_case.py::Test_TestCase::test_coroutine_returned_executed
  /home/karthi/asynctest/test/test_case.py:236: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def set_ran(self):

test/test_case.py::Test_TestCase::test_coroutinefunction_executed
  /home/karthi/asynctest/test/test_case.py:213: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def runTest(self):

test/test_case.py::Test_TestCase::test_init_and_close_loop_for_test
test/test_case.py::Test_TestCase::test_init_and_close_loop_for_test
test/test_case.py::Test_TestCase::test_init_and_close_loop_for_test
test/test_case.py::Test_TestCase::test_init_and_close_loop_for_test
test/test_mock.py::Test_NonCallabableMock::test_mock_has_correct_name
test/test_mock.py::Test_NonCallabableMock::test_mock_has_correct_name
test/test_mock.py::Test_NonCallabableMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallabableMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallabableMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallabableMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallableMagicMock::test_context_manager_raise_exception_by_default
test/test_mock.py::Test_NonCallableMagicMock::test_context_manager_raise_exception_by_default
test/test_mock.py::Test_NonCallableMagicMock::test_mock_customize_async_context_manager
test/test_mock.py::Test_NonCallableMagicMock::test_mock_customize_async_context_manager
test/test_mock.py::Test_NonCallableMagicMock::test_mock_has_correct_name
test/test_mock.py::Test_NonCallableMagicMock::test_mock_has_correct_name
test/test_mock.py::Test_NonCallableMagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallableMagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallableMagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallableMagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_NonCallableMagicMock::test_mock_supports_async_context_manager
test/test_mock.py::Test_NonCallableMagicMock::test_mock_supports_async_context_manager
test/test_mock.py::Test_Mock::test_mock_has_correct_name
test/test_mock.py::Test_Mock::test_mock_has_correct_name
test/test_mock.py::Test_Mock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_Mock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_Mock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_Mock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_MagicMock::test_context_manager_raise_exception_by_default
test/test_mock.py::Test_MagicMock::test_context_manager_raise_exception_by_default
test/test_mock.py::Test_MagicMock::test_mock_customize_async_context_manager
test/test_mock.py::Test_MagicMock::test_mock_customize_async_context_manager
test/test_mock.py::Test_MagicMock::test_mock_has_correct_name
test/test_mock.py::Test_MagicMock::test_mock_has_correct_name
test/test_mock.py::Test_MagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_MagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_MagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_MagicMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_MagicMock::test_mock_supports_async_context_manager
test/test_mock.py::Test_MagicMock::test_mock_supports_async_context_manager
test/test_mock.py::Test_CoroutineMock::test_called_CoroutineMock_returns_MagicMock
test/test_mock.py::Test_CoroutineMock::test_exception_side_effect_raises_in_coroutine
test/test_mock.py::Test_CoroutineMock::test_mock_has_correct_name
test/test_mock.py::Test_CoroutineMock::test_mock_has_correct_name
test/test_mock.py::Test_CoroutineMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_CoroutineMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_CoroutineMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_CoroutineMock::test_mock_returns_coroutine_according_to_spec
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_return_value
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect_being_a_coroutine
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect_being_an_iterable
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect_being_an_iterable
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect_being_an_iterable
test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_with_return_value_being_a_coroutine
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_any_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_any_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_any_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited_once
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited_once
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited_once_with
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited_once_with
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited_with
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_awaited_with
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_has_awaits
test/test_mock.py::Test_CoroutineMock_awaited::test_assert_not_awaited
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args_list
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args_list
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args_list
test/test_mock.py::Test_CoroutineMock_awaited::test_await_args_list
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_sets_awaited
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_sets_awaited
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_delays_creation_of_condition
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_from_autospec_mock
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait_next
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait_next
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait_next
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait_next
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_wait_next
test/test_mock.py::Test_CoroutineMock_awaited::test_create_autospec_on_coroutine_and_using_assert_methods
test/test_mock.py::Test_patch_autospec::test_patch_multiple_autospec
test/test_mock.py::Test_patch_autospec::test_patch_multiple_autospec
test/test_mock.py::Test_patch_autospec::test_patch_object_autospec
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_coroutine_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_coroutine_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_exception_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_exception_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_iterable_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_iterable_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_iterable_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_iterable_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_return_value
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_return_value
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:599: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

test/test_case.py::Test_TestCase::test_setup_teardown_may_be_coroutines
  /home/karthi/asynctest/test/test_case.py:283: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def setUp(self):

test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup
test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup
test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup
test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup
  /home/karthi/asynctest/test/test_case.py:848: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    self.addCleanup(asyncio.coroutine(lambda: None))

test/test_case.py::Test_fail_on_unused_loop::test_passes_when_ignore_loop_or_loop_run
  /home/karthi/asynctest/test/test_case.py:800: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def runTest(self):

test/test_helpers.py::TestExhaust::test_exhaust_callbacks_cascading_callbacks
test/test_helpers.py::TestExhaust::test_exhaust_callbacks_nothing_to_wait
test/test_helpers.py::TestExhaust::test_exhaust_callbacks_one_callback
  /home/karthi/asynctest/test/test_helpers.py:12: DeprecationWarning: The loop argument is deprecated and scheduled for removal in Python 3.10.
    return (yield from asyncio.wait_for(coro, loop=self.loop, timeout=1))

test/test_mock.py::Test_CoroutineMock::test_exception_side_effect_raises_in_coroutine
test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_exception_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_exception_side_effect
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:594: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect_being_a_coroutine
  /home/karthi/asynctest/test/test_mock.py:176: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    mock.side_effect = asyncio.coroutine(lambda: 'ProbeValue')

test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_with_return_value_being_a_coroutine
  /home/karthi/asynctest/test/test_mock.py:163: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    coroutine = asyncio.coroutine(lambda: 'ProbeValue')

test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts
  /home/karthi/asynctest/test/test_mock.py:550: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def side_effect():

test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_sets_awaited
  /home/karthi/asynctest/test/test_mock.py:531: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def side_effect():

test/test_mock.py::Test_patch::test_patch_is_enabled_when_running_decorated_coroutine
  /home/karthi/asynctest/test/test_mock.py:971: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine():

test/test_mock.py::Test_patch::test_patch_is_enabled_when_running_decorated_coroutine
test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_concurrent_patches_dont_affect_each_other
test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_coroutine_type_when_patched
test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_mock_on_patched_coroutine_is_a_new_mock_for_each_call
test/test_mock.py::Test_patch_object::test_patch_decorates_coroutine
test/test_mock.py::Test_patch_multiple::test_patch_decorates_coroutine
test/test_mock.py::Test_patch_dict::test_patch_decorates_class
test/test_mock.py::Test_patch_dict::test_patch_decorates_concurrent_coroutines
test/test_mock.py::Test_patch_dict::test_patch_decorates_coroutine
test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes
test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes
test/test_mock.py::Test_patch_and_patch_dict_scope::test_both_patch_and_patch_dict_with_scope_global
test/test_mock.py::Test_patch_and_patch_dict_scope::test_both_patch_and_patch_dict_with_scope_global
test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_deactivate_patch_when_generator_exec_fails
test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_deactivate_patch_when_generator_exec_fails
test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_patched_coroutine_with_mock_args
  /home/karthi/pydev-venv/lib/python3.8/site-packages/asynctest-0.13.0-py3.8.egg/asynctest/mock.py:1008: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_concurrent_patches_dont_affect_each_other
  /home/karthi/asynctest/test/test_mock.py:1110: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_patch(recursive, *_):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_coroutine_arg_is_default_mock
  /home/karthi/asynctest/test/test_mock.py:1043: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester(coroutine_function):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_mock_on_patched_coroutine_is_a_new_mock_for_each_call
  /home/karthi/asynctest/test/test_mock.py:1086: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def store_mock_from_patch(mock):

test/test_mock.py::Test_patch_object::test_patch_decorates_coroutine
  /home/karthi/asynctest/test/test_mock.py:1158: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine():

test/test_mock.py::Test_patch_multiple::test_patch_decorates_coroutine
  /home/karthi/asynctest/test/test_mock.py:1196: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine():

test/test_mock.py::Test_patch_dict::test_patch_decorates_class
  /home/karthi/asynctest/test/test_mock.py:1245: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def test_a_coroutine(self):

test/test_mock.py::Test_patch_dict::test_patch_decorates_concurrent_coroutines
  /home/karthi/asynctest/test/test_mock.py:1263: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine(recursive):

test/test_mock.py::Test_patch_dict::test_patch_decorates_coroutine
  /home/karthi/asynctest/test/test_mock.py:1217: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine():

test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes
  /home/karthi/asynctest/test/test_mock.py:1571: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester_coroutine(future):

test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes
  /home/karthi/asynctest/test/test_mock.py:1595: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine(future):

test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes
  /home/karthi/asynctest/test/test_mock.py:1607: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine(future):

test/test_mock.py::Test_patch_and_patch_dict_scope::test_both_patch_and_patch_dict_with_scope_global
  /home/karthi/asynctest/test/test_mock.py:1655: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine():

test/test_mock.py::Test_patch_and_patch_dict_scope::test_both_patch_and_patch_dict_with_scope_global
  /home/karthi/asynctest/test/test_mock.py:1664: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine():

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes
  /home/karthi/asynctest/test/test_mock.py:1758: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester(coro_function):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_deactivate_patch_when_generator_exec_fails
test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_deactivate_patch_when_generator_exec_fails
  /home/karthi/asynctest/test/test_mock.py:1415: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine(missing_arg):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_deactivate_patch_when_generator_exec_fails
test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_deactivate_patch_when_generator_exec_fails
  /home/karthi/asynctest/test/test_mock.py:1420: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester():

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_deactivate_patch_when_generator_exec_fails
test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_deactivate_patch_when_generator_exec_fails
  /home/karthi/asynctest/test/test_mock.py:1437: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester():

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_multiple_patches_on_coroutine
  /home/karthi/asynctest/test/test_mock.py:1951: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester(coro_function):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_patch_coroutine_during_its_lifetime
  /home/karthi/asynctest/test/test_mock.py:1869: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester(coro_function):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_multiple_patches_on_coroutine
  /home/karthi/asynctest/test/test_mock.py:2057: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester(coro_function):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_patch_coroutine_only_when_running
  /home/karthi/asynctest/test/test_mock.py:2009: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def tester(coro_function):

test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_patched_coroutine_with_mock_args
  /home/karthi/asynctest/test/test_mock.py:2042: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def a_coroutine(mock):

test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_coroutine_side_effect
test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_coroutine_side_effect
  /home/karthi/asynctest/test/test_mock.py:2256: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    a_coroutine, side_effect=asyncio.coroutine(lambda r: r))

tirkarthi avatar May 19 '19 02:05 tirkarthi

Worth noting that just changing to async-def's is not enough, as this will cause your current code base to produce RuntimeWarnings.

Reason being that failing to await an asyncio.coroutine-marked function's coroutine does not produce a warning in Python3.7, but failing to await an async-def coroutine will.

Python 3.7.3 (default, Jun 24 2019, 04:54:02)
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>>
>>> @asyncio.coroutine
... def foo():
...     pass
...
>>> f = foo()
>>> del f
>>>
>>> async def bar():
...     pass
...
>>> b = bar()
>>> del b
__main__:1: RuntimeWarning: coroutine 'bar' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

I can put a pull request up with the main changes, but specifically, we have a few failures that appear to be because of this issue. Without knowing this code base any better, I am reluctant to do something that is against how you would like this code base to be designed :-)

ghost avatar Jul 14 '19 12:07 ghost

It's relatively easy to silence "never awaited" warnings: just add a dummy callback. The tricky part is to understand why it was never awaited in the first place!

dimaqq avatar Sep 19 '19 05:09 dimaqq

@nekokatt please publish a wip PR and maybe someone else will poke at it?

dimaqq avatar Jan 28 '20 05:01 dimaqq

is this still needed? Python3.8 has AsyncMock in the standard lib now it appears

ghost avatar Jan 28 '20 06:01 ghost

That's a good question :) If I remember correctly, py3.8 AsyncMock doesn't have all the features of the asynctest... , Specifically, I suspect that py3.8 can't do asynctest.mock.patch("...", autospec=True). Then again I haven't tried that yet 🤔

dimaqq avatar Jan 28 '20 06:01 dimaqq