feat: Support parsing pytest_plugins as a form of import.
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- build-system
Direzione di ricerca
Start with the Gazelle plugin's dependency-scanning entry point and inspect how Python imports and existing gazelle:include_dep directives are handled. Extend the relevant parsing path to recognize valid string, list, and tuple pytest_plugins forms, then verify that each plugin import is added to deps using Gazelle's preferred label.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
feature request
Pytest does not utilize normal imports for fixtures, instead in your conftest.py or test file you can declare a pytest_plugins global, like so:
# To import foo.bar.baz and foo.bar.qux as pytest plugins that expose fixtures.
pytest_plugins = ["foo.bar.baz", "foo.bar.qux"]
# OR
pytest_plugins = ("foo.bar.baz", "foo.bar.qux")
# OR, to import only one item
pytest_plugins = "foo.bar.baz"
# No other formats are valid
This is, by pytest's standards, the intended way to import fixtures and extensions to the test engine, simply importing them is poorly supported and will not include transitive fixtures, nor properly rewrite asserts in the import.
pytest_plugins simply contains import paths and brings all fixtures and extensions in the import into scope.
Relevant Rules
Just the Gazelle plugin.
Description
This would be extending the Gazelle plugin to read pytest_plugins as a form of import, which should go in deps as normal.
Describe alternatives you've considered
Currently, we instead do this:
# gazelle:include_dep //tools/foo/tests:git_worktree,//tools/corporate_tool_utils/python/fixtures:put
pytest_plugins = ["tools.foo.tests.git_worktree", "tools.corporate_tool_utils.python.fixtures.put"]
This works fine, and is something we can lint for, but adds redundancy and can mismatch gazelle's preferred label for a dependency.
- Lingua principale
- Starlark
- Stelle
- 688
- Fork
- 723
- Merge medio
- 1g 13h
- PR unite (30g)
- 43
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bazel-contrib/rules_python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bazel-contrib/rules_python#4164 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bazel-contrib/rules_python#3821 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
bazel-contrib/rules_python#4198 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Release 2.4.0Apertatype: release
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
bazel-contrib/rules_python#4175 · 11 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
bazel-contrib/rules_python#4171 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bazel-contrib/rules_python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
DaveGamble/cJSON#1094 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
trezor/trezor-firmware#7997 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
objectionary/eolang.sty#184 ·
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
score-spec/docs#329 · 1 commento ·