feat: Support parsing pytest_plugins as a form of import.
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- build-system
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Starlark
- Sterne
- 688
- Forks
- 723
- Ø Merge
- 1 T. 13 Std.
- Gemergte PRs (30 T.)
- 43
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus bazel-contrib/rules_python
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
bazel-contrib/rules_python#4201 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
bazel-contrib/rules_python#4164 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
bazel-contrib/rules_python#3821 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
bazel-contrib/rules_python#4198 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Release 2.4.0Offentype: release
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
bazel-contrib/rules_python#4175 · 15 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in bazel-contrib/rules_python
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 1 Tag
-
area:ci kind:gate-defect
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
InauguralSystems/EigenScript#1448 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
dell/omnia#5425 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
mpfaffenberger/privateer_reimagined#657 ·
Maintainer antworten meist innerhalb von 1 Tag
-
TS conversion
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
scylladb/nodejs-rs-driver#580 ·
Maintainer antworten meist innerhalb von 2 Tagen