feat: Support parsing pytest_plugins as a form of import.
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- build-system
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Starlark
- Estrelas
- 688
- Forks
- 723
- Merge médio
- 1d 13h
- PRs com merge (30d)
- 43
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de bazel-contrib/rules_python
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
bazel-contrib/rules_python#4164 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
bazel-contrib/rules_python#3821 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
bazel-contrib/rules_python#4198 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Release 2.4.0Abertatype: release
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
bazel-contrib/rules_python#4175 · 11 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 70/100
bazel-contrib/rules_python#4171 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de bazel-contrib/rules_python
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
DaveGamble/cJSON#1094 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
trezor/trezor-firmware#7997 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
objectionary/eolang.sty#184 ·
-
bug good first issue help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
score-spec/docs#329 · 1 comentário ·