Файли
openidea/fixtures/python-app/tests/conftest.py
T
LU XIANGRUIтаwildcatDownstairs bc64188c38 feat(python): go to definition and completion for pytest fixtures (#6510)
A fixture parameter of a test or fixture now resolves to the fixture that pytest would inject: the nearest definition in the same class or module, then the conftest.py chain up to the root, pytest_plugins modules, pytest11 entry points and the _pytest builtins. Go to Declaration opens it, and completion in a test's parameter list offers the fixtures in scope with their source file. Named fixtures (name=...) and usefixtures("...") strings are covered; the fixture layers are cached by file mtime.

Closes #6490

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-27 22:12:59 +08:00

16 рядки
262 B
Python

import pytest
from tasks import Priority, TaskList
@pytest.fixture
def tasks():
return TaskList()
@pytest.fixture(name="sample")
def sample_tasks(tasks):
tasks.add("write docs", Priority.HIGH)
tasks.add("tidy up", Priority.LOW)
return tasks