deprecation icon indicating copy to clipboard operation
deprecation copied to clipboard

fail_if_not_removed decorator does not work for async methods

Open chbndrhnns opened this issue 2 years ago • 3 comments

I am using anyio with asyncio. It seems to me that the decorator messes with the async frameworks and causes the test to be skipped.

Example 1: this test is ignored with "SKIPPED (async def function and no async plugin installed (see warnings))"

import deprecation
import pytest


@deprecation.fail_if_not_removed
@pytest.mark.anyio
async def test_async():
    assert True

Example 2: If I switch the decorators around, I see another message in addition: "coroutine 'test_async' was never awaited":

import deprecation
import pytest


@pytest.mark.anyio
@deprecation.fail_if_not_removed
async def test_async():
    assert True

chbndrhnns avatar Apr 26 '22 16:04 chbndrhnns