Open baggiponte opened 1 month ago
It's a pytest-asyncio
problem.
I don't know what is it exactly, but if you use @pytest_asyncio.fixture
instead of @pytest.fixture
it solves the issue.
I use @pytest.mark.anyio
instead of @pytest.mark.asyncio
since anyio
is already a dependency.
It's a
pytest-asyncio
problem.I don't know what is it exactly, but if you use
@pytest_asyncio.fixture
instead of@pytest.fixture
it solves the issue.
It works! π Thanks. If you think it's worthy an addition, I'd be glad to open a PR (even just a callout on the page).
I use
@pytest.mark.anyio
instead of@pytest.mark.asyncio
sinceanyio
is already a dependency.
Tried this out but errors since it requires trio (which shouldn't be a required dependency, I think?).
Tried this out but errors since it requires trio (which shouldn't be a required dependency, I think?).
This should set only asyncio
, instead of using both asyncio
and trio
.
@pytest.fixture
def anyio_backend():
return 'asyncio'
It works! π Thanks. If you think it's worthy an addition, I'd be glad to open a PR (even just a callout on the page).
I think it would make sense to recommend pytest.mark.anyio
instead of pytest.mark.asyncio
just for convenience, since you already have it installed... I would accept a PR with this recommendation.
Works! Will add this to the backlog and open a PR soon (hopefully).
Thanks.
Ciao! π
Was following tip number 5 and use httpx AsyncClient over the TestClient. So:
I'd like to make a fixture out of the client. So I tried this:
However when I use the fixture I get the following error:
Do you have some guidance? π