Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

feat: Support parsing pytest_plugins as a form of import.

Ouverte
#4,196 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
68/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
build-system

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Starlark
Étoiles
688
Forks
723
Merge moyen
1 j 13 h
PR mergées (30 j)
43

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de bazel-contrib/rules_python

Toutes les issues de bazel-contrib/rules_python

Issues similaires

Plus d'issues Build System

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.