davidhalter / davidhalter/jedi
Add support for async pytest fixtures
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 535
- PR merge metrics
- No merged PRs in 30d
Description
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:
```python
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.
Contributor guide
Research direction
Start by reproducing the provided pytest example and tracing how Jedi detects the working synchronous fixture. Extend that detection to the asynchronous fixture case, then verify that autocomplete recognizes async_fixture as it does sync_fixture.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100