79417884

Date: 2025-02-06 12:24:02
Score: 2
Natty:
Report link

Edit: As this is already mentioned in one of the comments by Joel Sullivan

For:


This is not working for me:

import pytest

# Only test marked as `asyncio`
@pytest.mark.asyncio
async def test_app_1(create_1):
    assert create_1 == 1

@pytest.fixture
async def create_1():
    return 1

Because of

    @pytest.mark.asyncio
    async def test_app_1(create_1):
>       assert create_1 == 1
E       assert <coroutine object create_1 at 0x0000012AFE251590> == 1

But there is an annotation for Python fixture as well. And it is working for me

import pytest
import pytest_asyncio

# Annotation on test, marking it as `asyncio`
@pytest.mark.asyncio
async def test_app_2(create_2):
    assert create_2 == 1

# Additional `asyncio` annotation on fixture
@pytest_asyncio.fixture
async def create_2():
    return 1
Reasons:
  • RegEx Blacklisted phrase (3): not working for me
  • Long answer (-0.5):
  • Has code block (-0.5):
Posted by: Łukasz Kotyński