Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for async pytest fixtures #1979

Open
stinovlas opened this issue Jan 14, 2024 · 0 comments
Open

Add support for async pytest fixtures #1979

stinovlas opened this issue Jan 14, 2024 · 0 comments
Labels

Comments

@stinovlas
Copy link

Hi! I was trying to get jedi (actually python-lsp-server) working with pytest and I bumped into the fact that jedi apparently doesn't recognize asynchronous pytest fixtures. The autocomplete works on synchronous fixtures (both from pytest itself and from my conftest.py, but the asynchronous fixtures are not picked up. Showcase:

import asyncio
import pytest

@pytest.fixture
def anyio_backend():
    return "asyncio"

@pytest.fixture
async def async_fixture(anyio_backend):
    return []

@pytest.fixture
def sync_fixture():
    return []

The sync_fixture is picked up by jedi and hinted properly. The async_fixture seems to be completely ignored.

I didn't have time yet to delve into jedi code and research how difficult such support would be, but I believe it shouldn't be enormous amount of work, considering we already have working detection for synchronous fixtures.

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

No branches or pull requests

2 participants