Skip to content

Commit 8450dd8

Browse files
committed
Add pytest-language-server configuration for fixture navigation
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent 54086df commit 8450dd8

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ A few plugins are recommended to properly report the diagnostics during the deve
439439
* [BasedPyright](https://open-vsx.org/extension/detachhead/basedpyright)
440440
* [flake8](https://open-vsx.org/extension/ms-python/flake8)
441441
* [ruff](https://open-vsx.org/extension/charliermarsh/ruff)
442+
* [pytest Language Server](https://open-vsx.org/extension/bellini666/pytest-language-server)
442443
* [autopep8](https://open-vsx.org/extension/ms-python/autopep8)
443444

444445

@@ -458,6 +459,8 @@ Install the required language servers:
458459
* [BasedPyright](https://docs.basedpyright.com/latest/) with `uv tool install basedpyright`
459460
* [pylsp](https://github.com/python-lsp/python-lsp-server) with `uv tool install python-lsp-server[flake8] --with pylsp-rope`.
460461
It's used to get immediate flake8 feedback in the text editor.
462+
* [pytest-language-server](https://github.com/bellini666/pytest-language-server) with
463+
`uv tool install pytest-language-server`. It allows to navigate in pytest fixtures.
461464

462465
[ruff](https://docs.astral.sh/ruff/), which is also used as a language server, is already installed as a dev dependency.
463466

@@ -469,6 +472,7 @@ configuration (`.git/info/exclude`).
469472
[[language]]
470473
name = "python"
471474
language-servers = [
475+
"pytest-language-server",
472476
"basedpyright",
473477
"pylsp",
474478
"ruff",

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,8 @@ exclude=".git,.venv,data.py,vm_data.py"
140140
# We force them back to the upstream value, so we can just download the expected python version
141141
python-downloads = "automatic"
142142
python-preference = "managed"
143+
144+
[tool.pytest-language-server]
145+
# pytest-language-server shows some internal variables, like host, as undeclared fixture.
146+
# An undeclared fixture would be cought by pyright/mypy. Just disable that diagnostic.
147+
disabled_diagnostics = ["undeclared-fixture"]

0 commit comments

Comments
 (0)